fluent-plugin-output-solr 0.4.10 → 0.4.11

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: fb2ceab3cbbcea52fc45b798fcafc0101e0d0477
4
- data.tar.gz: e68164616412a7a22e2dfd0a7c480b36cfbb9e33
3
+ metadata.gz: 6a4eb0134ff37a071cd0d2f146374558469fdf7f
4
+ data.tar.gz: d32077fbc8d29b01be5b38c84645da9fa7dbd945
5
5
  SHA512:
6
- metadata.gz: 88eedfd9043ffc95485489c43e96a7bbda53149c56f62ba515b40fe66edc1fda5765cfa98f4466c50bc5316908c8cf133a6ba706d314a8fe5a631a662094d4d4
7
- data.tar.gz: be00852de009eacfc458478a5a25c313ddf318750e050925136fac4325ecdde1a90d017cc806087ad98e77aa92b6269d67464d0668948401c71929c60a6ca1dd
6
+ metadata.gz: 279793165b6c132e99ded418e4453c37025f9c796caa11ee6b59775681edb1196f17ce1a53684da842067c6f086b45c393591673b6faadec9de87b42255e119b
7
+ data.tar.gz: fbc1c4378f4d85146133971a99f9aa85b2b6cfab25c6998abc58f98907e2e1b85bd7c26283563e1e18eee09d5cf153f69d7044a6996410583b353aab9dd161de
data/README.md CHANGED
@@ -104,12 +104,12 @@ The format of the time field (default %FT%TZ).
104
104
  time_format %FT%TZ
105
105
  ```
106
106
 
107
- ### time_output_format
107
+ ### millisecond
108
108
 
109
- The format of the time field of Solr. (default %FT%TZ).
109
+ Output millisecond to Solr (default false).
110
110
 
111
111
  ```
112
- time_output_format %FT%TZ
112
+ millisecond false
113
113
  ```
114
114
 
115
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.10"
7
+ spec.version = "0.4.11"
8
8
  spec.authors = ["Minoru Osuka"]
9
9
  spec.email = ["minoru.osuka@gmail.com"]
10
10
 
@@ -13,7 +13,7 @@ module Fluent
13
13
  DEFAULT_TAG_FIELD = 'tag'
14
14
  DEFAULT_TIME_FIELD = 'time'
15
15
  DEFAULT_TIME_FORMAT = '%FT%TZ'
16
- DEFAULT_TIME_OUTPUT_FORMAT = '%FT%TZ'
16
+ DEFAULT_MILLISECOND = false
17
17
  DEFAULT_FLUSH_SIZE = 100
18
18
  DEFAULT_COMMIT_WITH_FLUSH = true
19
19
 
@@ -49,8 +49,8 @@ module Fluent
49
49
  :desc => 'A field name of event timestamp in the Solr schema.xml (default time).'
50
50
  config_param :time_format, :string, :default => DEFAULT_TIME_FORMAT,
51
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).'
52
+ config_param :millisecond, :bool, :default => DEFAULT_MILLISECOND,
53
+ :desc => 'Output millisecond to Solr (default false).'
54
54
 
55
55
  config_param :flush_size, :integer, :default => DEFAULT_FLUSH_SIZE,
56
56
  :desc => 'A number of events to queue up before writing to Solr (default 100).'
@@ -117,13 +117,27 @@ module Fluent
117
117
 
118
118
  if record.has_key?(@time_field) then
119
119
  begin
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)})
120
+ tmp_time = Time.strptime(record[@time_field], @time_format)
121
+ if @millisecond then
122
+ record.merge!({@time_field => '%s.%03dZ' % [tmp_time.utc.strftime('%FT%T'), tmp_time.usec/ 1000.0]})
123
+ else
124
+ record.merge!({@time_field => tmp_time.utc.strftime('%FT%TZ')})
125
+ end
122
126
  rescue
123
- record.merge!({@time_field => Time.at(time).utc.strftime(@time_output_format)})
127
+ tmp_time = Time.at(time).utc
128
+ if @millisecond then
129
+ record.merge!({@time_field => '%s.%03dZ' % [tmp_time.utc.strftime('%FT%T'), tmp_time.usec/ 1000.0]})
130
+ else
131
+ record.merge!({@time_field => tmp_time.utc.strftime('%FT%TZ')})
132
+ end
124
133
  end
125
134
  else
126
- record.merge!({@time_field => Time.at(time).utc.strftime(@time_output_format)})
135
+ tmp_time = Time.at(time).utc
136
+ if @millisecond then
137
+ record.merge!({@time_field => '%s.%03dZ' % [tmp_time.utc.strftime('%FT%T'), tmp_time.usec/ 1000.0]})
138
+ else
139
+ record.merge!({@time_field => tmp_time.utc.strftime('%FT%TZ')})
140
+ end
127
141
  end
128
142
 
129
143
  if @ignore_undefined_fields then
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.10
4
+ version: 0.4.11
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-06-19 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd