fluent-plugin-output-solr 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1c6f8222ca0caa3aab7d45245fabcb11e366829
4
- data.tar.gz: 9a764db856bc8c0a929d69cb83513d02c05cac6b
3
+ metadata.gz: bef37db6afb6d0104ca4e9942148760dd163e86a
4
+ data.tar.gz: 9c8e3ac8d9f5dfa6b2074b2f11f0325f31f60ad0
5
5
  SHA512:
6
- metadata.gz: 98e5f570b06cb21f647bd716adeacf1ae97860153c4a0786d1be1c3bd51cacc373ae0e4a71ddcb7f271635989112455289dde153979383a4b4e5a0e8de3a007e
7
- data.tar.gz: 8328972f13b14dfe7660d16e630e6ae7a8076f7a7ca370d018f557a8e6dbd00b43cbcf1fd27bdb66a40b6459d5a66bd523652605679edcb264b0c360a396f5fb
6
+ metadata.gz: b46104d132011125b60ab250678ff57e372d171272435a284d82af5ce44c05dc838cc0f45918467ebe9e974e915ee68002ec858eecf65e5f100b3e3f3dbb50e7
7
+ data.tar.gz: a1436fbcc3b111ef0aa47086903ab9f041610c0fb65721697d01e03ec5de49a7eb547040ae98265f59b6141def4a5ab685c23881ff22c7a7d3de905f2b8a9ba2
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-output-solr"
7
- spec.version = "0.2.4"
7
+ spec.version = "0.2.5"
8
8
  spec.authors = ["Minoru Osuka"]
9
9
  spec.email = ["minoru.osuka@gmail.com"]
10
10
 
@@ -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
- log.info record
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
- return true if string== true || string =~ (/(true|t|yes|y|1)$/i)
147
- return false if string== false || string.nil? || string =~ (/(false|f|no|n|0)$/i)
148
- raise ArgumentError.new("invalid value for Boolean: \"#{string}\"")
149
- end
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("An error occurred while indexing: #{e.message}")
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 ("Unique key: #{unique_key}")
176
+ log.info "Unique key: #{unique_key}"
174
177
 
175
178
  return unique_key
176
179
 
177
180
  rescue Exception => e
178
- log.warn("An error occurred while indexing: #{e.message}")
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 ("Fields: #{fields}")
197
+ log.info "Fields: #{fields}"
195
198
 
196
199
  return fields
197
200
 
198
201
  rescue Exception => e
199
- log.warn("An error occurred while indexing: #{e.message}")
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
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-17 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd