fluent-plugin-output-solr 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-output-solr.gemspec +1 -1
- data/lib/fluent/plugin/out_solr.rb +18 -15
- 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: bef37db6afb6d0104ca4e9942148760dd163e86a
|
4
|
+
data.tar.gz: 9c8e3ac8d9f5dfa6b2074b2f11f0325f31f60ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46104d132011125b60ab250678ff57e372d171272435a284d82af5ce44c05dc838cc0f45918467ebe9e974e915ee68002ec858eecf65e5f100b3e3f3dbb50e7
|
7
|
+
data.tar.gz: a1436fbcc3b111ef0aa47086903ab9f041610c0fb65721697d01e03ec5de49a7eb547040ae98265f59b6141def4a5ab685c23881ff22c7a7d3de905f2b8a9ba2
|
@@ -58,7 +58,7 @@ module Fluent
|
|
58
58
|
@collection = conf.has_key?('collection') ? conf['collection'] : DEFAULT_COLLECTION
|
59
59
|
|
60
60
|
@defined_fields = conf['defined_fields']
|
61
|
-
@ignore_undefined_fields = conf.has_key?('ignore_undefined_fields') ? conf['ignore_undefined_fields'] : DEFAULT_IGNORE_UNDEFINED_FIELDS
|
61
|
+
@ignore_undefined_fields = conf.has_key?('ignore_undefined_fields') ? to_boolean(conf['ignore_undefined_fields']) : DEFAULT_IGNORE_UNDEFINED_FIELDS
|
62
62
|
|
63
63
|
@unique_key_field = conf['unique_key_field']
|
64
64
|
@tag_field = conf.has_key?('tag_field') ? conf['tag_field'] : DEFAULT_TAG_FIELD
|
@@ -120,17 +120,16 @@ module Fluent
|
|
120
120
|
record.merge!({@timestamp_field => Time.at(time).utc.strftime('%FT%TZ')})
|
121
121
|
end
|
122
122
|
|
123
|
-
|
124
|
-
|
125
|
-
if to_boolean(@ignore_undefined_fields) then
|
123
|
+
if @ignore_undefined_fields then
|
126
124
|
record.each_key do |key|
|
127
125
|
unless @fields.include?(key) then
|
128
126
|
record.delete(key)
|
129
127
|
end
|
130
128
|
end
|
131
|
-
log.info record
|
132
129
|
end
|
133
130
|
|
131
|
+
log.info "Record: %s" % record.inspect
|
132
|
+
|
134
133
|
documents << record
|
135
134
|
|
136
135
|
if documents.count >= @flush_size
|
@@ -143,10 +142,14 @@ module Fluent
|
|
143
142
|
end
|
144
143
|
|
145
144
|
def to_boolean(string)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
145
|
+
if string== true || string =~ (/(true|t|yes|y|1)$/i) then
|
146
|
+
return true
|
147
|
+
elsif string== false || string.nil? || string =~ (/(false|f|no|n|0)$/i)
|
148
|
+
return false
|
149
|
+
else
|
150
|
+
return false
|
151
|
+
end
|
152
|
+
end
|
150
153
|
|
151
154
|
def update(documents)
|
152
155
|
if @mode == MODE_STANDALONE then
|
@@ -154,10 +157,10 @@ module Fluent
|
|
154
157
|
log.info "Added %d document(s) to Solr" % documents.count
|
155
158
|
elsif @mode == MODE_SOLRCLOUD then
|
156
159
|
@solr.add documents, collection: @collection, :params => {:commit => true}
|
157
|
-
log.info "Added %d document(s) to Solr" % documents.count
|
160
|
+
log.info "Update: Added %d document(s) to Solr" % documents.count
|
158
161
|
end
|
159
162
|
rescue Exception => e
|
160
|
-
log.warn
|
163
|
+
log.warn "Update: An error occurred while indexing: #{e.message}"
|
161
164
|
end
|
162
165
|
|
163
166
|
def get_unique_key
|
@@ -170,12 +173,12 @@ module Fluent
|
|
170
173
|
end
|
171
174
|
|
172
175
|
unique_key = response['uniqueKey']
|
173
|
-
log.info
|
176
|
+
log.info "Unique key: #{unique_key}"
|
174
177
|
|
175
178
|
return unique_key
|
176
179
|
|
177
180
|
rescue Exception => e
|
178
|
-
log.warn
|
181
|
+
log.warn "Unique key: #{e.message}"
|
179
182
|
end
|
180
183
|
|
181
184
|
def get_fields
|
@@ -191,12 +194,12 @@ module Fluent
|
|
191
194
|
response['fields'].each do |field|
|
192
195
|
fields.push(field['name'])
|
193
196
|
end
|
194
|
-
log.info
|
197
|
+
log.info "Fields: #{fields}"
|
195
198
|
|
196
199
|
return fields
|
197
200
|
|
198
201
|
rescue Exception => e
|
199
|
-
log.warn
|
202
|
+
log.warn "Fields: #{e.message}"
|
200
203
|
end
|
201
204
|
end
|
202
205
|
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.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minoru Osuka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|