fluent-plugin-output-solr 0.4.9 → 0.4.10

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: ef294b47232fadcb70f4fb7c0a76241be7876a3e
4
- data.tar.gz: 8f181b80cca4ef931af172eae0af62d5f949b9fe
3
+ metadata.gz: fb2ceab3cbbcea52fc45b798fcafc0101e0d0477
4
+ data.tar.gz: e68164616412a7a22e2dfd0a7c480b36cfbb9e33
5
5
  SHA512:
6
- metadata.gz: 18a6d6d41beece8a5c19b0448aad55fd915de89de9225a5577a747dc5c2e09eaba1decc623f44dc04b36e6a245d26f4393b800ef344a754323ac157f056532c0
7
- data.tar.gz: f32d2d636b045c2187d2c03052ee2caa963f3812a106507fdb79e0a32dfebfeef9b9fd2972a18ec9cc27a8f5f62f6e334cda56767b16d8ba31e3b5e8ef05e355
6
+ metadata.gz: 88eedfd9043ffc95485489c43e96a7bbda53149c56f62ba515b40fe66edc1fda5765cfa98f4466c50bc5316908c8cf133a6ba706d314a8fe5a631a662094d4d4
7
+ data.tar.gz: be00852de009eacfc458478a5a25c313ddf318750e050925136fac4325ecdde1a90d017cc806087ad98e77aa92b6269d67464d0668948401c71929c60a6ca1dd
data/README.md CHANGED
@@ -88,12 +88,28 @@ A string field value max length. If set -1, it means unlimited (default -1). How
88
88
  string_field_value_max_length -1
89
89
  ```
90
90
 
91
- ### timestamp_field
91
+ ### time_field
92
92
 
93
- A field name of event timestamp in the Solr schema.xml (default event_timestamp).
93
+ A field name of event timestamp in the Solr schema.xml (default time).
94
94
 
95
95
  ```
96
- timestamp_field event_timestamp
96
+ time_field time
97
+ ```
98
+
99
+ ### time_format
100
+
101
+ The format of the time field (default %FT%TZ).
102
+
103
+ ```
104
+ time_format %FT%TZ
105
+ ```
106
+
107
+ ### time_output_format
108
+
109
+ The format of the time field of Solr. (default %FT%TZ).
110
+
111
+ ```
112
+ time_output_format %FT%TZ
97
113
  ```
98
114
 
99
115
  ### flush_size
@@ -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.4.9"
7
+ spec.version = "0.4.10"
8
8
  spec.authors = ["Minoru Osuka"]
9
9
  spec.email = ["minoru.osuka@gmail.com"]
10
10
 
@@ -11,7 +11,9 @@ module Fluent
11
11
  DEFAULT_IGNORE_UNDEFINED_FIELDS = false
12
12
  DEFAULT_STRING_FIELD_VALUE_MAX_LENGTH = -1
13
13
  DEFAULT_TAG_FIELD = 'tag'
14
- DEFAULT_TIMESTAMP_FIELD = 'event_timestamp'
14
+ DEFAULT_TIME_FIELD = 'time'
15
+ DEFAULT_TIME_FORMAT = '%FT%TZ'
16
+ DEFAULT_TIME_OUTPUT_FORMAT = '%FT%TZ'
15
17
  DEFAULT_FLUSH_SIZE = 100
16
18
  DEFAULT_COMMIT_WITH_FLUSH = true
17
19
 
@@ -42,9 +44,13 @@ module Fluent
42
44
  config_param :unique_key_field, :string, :default => nil,
43
45
  :desc => 'A field name of unique key in the Solr schema.xml. If omitted, it will get unique key via Solr Schema API.'
44
46
  config_param :tag_field, :string, :default => DEFAULT_TAG_FIELD,
45
- :desc => 'A field name of fluentd tag in the Solr schema.xml (default event_timestamp).'
46
- config_param :timestamp_field, :string, :default => DEFAULT_TIMESTAMP_FIELD,
47
- :desc => 'A field name of event timestamp in the Solr schema.xml (default event_timestamp).'
47
+ :desc => 'A field name of fluentd tag in the Solr schema.xml (default tag).'
48
+ config_param :time_field, :string, :default => DEFAULT_TIME_FIELD,
49
+ :desc => 'A field name of event timestamp in the Solr schema.xml (default time).'
50
+ config_param :time_format, :string, :default => DEFAULT_TIME_FORMAT,
51
+ :desc => 'The format of the time field (default %d/%b/%Y:%H:%M:%S %z).'
52
+ config_param :time_output_format, :string, :default => DEFAULT_TIME_OUTPUT_FORMAT,
53
+ :desc => 'The format of the time field of Solr. (default %FT%TZ).'
48
54
 
49
55
  config_param :flush_size, :integer, :default => DEFAULT_FLUSH_SIZE,
50
56
  :desc => 'A number of events to queue up before writing to Solr (default 100).'
@@ -109,15 +115,15 @@ module Fluent
109
115
  record.merge!({@tag_field => tag})
110
116
  end
111
117
 
112
- if record.has_key?(@timestamp_field) then
118
+ if record.has_key?(@time_field) then
113
119
  begin
114
- event_timestamp_dt = DateTime.strptime(record[@timestamp_field], "%d/%b/%Y:%H:%M:%S %z").to_s
115
- record.merge!({@timestamp_field => Time.parse(event_timestamp_dt.to_s).utc.strftime('%FT%TZ')})
120
+ event_timestamp_dt = Time.strptime(record[@time_field], @time_format).to_s
121
+ record.merge!({@time_field => Time.parse(event_timestamp_dt.to_s).utc.strftime(@time_output_format)})
116
122
  rescue
117
- record.merge!({@timestamp_field => Time.at(time).utc.strftime('%FT%TZ')})
123
+ record.merge!({@time_field => Time.at(time).utc.strftime(@time_output_format)})
118
124
  end
119
125
  else
120
- record.merge!({@timestamp_field => Time.at(time).utc.strftime('%FT%TZ')})
126
+ record.merge!({@time_field => Time.at(time).utc.strftime(@time_output_format)})
121
127
  end
122
128
 
123
129
  if @ignore_undefined_fields then
@@ -152,6 +158,16 @@ module Fluent
152
158
  end
153
159
  end
154
160
 
161
+ #
162
+ # delete reserved fields
163
+ # https://cwiki.apache.org/confluence/display/solr/Defining+Fields
164
+ #
165
+ record.each_key do |key|
166
+ if key[0] == '_' and key[-1] == '_' then
167
+ record.delete(key)
168
+ end
169
+ end
170
+
155
171
  documents << record
156
172
 
157
173
  if documents.count >= @flush_size
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-output-solr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minoru Osuka