fluentd 0.14.0 → 0.14.1

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.

Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/example/copy_roundrobin.conf +39 -0
  3. data/example/filter_stdout.conf +5 -5
  4. data/example/in_forward.conf +2 -2
  5. data/example/in_http.conf +2 -2
  6. data/example/in_syslog.conf +2 -2
  7. data/example/in_tail.conf +2 -2
  8. data/example/in_tcp.conf +2 -2
  9. data/example/in_udp.conf +2 -2
  10. data/example/out_buffered_null.conf +32 -0
  11. data/example/out_copy.conf +4 -4
  12. data/example/out_file.conf +2 -2
  13. data/example/out_forward.conf +2 -2
  14. data/example/v0_12_filter.conf +8 -8
  15. data/fluentd.gemspec +1 -1
  16. data/lib/fluent/command/fluentd.rb +6 -1
  17. data/lib/fluent/compat/handle_tag_name_mixin.rb +53 -0
  18. data/lib/fluent/compat/input.rb +1 -0
  19. data/lib/fluent/compat/output.rb +1 -0
  20. data/lib/fluent/compat/record_filter_mixin.rb +34 -0
  21. data/lib/fluent/compat/set_tag_key_mixin.rb +50 -0
  22. data/lib/fluent/compat/set_time_key_mixin.rb +69 -0
  23. data/lib/fluent/compat/type_converter.rb +90 -0
  24. data/lib/fluent/config/configure_proxy.rb +24 -4
  25. data/lib/fluent/config/dsl.rb +18 -1
  26. data/lib/fluent/config/v1_parser.rb +3 -2
  27. data/lib/fluent/configurable.rb +1 -1
  28. data/lib/fluent/event.rb +37 -9
  29. data/lib/fluent/mixin.rb +12 -286
  30. data/lib/fluent/plugin/buffer.rb +2 -2
  31. data/lib/fluent/plugin/in_dummy.rb +5 -1
  32. data/lib/fluent/plugin/in_gc_stat.rb +7 -37
  33. data/lib/fluent/plugin/in_http.rb +2 -0
  34. data/lib/fluent/plugin/{in_stream.rb → in_unix.rb} +0 -0
  35. data/lib/fluent/plugin/out_buffered_stdout.rb +60 -0
  36. data/lib/fluent/plugin/out_copy.rb +8 -51
  37. data/lib/fluent/plugin/out_null.rb +5 -5
  38. data/lib/fluent/plugin/out_relabel.rb +5 -5
  39. data/lib/fluent/plugin/out_roundrobin.rb +13 -40
  40. data/lib/fluent/plugin/output.rb +9 -0
  41. data/lib/fluent/plugin_helper.rb +2 -0
  42. data/lib/fluent/plugin_helper/formatter.rb +138 -0
  43. data/lib/fluent/plugin_helper/inject.rb +112 -0
  44. data/lib/fluent/plugin_helper/parser.rb +138 -0
  45. data/lib/fluent/plugin_helper/storage.rb +64 -50
  46. data/lib/fluent/process.rb +6 -1
  47. data/lib/fluent/registry.rb +1 -1
  48. data/lib/fluent/supervisor.rb +20 -2
  49. data/lib/fluent/test.rb +30 -5
  50. data/lib/fluent/test/base.rb +2 -66
  51. data/lib/fluent/test/driver/base.rb +3 -0
  52. data/lib/fluent/test/driver/base_owned.rb +106 -0
  53. data/lib/fluent/test/driver/formatter.rb +30 -0
  54. data/lib/fluent/test/driver/multi_output.rb +52 -0
  55. data/lib/fluent/test/driver/owner.rb +32 -0
  56. data/lib/fluent/test/driver/parser.rb +30 -0
  57. data/lib/fluent/test/helpers.rb +54 -0
  58. data/lib/fluent/test/log.rb +73 -0
  59. data/lib/fluent/time.rb +71 -0
  60. data/lib/fluent/version.rb +1 -1
  61. data/test/compat/test_parser.rb +82 -0
  62. data/test/config/test_configure_proxy.rb +15 -0
  63. data/test/config/test_dsl.rb +180 -2
  64. data/test/helper.rb +2 -24
  65. data/test/plugin/test_in_gc_stat.rb +6 -6
  66. data/test/plugin/test_in_http.rb +49 -32
  67. data/test/plugin/{test_in_stream.rb → test_in_unix.rb} +1 -1
  68. data/test/plugin/test_out_buffered_stdout.rb +108 -0
  69. data/test/plugin/test_out_copy.rb +88 -127
  70. data/test/plugin/test_out_null.rb +29 -0
  71. data/test/plugin/test_out_relabel.rb +28 -0
  72. data/test/plugin/test_out_roundrobin.rb +35 -29
  73. data/test/plugin/test_out_stdout.rb +4 -4
  74. data/test/plugin/test_output_as_buffered.rb +51 -0
  75. data/test/plugin/test_output_as_buffered_secondary.rb +13 -0
  76. data/test/plugin/test_parser_apache.rb +38 -0
  77. data/test/plugin/test_parser_apache2.rb +38 -0
  78. data/test/plugin/test_parser_apache_error.rb +40 -0
  79. data/test/plugin/test_parser_base.rb +32 -0
  80. data/test/plugin/test_parser_csv.rb +94 -0
  81. data/test/plugin/test_parser_json.rb +107 -0
  82. data/test/plugin/test_parser_labeled_tsv.rb +129 -0
  83. data/test/plugin/test_parser_multiline.rb +100 -0
  84. data/test/plugin/test_parser_nginx.rb +42 -0
  85. data/test/plugin/test_parser_none.rb +53 -0
  86. data/test/plugin/test_parser_regexp.rb +110 -0
  87. data/test/plugin/test_parser_syslog.rb +66 -0
  88. data/test/plugin/test_parser_time.rb +46 -0
  89. data/test/plugin/test_parser_tsv.rb +125 -0
  90. data/test/plugin_helper/test_child_process.rb +11 -2
  91. data/test/plugin_helper/test_formatter.rb +212 -0
  92. data/test/plugin_helper/test_inject.rb +388 -0
  93. data/test/plugin_helper/test_parser.rb +223 -0
  94. data/test/plugin_helper/test_retry_state.rb +40 -40
  95. data/test/plugin_helper/test_storage.rb +77 -10
  96. data/test/scripts/fluent/plugin/out_test.rb +22 -17
  97. data/test/scripts/fluent/plugin/out_test2.rb +80 -0
  98. data/test/test_event.rb +57 -0
  99. data/test/test_formatter.rb +0 -178
  100. data/test/test_output.rb +2 -152
  101. data/test/test_root_agent.rb +3 -2
  102. data/test/test_supervisor.rb +93 -26
  103. data/test/test_time_formatter.rb +186 -0
  104. metadata +69 -7
  105. data/test/test_parser.rb +0 -1087
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65c4b02fdf574383246339cf37f879344d1ab8b3
4
- data.tar.gz: 55cb7dc5dbbc1743dd24372eb227ff4460d05cd4
3
+ metadata.gz: 3eae91c70d2df47e3cd6aeb7b1e80d44fd8ee41b
4
+ data.tar.gz: 926661743f2177e7d116c1c7238d802b57fee63d
5
5
  SHA512:
6
- metadata.gz: 6a7f80a460e9578a196f8a125c459013cfea84a96e29ef1c341aedcbc1b0af2e70aedd0fc58d1335d6f364da7d3aa078e0da33d5539ca8d52070ace779589091
7
- data.tar.gz: 5fcb5d468553b2ca4a692a1ed0fe2e00fc0bc353c858cc505ee93975c9ce6fc9248cf12160262804bac3fb8a4cced363407567ebd147cb1f83c893097a2c3fcb
6
+ metadata.gz: 3584a4e41dc1188a43c0f5b75ea8505662bae178bdc796dd3a2cc8d28395000c18cb9b13c55cc34c113bf5d704c571634ba0ea1709325cc255e88da2a0150e74
7
+ data.tar.gz: 2f3836aea63fbaa48d761f2bce898f2925e130228c0c1b40e7115f2ccb0ce424aa7cd6200c0381b279f4358f3eef2e3d90e0f50ee0114441aaecc15250f1e2bd
@@ -0,0 +1,39 @@
1
+ <source>
2
+ @type dummy
3
+ @label @test
4
+ tag test.copy
5
+ auto_increment_key id
6
+ </source>
7
+
8
+ <source>
9
+ @type dummy
10
+ @label @test
11
+ tag test.rr
12
+ auto_increment_key id
13
+ </source>
14
+
15
+ <label @test>
16
+ <match test.copy>
17
+ @type copy
18
+ <store>
19
+ @type stdout
20
+ output_type json
21
+ </store>
22
+ <store>
23
+ @type stdout
24
+ output_type ltsv
25
+ </store>
26
+ </match>
27
+
28
+ <match test.rr>
29
+ @type roundrobin
30
+ <store>
31
+ @type stdout
32
+ output_type json
33
+ </store>
34
+ <store>
35
+ @type stdout
36
+ output_type ltsv
37
+ </store>
38
+ </match>
39
+ </label>
@@ -1,22 +1,22 @@
1
1
  <source>
2
- type dummy
2
+ @type dummy
3
3
  tag dummy
4
4
  </source>
5
5
 
6
6
  <filter **>
7
- type stdout
7
+ @type stdout
8
8
  </filter>
9
9
 
10
10
  <filter **>
11
- type stdout
11
+ @type stdout
12
12
  output_type hash
13
13
  </filter>
14
14
 
15
15
  <filter **>
16
- type stdout
16
+ @type stdout
17
17
  format ltsv
18
18
  </filter>
19
19
 
20
20
  <match **>
21
- type null
21
+ @type null
22
22
  </match>
@@ -1,7 +1,7 @@
1
1
  <source>
2
- type forward
2
+ @type forward
3
3
  </source>
4
4
 
5
5
  <match test>
6
- type stdout
6
+ @type stdout
7
7
  </match>
@@ -1,5 +1,5 @@
1
1
  <source>
2
- type http
2
+ @type http
3
3
  bind 0.0.0.0
4
4
  port 9880
5
5
  body_size_limit 32MB
@@ -10,5 +10,5 @@
10
10
  </source>
11
11
 
12
12
  <match test>
13
- type stdout
13
+ @type stdout
14
14
  </match>
@@ -1,5 +1,5 @@
1
1
  <source>
2
- type syslog
2
+ @type syslog
3
3
  bind 0.0.0.0
4
4
  port 5140
5
5
  tag test
@@ -11,5 +11,5 @@
11
11
  </source>
12
12
 
13
13
  <match test>
14
- type stdout
14
+ @type stdout
15
15
  </match>
@@ -1,5 +1,5 @@
1
1
  <source>
2
- type tail
2
+ @type tail
3
3
  format none
4
4
  path /var/log/fluentd_test.log
5
5
  pos_file /var/log/fluentd_test.pos
@@ -10,5 +10,5 @@
10
10
  </source>
11
11
 
12
12
  <match test>
13
- type stdout
13
+ @type stdout
14
14
  </match>
@@ -1,5 +1,5 @@
1
1
  <source>
2
- type tcp
2
+ @type tcp
3
3
  format none
4
4
  bind 0.0.0.0
5
5
  port 5170
@@ -9,5 +9,5 @@
9
9
  </source>
10
10
 
11
11
  <match test>
12
- type stdout
12
+ @type stdout
13
13
  </match>
@@ -1,5 +1,5 @@
1
1
  <source>
2
- type udp
2
+ @type udp
3
3
  format none
4
4
  bind 0.0.0.0
5
5
  port 5160
@@ -9,5 +9,5 @@
9
9
  </source>
10
10
 
11
11
  <match test>
12
- type stdout
12
+ @type stdout
13
13
  </match>
@@ -0,0 +1,32 @@
1
+ #
2
+ # bundle exec bin/fluentd -c example/out_buffered_null.conf
3
+ # (+ --emit-error-log-interval 10)
4
+ <source>
5
+ @type dummy
6
+ tag dummy
7
+ rate 500000000
8
+ dummy [
9
+ {"message": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
10
+ {"message": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"},
11
+ {"message": "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"}
12
+ ]
13
+ </source>
14
+
15
+ <match dummy.**>
16
+ @type buffered_null
17
+ try_flush_interval 60
18
+ flush_interval 60
19
+ buffer_chunk_limit 1k
20
+ buffer_queue_limit 2
21
+ </match>
22
+
23
+ <label error_log>
24
+ <match **>
25
+ @type stdout # or buffered_stdout
26
+ </match>
27
+ </label>
28
+
29
+ <match fluent.**>
30
+ @type relabel
31
+ @label error_log
32
+ </match>
@@ -1,15 +1,15 @@
1
1
  <source>
2
- type forward
2
+ @type forward
3
3
  </source>
4
4
 
5
5
  <match test>
6
- type copy
6
+ @type copy
7
7
  deep_copy false
8
8
  <store>
9
- type stdout
9
+ @type stdout
10
10
  </store>
11
11
  <store>
12
- type file
12
+ @type file
13
13
  path /var/log/fluentd/out_file_test
14
14
  format json
15
15
  buffer_type memory
@@ -1,9 +1,9 @@
1
1
  <source>
2
- type forward
2
+ @type forward
3
3
  </source>
4
4
 
5
5
  <match test>
6
- type file
6
+ @type file
7
7
  path /var/log/fluentd/out_file_test
8
8
  format json
9
9
  buffer_type memory
@@ -1,10 +1,10 @@
1
1
  <source>
2
- type dummy
2
+ @type dummy
3
3
  tag test
4
4
  </source>
5
5
 
6
6
  <match test>
7
- type forward
7
+ @type forward
8
8
 
9
9
  <server>
10
10
  # first server
@@ -9,7 +9,7 @@
9
9
  # $ echo '{"message":"hello world"}' | fluent-cat foo
10
10
 
11
11
  <source>
12
- type forward
12
+ @type forward
13
13
  port 24224
14
14
  </source>
15
15
 
@@ -21,13 +21,13 @@
21
21
  # - {"messag22":"keep this please"} is filtered out.
22
22
 
23
23
  <filter foo>
24
- type grep
24
+ @type grep
25
25
  regexp1 message keep this
26
26
  </filter>
27
27
 
28
28
  # Matches the events that was kept by the above filter
29
29
  <match foo>
30
- type stdout
30
+ @type stdout
31
31
  </match>
32
32
 
33
33
  # For all events with the tag "bar", add the machine's hostname with
@@ -35,7 +35,7 @@
35
35
  # at 123.4.2.4:24224.
36
36
 
37
37
  <filter bar>
38
- type record_transformer
38
+ @type record_transformer
39
39
  <record>
40
40
  hostname ${hostname}
41
41
  </record>
@@ -44,7 +44,7 @@
44
44
  # By the time it is getting matched here, the event has
45
45
  # the "hostname" field.
46
46
  <match bar>
47
- type forward
47
+ @type forward
48
48
  <server>
49
49
  host 123.4.2.4
50
50
  port 24225
@@ -61,12 +61,12 @@
61
61
  # - {"last_name":"FURUHASHI"} throws an error because it has no field called "name"
62
62
 
63
63
  <filter foo.bar>
64
- type grep
64
+ @type grep
65
65
  exclude1 hello .
66
66
  </filter>
67
67
 
68
68
  <filter foo.bar>
69
- type record_transformer
69
+ @type record_transformer
70
70
  enable_ruby true
71
71
  <record>
72
72
  name ${name.downcase}
@@ -74,5 +74,5 @@
74
74
  </filter>
75
75
 
76
76
  <match foo.bar>
77
- type stdout
77
+ @type stdout
78
78
  </match>
@@ -32,7 +32,7 @@ Gem::Specification.new do |gem|
32
32
  gem.add_runtime_dependency("win32-service", ["~> 0.8.3"])
33
33
  gem.add_runtime_dependency("win32-ipc", ["~> 0.6.1"])
34
34
  gem.add_runtime_dependency("win32-event", ["~> 0.6.1"])
35
- gem.add_runtime_dependency("windows-pr", ["~> 1.2.3"])
35
+ gem.add_runtime_dependency("windows-pr", ["~> 1.2.5"])
36
36
  end
37
37
  gem.add_runtime_dependency("strptime", [">= 0.1.7"])
38
38
 
@@ -60,10 +60,15 @@ op.on('-d', '--daemon PIDFILE', "daemonize fluent process") {|s|
60
60
  opts[:daemonize] = s
61
61
  }
62
62
 
63
- op.on('--no-supervisor', "run without fluent supervisor") {
63
+ op.on('--under-supervisor', "run fluent worker under supervisor (this option is NOT for users)") {
64
64
  opts[:supervise] = false
65
65
  }
66
66
 
67
+ op.on('--no-supervisor', "run fluent worker without supervisor") {
68
+ opts[:supervise] = false
69
+ opts[:standalone_worker] = true
70
+ }
71
+
67
72
  op.on('--user USER', "change user") {|s|
68
73
  opts[:chuser] = s
69
74
  }
@@ -0,0 +1,53 @@
1
+ #
2
+ # Fluentd
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'fluent/compat/record_filter_mixin'
18
+
19
+ module Fluent
20
+ module Compat
21
+ module HandleTagNameMixin
22
+ include RecordFilterMixin
23
+
24
+ attr_accessor :remove_tag_prefix, :remove_tag_suffix, :add_tag_prefix, :add_tag_suffix
25
+ def configure(conf)
26
+ super
27
+
28
+ @remove_tag_prefix = if conf.has_key?('remove_tag_prefix')
29
+ Regexp.new('^' + Regexp.escape(conf['remove_tag_prefix']))
30
+ else
31
+ nil
32
+ end
33
+
34
+ @remove_tag_suffix = if conf.has_key?('remove_tag_suffix')
35
+ Regexp.new(Regexp.escape(conf['remove_tag_suffix']) + '$')
36
+ else
37
+ nil
38
+ end
39
+
40
+ @add_tag_prefix = conf['add_tag_prefix']
41
+ @add_tag_suffix = conf['add_tag_suffix']
42
+ end
43
+
44
+ def filter_record(tag, time, record)
45
+ tag.sub!(@remove_tag_prefix, '') if @remove_tag_prefix
46
+ tag.sub!(@remove_tag_suffix, '') if @remove_tag_suffix
47
+ tag.insert(0, @add_tag_prefix) if @add_tag_prefix
48
+ tag << @add_tag_suffix if @add_tag_suffix
49
+ super(tag, time, record)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -17,6 +17,7 @@
17
17
  require 'fluent/plugin'
18
18
  require 'fluent/plugin/input'
19
19
  require 'fluent/compat/call_super_mixin'
20
+ require 'fluent/process' # to load Fluent::DetachProcessMixin
20
21
 
21
22
  module Fluent
22
23
  module Compat
@@ -22,6 +22,7 @@ require 'fluent/compat/propagate_default'
22
22
  require 'fluent/compat/output_chain'
23
23
  require 'fluent/timezone'
24
24
  require 'fluent/mixin'
25
+ require 'fluent/process' # to load Fluent::DetachProcessMixin
25
26
 
26
27
  require 'fluent/plugin_helper/compat_parameters'
27
28
 
@@ -0,0 +1,34 @@
1
+ #
2
+ # Fluentd
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ module Fluent
18
+ module Compat
19
+ module RecordFilterMixin
20
+ def filter_record(tag, time, record)
21
+ end
22
+
23
+ def format_stream(tag, es)
24
+ out = ''
25
+ es.each {|time,record|
26
+ tag_temp = tag.dup
27
+ filter_record(tag_temp, time, record)
28
+ out << format(tag_temp, time, record)
29
+ }
30
+ out
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,50 @@
1
+ #
2
+ # Fluentd
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'fluent/config/error'
18
+ require 'fluent/config/types'
19
+ require 'fluent/compat/record_filter_mixin'
20
+
21
+ module Fluent
22
+ module Compat
23
+ module SetTagKeyMixin
24
+ include RecordFilterMixin
25
+
26
+ attr_accessor :include_tag_key, :tag_key
27
+
28
+ def configure(conf)
29
+ @include_tag_key = false
30
+
31
+ super
32
+
33
+ if s = conf['include_tag_key']
34
+ include_tag_key = Fluent::Config.bool_value(s)
35
+ raise Fluent::ConfigError, "Invalid boolean expression '#{s}' for include_tag_key parameter" if include_tag_key.nil?
36
+
37
+ @include_tag_key = include_tag_key
38
+ end
39
+
40
+ @tag_key = conf['tag_key'] || 'tag' if @include_tag_key
41
+ end
42
+
43
+ def filter_record(tag, time, record)
44
+ super
45
+
46
+ record[@tag_key] = tag if @include_tag_key
47
+ end
48
+ end
49
+ end
50
+ end