fluentd 0.10.21 → 0.10.22

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

data/ChangeLog CHANGED
@@ -1,4 +1,13 @@
1
1
 
2
+ Release 0.10.22 - 2012/05/02
3
+
4
+ * Fixed in_tail and TextParser not to raise "time_format is required" error
5
+ * out_exec_filter: fixed JSONFormatter to add \n at the end of records
6
+ * out_exec_filter: separated {tag_key,time_key,time_format} parameters to
7
+ {in_,out_}{tag_key,time_key,time_format parameters while keeping
8
+ compatibility
9
+
10
+
2
11
  Release 0.10.21 - 2012/05/01
3
12
 
4
13
  * in_tail and TextParser support 'format json'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.21
1
+ 0.10.22
@@ -22,7 +22,7 @@ class TextParser
22
22
  class RegexpParser
23
23
  include Configurable
24
24
 
25
- config_param :time_format, :string
25
+ config_param :time_format, :string, :default => nil
26
26
 
27
27
  def initialize(regexp, conf={})
28
28
  super()
@@ -44,6 +44,9 @@ class ExecFilterOutput < BufferedOutput
44
44
  config_param :in_keys, :default => [] do |val|
45
45
  val.split(',')
46
46
  end
47
+ config_param :in_tag_key, :default => nil
48
+ config_param :in_time_key, :default => nil
49
+ config_param :in_time_format, :default => nil
47
50
 
48
51
  config_param :out_format, :default => :tsv do |val|
49
52
  f = SUPPORTED_FORMAT[val]
@@ -53,9 +56,11 @@ class ExecFilterOutput < BufferedOutput
53
56
  config_param :out_keys, :default => [] do |val| # for tsv format
54
57
  val.split(',')
55
58
  end
59
+ config_param :out_tag_key, :default => nil
60
+ config_param :out_time_key, :default => nil
61
+ config_param :out_time_format, :default => nil
56
62
 
57
63
  config_param :tag, :string, :default => nil
58
- config_param :tag_key, :string, :default => nil
59
64
 
60
65
  config_param :time_key, :string, :default => nil
61
66
  config_param :time_format, :string, :default => nil
@@ -66,6 +71,24 @@ class ExecFilterOutput < BufferedOutput
66
71
  config_set_default :flush_interval, 1
67
72
 
68
73
  def configure(conf)
74
+ if tag_key = conf['tag_key']
75
+ # TODO obsoleted?
76
+ @in_tag_key = tag_key
77
+ @out_tag_key = tag_key
78
+ end
79
+
80
+ if time_key = conf['time_key']
81
+ # TODO obsoleted?
82
+ @in_time_key = time_key
83
+ @out_time_key = time_key
84
+ end
85
+
86
+ if time_format = conf['time_format']
87
+ # TODO obsoleted?
88
+ @in_time_format = time_format
89
+ @out_time_format = time_format
90
+ end
91
+
69
92
  super
70
93
 
71
94
  if localtime = conf['localtime']
@@ -74,20 +97,29 @@ class ExecFilterOutput < BufferedOutput
74
97
  @localtime = false
75
98
  end
76
99
 
77
- if !@tag && !@tag_key
78
- raise ConfigError, "'tag' or 'tag_key' option is required on exec_filter output"
100
+ if !@tag && !@out_tag_key
101
+ raise ConfigError, "'tag' or 'out_tag_key' option is required on exec_filter output"
79
102
  end
80
103
 
81
- if @time_key
82
- if @time_format
83
- f = @time_format
104
+ if @in_time_key
105
+ if f = @in_time_format
84
106
  tf = TimeFormatter.new(f, @localtime)
85
107
  @time_format_proc = tf.method(:format)
86
- @time_parse_proc = Proc.new {|str| Time.strptime(str, f).to_i }
87
108
  else
88
109
  @time_format_proc = Proc.new {|time| time.to_s }
110
+ end
111
+ elsif @in_time_format
112
+ $log.warn "in_time_format effects nothing when in_time_key is not specified: #{conf}"
113
+ end
114
+
115
+ if @out_time_key
116
+ if f = @out_time_format
117
+ @time_parse_proc = Proc.new {|str| Time.strptime(str, f).to_i }
118
+ else
89
119
  @time_parse_proc = Proc.new {|str| str.to_i }
90
120
  end
121
+ elsif @out_time_format
122
+ $log.warn "out_time_format effects nothing when out_time_key is not specified: #{conf}"
91
123
  end
92
124
 
93
125
  if @remove_prefix
@@ -164,11 +196,11 @@ class ExecFilterOutput < BufferedOutput
164
196
  out = ''
165
197
 
166
198
  es.each {|time,record|
167
- if @time_key
168
- record[@time_key] = @time_format_proc.call(time)
199
+ if @in_time_key
200
+ record[@in_time_key] = @time_format_proc.call(time)
169
201
  end
170
- if @tag_key
171
- record[@tag_key] = tag
202
+ if @in_tag_key
203
+ record[@in_tag_key] = tag
172
204
  end
173
205
  @formatter.call(record, out)
174
206
  }
@@ -256,7 +288,7 @@ class ExecFilterOutput < BufferedOutput
256
288
 
257
289
  class JSONFormatter < Formatter
258
290
  def call(record, out)
259
- out << Yajl.dump(record)
291
+ out << Yajl.dump(record) << "\n"
260
292
  end
261
293
  end
262
294
 
@@ -267,13 +299,13 @@ class ExecFilterOutput < BufferedOutput
267
299
  end
268
300
 
269
301
  def on_message(record)
270
- if val = record.delete(@time_key)
302
+ if val = record.delete(@out_time_key)
271
303
  time = @time_parse_proc.call(val)
272
304
  else
273
305
  time = Engine.now
274
306
  end
275
307
 
276
- if val = record.delete(@tag_key)
308
+ if val = record.delete(@out_tag_key)
277
309
  tag = if @add_prefix
278
310
  @added_prefix_string + val
279
311
  else
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
 
3
- VERSION = '0.10.21'
3
+ VERSION = '0.10.22'
4
4
 
5
5
  end
@@ -8,10 +8,11 @@ class ExecFilterOutputTest < Test::Unit::TestCase
8
8
 
9
9
  CONFIG = %[
10
10
  command cat
11
- in_keys time,tag,k1
12
- out_keys time,tag,k2
11
+ in_keys time_in,tag,k1
12
+ out_keys time_out,tag,k2
13
13
  tag_key tag
14
- time_key time
14
+ in_time_key time_in
15
+ out_time_key time_out
15
16
  time_format %Y-%m-%d %H:%M:%S
16
17
  localtime
17
18
  num_children 3
@@ -24,11 +25,14 @@ class ExecFilterOutputTest < Test::Unit::TestCase
24
25
  def test_configure
25
26
  d = create_driver
26
27
 
27
- assert_equal ["time","tag","k1"], d.instance.in_keys
28
- assert_equal ["time","tag","k2"], d.instance.out_keys
29
- assert_equal "tag", d.instance.tag_key
30
- assert_equal "time", d.instance.time_key
31
- assert_equal "%Y-%m-%d %H:%M:%S", d.instance.time_format
28
+ assert_equal ["time_in","tag","k1"], d.instance.in_keys
29
+ assert_equal ["time_out","tag","k2"], d.instance.out_keys
30
+ assert_equal "tag", d.instance.out_tag_key
31
+ assert_equal "tag", d.instance.in_tag_key
32
+ assert_equal "time_in", d.instance.in_time_key
33
+ assert_equal "time_out", d.instance.out_time_key
34
+ assert_equal "%Y-%m-%d %H:%M:%S", d.instance.in_time_format
35
+ assert_equal "%Y-%m-%d %H:%M:%S", d.instance.out_time_format
32
36
  assert_equal true, d.instance.localtime
33
37
  assert_equal 3, d.instance.num_children
34
38
 
@@ -14,12 +14,6 @@ class StdoutOutputTest < Test::Unit::TestCase
14
14
 
15
15
  def test_configure
16
16
  d = create_driver
17
- assert (not d.instance.autoflush)
18
-
19
- d = create_driver %[
20
- autoflush true
21
- ]
22
- assert d.instance.autoflush
23
17
  end
24
18
 
25
19
  # def test_emit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.21
4
+ version: 0.10.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000Z
12
+ date: 2012-05-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
16
- requirement: &70301065884780 !ruby/object:Gem::Requirement
16
+ requirement: &70252881832620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70301065884780
24
+ version_requirements: *70252881832620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70301065884240 !ruby/object:Gem::Requirement
27
+ requirement: &70252881832140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.4.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70301065884240
35
+ version_requirements: *70252881832140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yajl-ruby
38
- requirement: &70301065883720 !ruby/object:Gem::Requirement
38
+ requirement: &70252881831560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70301065883720
46
+ version_requirements: *70252881831560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cool.io
49
- requirement: &70301065883120 !ruby/object:Gem::Requirement
49
+ requirement: &70252881831080 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.1.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70301065883120
57
+ version_requirements: *70252881831080
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: http_parser.rb
60
- requirement: &70301065880180 !ruby/object:Gem::Requirement
60
+ requirement: &70252881830600 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.5.1
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70301065880180
68
+ version_requirements: *70252881830600
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &70301065879580 !ruby/object:Gem::Requirement
71
+ requirement: &70252881830080 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.9.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70301065879580
79
+ version_requirements: *70252881830080
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rr
82
- requirement: &70301065878920 !ruby/object:Gem::Requirement
82
+ requirement: &70252881829500 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.0.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70301065878920
90
+ version_requirements: *70252881829500
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: timecop
93
- requirement: &70301065878300 !ruby/object:Gem::Requirement
93
+ requirement: &70252881828920 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.3.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70301065878300
101
+ version_requirements: *70252881828920
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: jeweler
104
- requirement: &70301065877720 !ruby/object:Gem::Requirement
104
+ requirement: &70252881828380 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 1.0.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70301065877720
112
+ version_requirements: *70252881828380
113
113
  description:
114
114
  email: frsyuki@gmail.com
115
115
  executables: