fluent-plugin-output-solr 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 370d6fa0a4dcb1974c2429ce0c8d4cb5e9449b95
4
- data.tar.gz: 257e2e852a8f20b12631ccaddb23ceb645bf6a7e
3
+ metadata.gz: 51e820ac701e66673ab19adddf7d9757ee54c69e
4
+ data.tar.gz: fcd107f35414905f61c65b89fc72669b2ee4d1b9
5
5
  SHA512:
6
- metadata.gz: d75cf49b89c960916a1efb79d238878799fb3cef1620bcc6e6f50a85052475fa2e059543f72589dc2ddc7ce81f584fe40f0442e6961af3633a06928a094b0de2
7
- data.tar.gz: 75b0d8ec8325e8e2b4b4b27484f5dc238d302bb64d10efc5fdfea9e29abd5fc33fcad3b84715940fcee52bb2a7603fb596731a74a4bb23fc2782f9cdf39dd419
6
+ metadata.gz: a4bd3175277c9a5af0b8843be712896bcc4a588eebd8e9ad6c856fa0b88a24378c2874517b2cf23ce9cdd35f7c1f9289a478344dcf1d6f9b08eb88a6becde8a1
7
+ data.tar.gz: 3f6816f2c6f9b58973e7a34dd3e9512617d98c3902008ee799c183bfe99959a084883291b78dbd3412d32629ab1f9dd6b447c58d4bcedfea4f46a7628b879f2a
data/README.md CHANGED
@@ -68,6 +68,14 @@ A field name of unique key in the Solr schema.xml. If omitted, it will get uniqu
68
68
  unique_key_field id
69
69
  ```
70
70
 
71
+ ### tag_field
72
+
73
+ A field name of fluentd tag in the Solr schema.xml (default tag).
74
+
75
+ ```
76
+ tag_field tag
77
+ ```
78
+
71
79
  ### timestamp_field
72
80
 
73
81
  A field name of event timestamp in the Solr schema.xml (default event_timestamp).
@@ -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.1"
7
+ spec.version = "0.2.2"
8
8
  spec.authors = ["Minoru Osuka"]
9
9
  spec.email = ["minoru.osuka@gmail.com"]
10
10
 
@@ -9,6 +9,7 @@ module Fluent
9
9
 
10
10
  DEFAULT_COLLECTION = 'collection1'
11
11
  DEFAULT_IGNORE_UNDEFINED_FIELDS = false
12
+ DEFAULT_TAG_FIELD = 'tag'
12
13
  DEFAULT_TIMESTAMP_FIELD = 'event_timestamp'
13
14
  DEFAULT_FLUSH_SIZE = 100
14
15
 
@@ -36,6 +37,8 @@ module Fluent
36
37
 
37
38
  config_param :unique_key_field, :string, :default => nil,
38
39
  :desc => 'A field name of unique key in the Solr schema.xml. If omitted, it will get unique key via Solr Schema API.'
40
+ config_param :tag_field, :string, :default => DEFAULT_TAG_FIELD,
41
+ :desc => 'A field name of fluentd tag in the Solr schema.xml (default event_timestamp).'
39
42
  config_param :timestamp_field, :string, :default => DEFAULT_TIMESTAMP_FIELD,
40
43
  :desc => 'A field name of event timestamp in the Solr schema.xml (default event_timestamp).'
41
44
 
@@ -58,6 +61,7 @@ module Fluent
58
61
  @ignore_undefined_field = conf.has_key?('ignore_undefined_field') ? conf['ignore_undefined_field'] : DEFAULT_IGNORE_UNDEFINED_FIELDS
59
62
 
60
63
  @unique_key_field = conf['unique_key_field']
64
+ @tag_field = conf.has_key?('tag_field') ? conf['tag_field'] : DEFAULT_TAG_FIELD
61
65
  @timestamp_field = conf.has_key?('timestamp_field') ? conf['timestamp_field'] : DEFAULT_TIMESTAMP_FIELD
62
66
 
63
67
  @flush_size = conf.has_key?('flush_size') ? conf['flush_size'].to_i : DEFAULT_FLUSH_SIZE
@@ -104,12 +108,17 @@ module Fluent
104
108
  @unique_key = @unique_key_field.nil? ? get_unique_key : @unique_key_field
105
109
 
106
110
  chunk.msgpack_each do |tag, time, record|
107
-
108
111
  unless record.has_key?(@unique_key) then
109
112
  record.merge!({@unique_key => SecureRandom.uuid})
110
113
  end
111
114
 
112
- record.merge!({@timestamp_field => Time.at(time).utc.strftime('%FT%TZ')})
115
+ unless record.has_key?(@tag_field) then
116
+ record.merge!({@tag_field => tag})
117
+ end
118
+
119
+ unless record.has_key?(@timestamp_field) then
120
+ record.merge!({@timestamp_field => Time.at(time).utc.strftime('%FT%TZ')})
121
+ end
113
122
 
114
123
  if @ignore_undefined_fields then
115
124
  record.each_key do |key|
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.1
4
+ version: 0.2.2
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-12 00:00:00.000000000 Z
11
+ date: 2016-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd