fluent-plugin-output-solr 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/fluent-plugin-output-solr.gemspec +1 -1
- data/fluent.conf +3 -38
- data/lib/fluent/plugin/out_solr.rb +33 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47e3caa1f6aa5e15e129881af97b226e5ad19bf9
|
4
|
+
data.tar.gz: daf903c8e406d5122fae89a1472b782a1482785e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1767955e6d29a293bf326f4712637b3c905cd2b28c00eef6ecaa387a47275b55ed2a0d41fa34ad0270be7022ad9f43550004f9312e2d9c9c1324477450dd1638
|
7
|
+
data.tar.gz: cfa4c10ae32925707d32e8e73e42c06732503798a813aa9e1aa38d826c36d8b2d00ed74227ab1c37e6537ce7f89abda8985d9bc93795dfe34e93454aeb91dfaf
|
data/README.md
CHANGED
@@ -80,6 +80,14 @@ A field name of unique key in the Solr schema.xml. If omitted, it will get uniqu
|
|
80
80
|
unique_key_field id
|
81
81
|
```
|
82
82
|
|
83
|
+
### string_field_value_max_length
|
84
|
+
|
85
|
+
A string field value max length. If set -1, it means unlimited (default -1). However, there is a limit of Solr.
|
86
|
+
|
87
|
+
```
|
88
|
+
string_field_value_max_length -1
|
89
|
+
```
|
90
|
+
|
83
91
|
### timestamp_field
|
84
92
|
|
85
93
|
A field name of event timestamp in the Solr schema.xml (default event_timestamp).
|
data/fluent.conf
CHANGED
@@ -13,46 +13,11 @@
|
|
13
13
|
key_name message
|
14
14
|
</filter>
|
15
15
|
|
16
|
-
<filter messages>
|
17
|
-
@type geoip
|
18
|
-
log_level error
|
19
|
-
enable_auto_download true
|
20
|
-
md5_url http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.md5
|
21
|
-
download_url http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz
|
22
|
-
md5_path "#{ENV['HOME']}/fluentd/geoip/database/GeoLite2-City.md5"
|
23
|
-
database_path "#{ENV['HOME']}/fluentd/geoip/database/GeoLite2-City.mmdb"
|
24
|
-
lookup_field clientip
|
25
|
-
output_field geoip
|
26
|
-
field_delimiter _
|
27
|
-
flatten true
|
28
|
-
locale en
|
29
|
-
continent true
|
30
|
-
country true
|
31
|
-
city true
|
32
|
-
location true
|
33
|
-
postal true
|
34
|
-
registered_country true
|
35
|
-
represented_country true
|
36
|
-
subdivisions true
|
37
|
-
traits true
|
38
|
-
connection_type true
|
39
|
-
</filter>
|
40
|
-
|
41
|
-
<filter messages>
|
42
|
-
@type record_transformer
|
43
|
-
log_level error
|
44
|
-
enable_ruby
|
45
|
-
<record>
|
46
|
-
event_timestamp ${timestamp}
|
47
|
-
geoip_localtion_latitude_longitude ${geoip_location_latitude.nil? || geoip_location_longitude.nil? ? nil : geoip_location_latitude.to_s + ',' + geoip_location_longitude.to_s}
|
48
|
-
</record>
|
49
|
-
</filter>
|
50
|
-
|
51
16
|
<match messages>
|
52
17
|
@type solr
|
53
|
-
|
54
|
-
zk_host
|
55
|
-
collection
|
18
|
+
# url http://localhost:8983/solr/collection1
|
19
|
+
zk_host localhost:2181/solr
|
20
|
+
collection collection1
|
56
21
|
ignore_undefined_fields false
|
57
22
|
flush_size 100
|
58
23
|
buffer_type memory
|
@@ -9,6 +9,7 @@ module Fluent
|
|
9
9
|
|
10
10
|
DEFAULT_COLLECTION = 'collection1'
|
11
11
|
DEFAULT_IGNORE_UNDEFINED_FIELDS = false
|
12
|
+
DEFAULT_STRING_FIELD_VALUE_MAX_LENGTH = -1
|
12
13
|
DEFAULT_TAG_FIELD = 'tag'
|
13
14
|
DEFAULT_TIMESTAMP_FIELD = 'event_timestamp'
|
14
15
|
DEFAULT_FLUSH_SIZE = 100
|
@@ -34,7 +35,9 @@ module Fluent
|
|
34
35
|
config_param :defined_fields, :array, :default => nil,
|
35
36
|
:desc => 'The defined fields in the Solr schema.xml. If omitted, it will get fields via Solr Schema API.'
|
36
37
|
config_param :ignore_undefined_fields, :bool, :default => DEFAULT_IGNORE_UNDEFINED_FIELDS,
|
37
|
-
:desc => 'Ignore undefined fields in the Solr schema.xml.'
|
38
|
+
:desc => 'Ignore undefined fields in the Solr schema.xml.'
|
39
|
+
config_param :string_field_value_max_length, :integer, :default => DEFAULT_STRING_FIELD_VALUE_MAX_LENGTH,
|
40
|
+
:desc => 'Field value max length.'
|
38
41
|
|
39
42
|
config_param :unique_key_field, :string, :default => nil,
|
40
43
|
:desc => 'A field name of unique key in the Solr schema.xml. If omitted, it will get unique key via Solr Schema API.'
|
@@ -125,6 +128,30 @@ module Fluent
|
|
125
128
|
end
|
126
129
|
end
|
127
130
|
|
131
|
+
if @string_field_value_max_length >= 0 then
|
132
|
+
record.each_key do |key|
|
133
|
+
if record[key].instance_of?(Array) then
|
134
|
+
values = []
|
135
|
+
record[key].each do |value|
|
136
|
+
if value.instance_of?(String) then
|
137
|
+
if value.length > @string_field_value_max_length then
|
138
|
+
log.warn "#{key} is too long (#{value.length}, max is #{@string_field_value_max_length})."
|
139
|
+
values.push(value.slice(0, @string_field_value_max_length))
|
140
|
+
else
|
141
|
+
values.push(value)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
record[key] = values
|
146
|
+
elsif record[key].instance_of?(String) then
|
147
|
+
if record[key].length > @string_field_value_max_length then
|
148
|
+
log.warn "#{key} is too long (#{record[key].length}, max is #{@string_field_value_max_length})."
|
149
|
+
record[key] = record[key].slice(0, @string_field_value_max_length)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
128
155
|
documents << record
|
129
156
|
|
130
157
|
if documents.count >= @flush_size
|
@@ -139,13 +166,13 @@ module Fluent
|
|
139
166
|
def update(documents)
|
140
167
|
if @mode == MODE_STANDALONE then
|
141
168
|
@solr.add documents, :params => {:commit => @commit_with_flush}
|
142
|
-
log.debug "Added
|
169
|
+
log.debug "Added #{documents.count} document(s) to Solr"
|
143
170
|
elsif @mode == MODE_SOLRCLOUD then
|
144
171
|
@solr.add documents, collection: @collection, :params => {:commit => @commit_with_flush}
|
145
|
-
log.debug "
|
172
|
+
log.debug "Added #{documents.count} document(s) to Solr"
|
146
173
|
end
|
147
174
|
rescue Exception => e
|
148
|
-
log.warn "
|
175
|
+
log.warn "An error occurred while indexing: #{e.message}"
|
149
176
|
end
|
150
177
|
|
151
178
|
def get_unique_key
|
@@ -163,7 +190,7 @@ module Fluent
|
|
163
190
|
return unique_key
|
164
191
|
|
165
192
|
rescue Exception => e
|
166
|
-
log.warn "
|
193
|
+
log.warn "An error occurred: #{e.message}"
|
167
194
|
end
|
168
195
|
|
169
196
|
def get_fields
|
@@ -184,7 +211,7 @@ module Fluent
|
|
184
211
|
return fields
|
185
212
|
|
186
213
|
rescue Exception => e
|
187
|
-
log.warn "
|
214
|
+
log.warn "An error occurred: #{e.message}"
|
188
215
|
end
|
189
216
|
end
|
190
217
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-output-solr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minoru Osuka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|