fluentd 0.12.20 → 0.12.21

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 (92) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +23 -0
  3. data/Rakefile +2 -2
  4. data/bin/fluent-debug +0 -1
  5. data/lib/fluent/agent.rb +12 -9
  6. data/lib/fluent/buffer.rb +9 -3
  7. data/lib/fluent/command/bundler_injection.rb +2 -0
  8. data/lib/fluent/command/cat.rb +1 -1
  9. data/lib/fluent/command/debug.rb +3 -2
  10. data/lib/fluent/command/fluentd.rb +3 -1
  11. data/lib/fluent/config.rb +4 -5
  12. data/lib/fluent/config/basic_parser.rb +3 -4
  13. data/lib/fluent/config/configure_proxy.rb +2 -0
  14. data/lib/fluent/config/dsl.rb +3 -0
  15. data/lib/fluent/config/element.rb +3 -2
  16. data/lib/fluent/config/literal_parser.rb +8 -5
  17. data/lib/fluent/config/parser.rb +5 -3
  18. data/lib/fluent/config/section.rb +3 -3
  19. data/lib/fluent/config/types.rb +44 -50
  20. data/lib/fluent/config/v1_parser.rb +8 -6
  21. data/lib/fluent/configurable.rb +8 -6
  22. data/lib/fluent/engine.rb +23 -11
  23. data/lib/fluent/event.rb +2 -0
  24. data/lib/fluent/event_router.rb +4 -2
  25. data/lib/fluent/filter.rb +6 -0
  26. data/lib/fluent/formatter.rb +27 -25
  27. data/lib/fluent/input.rb +5 -0
  28. data/lib/fluent/label.rb +2 -2
  29. data/lib/fluent/log.rb +5 -2
  30. data/lib/fluent/mixin.rb +4 -2
  31. data/lib/fluent/output.rb +45 -31
  32. data/lib/fluent/parser.rb +35 -25
  33. data/lib/fluent/plugin.rb +4 -0
  34. data/lib/fluent/plugin/buf_file.rb +9 -2
  35. data/lib/fluent/plugin/buf_memory.rb +7 -1
  36. data/lib/fluent/plugin/exec_util.rb +7 -2
  37. data/lib/fluent/plugin/filter_grep.rb +6 -3
  38. data/lib/fluent/plugin/filter_record_transformer.rb +52 -51
  39. data/lib/fluent/plugin/filter_stdout.rb +4 -1
  40. data/lib/fluent/plugin/in_debug_agent.rb +7 -5
  41. data/lib/fluent/plugin/in_dummy.rb +8 -3
  42. data/lib/fluent/plugin/in_exec.rb +16 -10
  43. data/lib/fluent/plugin/in_forward.rb +18 -11
  44. data/lib/fluent/plugin/in_gc_stat.rb +6 -2
  45. data/lib/fluent/plugin/in_http.rb +23 -14
  46. data/lib/fluent/plugin/in_monitor_agent.rb +24 -17
  47. data/lib/fluent/plugin/in_object_space.rb +9 -4
  48. data/lib/fluent/plugin/in_stream.rb +15 -6
  49. data/lib/fluent/plugin/in_syslog.rb +18 -12
  50. data/lib/fluent/plugin/in_tail.rb +61 -40
  51. data/lib/fluent/plugin/in_tcp.rb +3 -1
  52. data/lib/fluent/plugin/in_udp.rb +1 -1
  53. data/lib/fluent/plugin/out_copy.rb +5 -1
  54. data/lib/fluent/plugin/out_exec.rb +9 -6
  55. data/lib/fluent/plugin/out_exec_filter.rb +32 -25
  56. data/lib/fluent/plugin/out_file.rb +11 -5
  57. data/lib/fluent/plugin/out_forward.rb +30 -24
  58. data/lib/fluent/plugin/out_null.rb +2 -0
  59. data/lib/fluent/plugin/out_relabel.rb +2 -0
  60. data/lib/fluent/plugin/out_roundrobin.rb +3 -0
  61. data/lib/fluent/plugin/out_stdout.rb +3 -1
  62. data/lib/fluent/plugin/out_stream.rb +8 -8
  63. data/lib/fluent/plugin/socket_util.rb +12 -10
  64. data/lib/fluent/process.rb +14 -8
  65. data/lib/fluent/registry.rb +2 -2
  66. data/lib/fluent/root_agent.rb +16 -12
  67. data/lib/fluent/rpc.rb +7 -7
  68. data/lib/fluent/supervisor.rb +35 -69
  69. data/lib/fluent/system_config.rb +98 -0
  70. data/lib/fluent/test.rb +1 -1
  71. data/lib/fluent/test/base.rb +6 -1
  72. data/lib/fluent/test/filter_test.rb +4 -0
  73. data/lib/fluent/test/formatter_test.rb +3 -2
  74. data/lib/fluent/test/input_test.rb +6 -0
  75. data/lib/fluent/test/output_test.rb +4 -0
  76. data/lib/fluent/test/parser_test.rb +3 -2
  77. data/lib/fluent/timezone.rb +2 -0
  78. data/lib/fluent/version.rb +1 -1
  79. data/test/config/test_configurable.rb +11 -11
  80. data/test/config/test_configure_proxy.rb +1 -1
  81. data/test/config/test_system_config.rb +5 -5
  82. data/test/config/test_types.rb +70 -0
  83. data/test/plugin/test_filter_record_transformer.rb +72 -55
  84. data/test/plugin/test_in_forward.rb +4 -0
  85. data/test/plugin/test_in_tail.rb +73 -2
  86. data/test/test_config.rb +2 -2
  87. data/test/test_event_router.rb +1 -0
  88. data/test/test_output.rb +27 -3
  89. data/test/test_plugin_classes.rb +3 -0
  90. data/test/test_process.rb +1 -0
  91. data/test/test_root_agent.rb +5 -3
  92. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4968b695bb1d272edf951c51e3abb784431bc722
4
- data.tar.gz: 69f6d6745d9d9a09201477c9f8f84e92734b03eb
3
+ metadata.gz: f3ebfc83b5cad8bcf24df4510ce05851525b2e9c
4
+ data.tar.gz: 2de7357213f35b47353654ac302bb0aad0e79a9d
5
5
  SHA512:
6
- metadata.gz: 26de5771b3a3c686cdfc868d633bee44bc4748713327e57cfe51da3d6a2ba4e5cae28d6bc8b03e0b4419241dc60032bf653b750c8c31b11b48adf3058773fd04
7
- data.tar.gz: 65245255419ef81be6697494aa4b2264011d7cbf2e89a2d3c6f7f3a767db68c2caa05c7ae267e9bce1988406e684a9f60e162706d841890c547b5ca40c417757
6
+ metadata.gz: 1b9a9ec67e34cc1f98064684ea4eefb71a841e825fdee02e3f2f24f74e056810afb768f45fef6c2e1797b56c008665d55074e809611406856571ac768c08fd9f
7
+ data.tar.gz: 81b7d05a4420c89e81d0f3df0bae67e520f03e272f589fdb67e4902b5c4feffae26a7c0e5ccb2400141bc589fe199bc0642fd46e4e7c901c15bb48ca9e260962
data/ChangeLog CHANGED
@@ -1,5 +1,28 @@
1
1
  # v0.12
2
2
 
3
+ ## Release 0.12.21 - 2015/03/03
4
+
5
+ ### New features / Enhancement
6
+
7
+ * output: Use error stream in TimeSlicedOutput#emit
8
+ https://github.com/fluent/fluentd/pull/791
9
+ * in_tail: Avoid unnecessary open call
10
+ https://github.com/fluent/fluentd/pull/788
11
+ * in_tail: Add enable_watch_timer option
12
+ https://github.com/fluent/fluentd/pull/811
13
+ * filter_record_transformer: Relax conditions which auto_typecast is applied when enable_ruby yes
14
+ https://github.com/fluent/fluentd/pull/817
15
+ * Backport v0.14 refactoring changes
16
+
17
+ ### Bug fixes
18
+
19
+ * in_tail: Fix input messages loss when receive_lines fail with BufferQueueLimitError
20
+ https://github.com/fluent/fluentd/pull/810
21
+ * in_monitor_agent: Remove unnecessary fields from API response with debug mode
22
+ https://github.com/fluent/fluentd/pull/802
23
+ * filter_record_transformer: Fix record_transformer to be thread-safe
24
+ https://github.com/fluent/fluentd/pull/816
25
+
3
26
  ## Release 0.12.20 - 2015/01/26
4
27
 
5
28
  ### New features / Enhancement
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
  require 'rake/testtask'
6
6
  require 'rake/clean'
7
7
 
8
- task :test => [:base_test]
8
+ task test: [:base_test]
9
9
 
10
10
  desc 'Run test_unit based test'
11
11
  Rake::TestTask.new(:base_test) do |t|
@@ -30,4 +30,4 @@ task :coverage do |t|
30
30
  Rake::Task["test"].invoke
31
31
  end
32
32
 
33
- task :default => [:test, :build]
33
+ task default: [:test, :build]
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require 'rubygems' unless defined?(gem)
4
3
  here = File.dirname(__FILE__)
5
4
  $LOAD_PATH << File.expand_path(File.join(here, '..', 'lib'))
6
5
  require 'fluent/command/debug'
@@ -13,10 +13,13 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- module Fluent
17
- require 'fluent/configurable'
18
- require 'fluent/engine'
19
16
 
17
+ require 'fluent/configurable'
18
+ require 'fluent/engine'
19
+ require 'fluent/plugin'
20
+ require 'fluent/output'
21
+
22
+ module Fluent
20
23
  #
21
24
  # Agent is a resource unit who manages emittable plugins
22
25
  #
@@ -81,7 +84,7 @@ module Fluent
81
84
  log.info "shutting down filter#{@context.nil? ? '' : " in #{@context}"}", type: Plugin.lookup_name_from_class(f.class), plugin_id: f.plugin_id
82
85
  f.shutdown
83
86
  rescue => e
84
- log.warn "unexpected error while shutting down filter plugins", :plugin => f.class, :plugin_id => f.plugin_id, :error_class => e.class, :error => e
87
+ log.warn "unexpected error while shutting down filter plugins", plugin: f.class, plugin_id: f.plugin_id, error_class: e.class, error: e
85
88
  log.warn_backtrace
86
89
  end
87
90
  end
@@ -95,7 +98,7 @@ module Fluent
95
98
  log.info "shutting down output#{@context.nil? ? '' : " in #{@context}"}", type: Plugin.lookup_name_from_class(o.class), plugin_id: o.plugin_id
96
99
  o.shutdown
97
100
  rescue => e
98
- log.warn "unexpected error while shutting down output plugins", :plugin => o.class, :plugin_id => o.plugin_id, :error_class => e.class, :error => e
101
+ log.warn "unexpected error while shutting down output plugins", plugin: o.class, plugin_id: o.plugin_id, error_class: e.class, error: e
99
102
  log.warn_backtrace
100
103
  end
101
104
  end
@@ -115,7 +118,7 @@ module Fluent
115
118
  flush_recursive(o.outputs)
116
119
  end
117
120
  rescue => e
118
- log.debug "error while force flushing", :error_class => e.class, :error => e
121
+ log.debug "error while force flushing", error_class: e.class, error: e
119
122
  log.debug_backtrace
120
123
  end
121
124
  }
@@ -163,16 +166,16 @@ module Fluent
163
166
  c = (@count += 1)
164
167
  if c < 512
165
168
  if Math.log(c) / Math.log(2) % 1.0 == 0
166
- @log.warn "no patterns matched", :tag => tag
169
+ @log.warn "no patterns matched", tag: tag
167
170
  return
168
171
  end
169
172
  else
170
173
  if c % 512 == 0
171
- @log.warn "no patterns matched", :tag => tag
174
+ @log.warn "no patterns matched", tag: tag
172
175
  return
173
176
  end
174
177
  end
175
- @log.on_trace { @log.trace "no patterns matched", :tag => tag }
178
+ @log.on_trace { @log.trace "no patterns matched", tag: tag }
176
179
  end
177
180
 
178
181
  def start
@@ -13,6 +13,12 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
+
17
+ require 'monitor'
18
+ require 'fileutils'
19
+
20
+ require 'fluent/configurable'
21
+
16
22
  module Fluent
17
23
  class BufferError < StandardError
18
24
  end
@@ -140,11 +146,11 @@ module Fluent
140
146
  # Local file based plugins which should provide more reliability and efficiency
141
147
  # should override buffer_chunk_limit with a larger size.
142
148
  desc 'The size of each buffer chunk.'
143
- config_param :buffer_chunk_limit, :size, :default => 8*1024*1024
149
+ config_param :buffer_chunk_limit, :size, default: 8*1024*1024
144
150
  desc 'The length limit of the chunk queue.'
145
- config_param :buffer_queue_limit, :integer, :default => 256
151
+ config_param :buffer_queue_limit, :integer, default: 256
146
152
  desc 'The action when the size of buffer queue exceeds the buffer_queue_limit.'
147
- config_param :buffer_queue_full_action, :enum, :list => [:exception, :block], :default => :exception
153
+ config_param :buffer_queue_full_action, :enum, list: [:exception, :block], default: :exception
148
154
 
149
155
  alias chunk_limit buffer_chunk_limit
150
156
  alias chunk_limit= buffer_chunk_limit=
@@ -14,6 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'rbconfig'
18
+
17
19
  if ENV['BUNDLE_BIN_PATH']
18
20
  puts 'error: You seem to use `bundle exec` already.'
19
21
  exit 1
@@ -66,7 +66,7 @@ op.on('--message-key KEY', "key field for none format (default: #{message_key})"
66
66
  message_key = s
67
67
  }
68
68
 
69
- (class<<self;self;end).module_eval do
69
+ (class << self; self; end).module_eval do
70
70
  define_method(:usage) do |msg|
71
71
  puts op.to_s
72
72
  puts "error: #{msg}" if msg
@@ -34,7 +34,7 @@ op.on('-u', '--unix PATH', "use unix socket instead of tcp") {|b|
34
34
  unix = b
35
35
  }
36
36
 
37
- (class<<self;self;end).module_eval do
37
+ (class << self; self; end).module_eval do
38
38
  define_method(:usage) do |msg|
39
39
  puts op.to_s
40
40
  puts "error: #{msg}" if msg
@@ -60,7 +60,8 @@ else
60
60
  uri = "druby://#{host}:#{port}"
61
61
  end
62
62
 
63
- require 'fluent/load'
63
+ require 'fluent/log'
64
+ require 'fluent/engine'
64
65
 
65
66
  $log = Fluent::Log.new(STDERR, Fluent::Log::LEVEL_TRACE)
66
67
  Fluent::Engine.init
@@ -15,7 +15,9 @@
15
15
  #
16
16
 
17
17
  require 'optparse'
18
+
18
19
  require 'fluent/supervisor'
20
+ require 'fluent/version'
19
21
 
20
22
  op = OptionParser.new
21
23
  op.version = Fluent::VERSION
@@ -119,7 +121,7 @@ op.on('-G', '--gem-path GEM_INSTALL_PATH', "Gemfile install path (default: $(dir
119
121
  opts[:gem_install_path] = s
120
122
  }
121
123
 
122
- (class<<self;self;end).module_eval do
124
+ (class << self; self; end).module_eval do
123
125
  define_method(:usage) do |msg|
124
126
  puts op.to_s
125
127
  puts "error: #{msg}" if msg
@@ -14,10 +14,11 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- module Fluent
18
- require 'fluent/config/error'
19
- require 'fluent/config/element'
17
+ require 'fluent/config/error'
18
+ require 'fluent/config/element'
19
+ require 'fluent/configurable'
20
20
 
21
+ module Fluent
21
22
  module Config
22
23
  def self.parse(str, fname, basepath = Dir.pwd, v1_config = false)
23
24
  if fname =~ /\.rb$/
@@ -39,8 +40,6 @@ module Fluent
39
40
  end
40
41
  end
41
42
 
42
- require 'fluent/configurable'
43
-
44
43
  module PluginId
45
44
  def configure(conf)
46
45
  @id = conf['@id'] || conf['id']
@@ -14,12 +14,11 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'stringio'
18
+ require 'fluent/config/error'
19
+
17
20
  module Fluent
18
21
  module Config
19
-
20
- require 'stringio'
21
- require 'fluent/config/error'
22
-
23
22
  class BasicParser
24
23
  def initialize(strscan)
25
24
  @ss = strscan
@@ -14,6 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'fluent/configurable'
18
+
17
19
  module Fluent
18
20
  module Config
19
21
  class ConfigureProxy
@@ -14,7 +14,10 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'json'
18
+
17
19
  require 'fluent/config'
20
+ require 'fluent/config/element'
18
21
 
19
22
  module Fluent
20
23
  module Config
@@ -14,9 +14,10 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- module Fluent
18
- require 'fluent/config/error'
17
+ require 'fluent/config/error'
18
+ require 'fluent/config/literal_parser'
19
19
 
20
+ module Fluent
20
21
  module Config
21
22
  class Element < Hash
22
23
  def initialize(name, arg, attrs, elements, unused = nil)
@@ -14,13 +14,16 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- module Fluent
18
- module Config
17
+ require 'stringio'
18
+
19
+ require 'json'
20
+ require 'yajl'
21
+ require 'irb/ruby-lex' # RubyLex
19
22
 
20
- require 'yajl'
21
- require 'fluent/config/basic_parser'
22
- require 'irb/ruby-lex' # RubyLex
23
+ require 'fluent/config/basic_parser'
23
24
 
25
+ module Fluent
26
+ module Config
24
27
  class LiteralParser < BasicParser
25
28
  def self.unescape_char(c)
26
29
  case c
@@ -14,11 +14,13 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'uri'
18
+
19
+ require 'fluent/config/error'
20
+ require 'fluent/config/element'
21
+
17
22
  module Fluent
18
23
  module Config
19
- require 'fluent/config/error'
20
- require 'fluent/config/element'
21
-
22
24
  class Parser
23
25
  def self.parse(io, fname, basepath = Dir.pwd)
24
26
  attrs, elems = Parser.new(basepath, io.each_line, fname).parse!(true)
@@ -16,10 +16,10 @@
16
16
 
17
17
  require 'json'
18
18
 
19
- module Fluent
20
- require 'fluent/config/error'
21
- require 'fluent/config/v1_parser'
19
+ require 'fluent/config/error'
20
+ require 'fluent/config/v1_parser'
22
21
 
22
+ module Fluent
23
23
  module Config
24
24
  class Section < BasicObject
25
25
  def self.name
@@ -14,9 +14,12 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- module Fluent
18
- require 'json'
17
+ require 'json'
18
+
19
+ require 'fluent/config/error'
20
+ require 'fluent/configurable'
19
21
 
22
+ module Fluent
20
23
  module Config
21
24
  def self.size_value(str)
22
25
  case str.to_s
@@ -61,54 +64,45 @@ module Fluent
61
64
  nil
62
65
  end
63
66
  end
64
- end
65
-
66
- Configurable.register_type(:string, Proc.new { |val, opts|
67
- val
68
- })
69
-
70
- Configurable.register_type(:enum, Proc.new { |val, opts|
71
- s = val.to_sym
72
- raise "Plugin BUG: config type 'enum' requires :list argument" unless opts[:list].is_a?(Array)
73
- unless opts[:list].include?(s)
74
- raise ConfigError, "valid options are #{opts[:list].join(',')} but got #{val}"
75
- end
76
- s
77
- })
78
-
79
- Configurable.register_type(:integer, Proc.new { |val, opts|
80
- val.to_i
81
- })
82
-
83
- Configurable.register_type(:float, Proc.new { |val, opts|
84
- val.to_f
85
- })
86
67
 
87
- Configurable.register_type(:size, Proc.new { |val, opts|
88
- Config.size_value(val)
89
- })
90
-
91
- Configurable.register_type(:bool, Proc.new { |val, opts|
92
- Config.bool_value(val)
93
- })
94
-
95
- Configurable.register_type(:time, Proc.new { |val, opts|
96
- Config.time_value(val)
97
- })
98
-
99
- Configurable.register_type(:hash, Proc.new { |val, opts|
100
- param = val.is_a?(String) ? JSON.load(val) : val
101
- if param.class != Hash
102
- raise ConfigError, "hash required but got #{val.inspect}"
103
- end
104
- param
105
- })
68
+ STRING_TYPE = Proc.new { |val, opts| val }
69
+ ENUM_TYPE = Proc.new { |val, opts|
70
+ s = val.to_sym
71
+ list = opts[:list]
72
+ raise "Plugin BUG: config type 'enum' requires :list of symbols" unless list.is_a?(Array) && list.all?{|v| v.is_a? Symbol }
73
+ unless list.include?(s)
74
+ raise ConfigError, "valid options are #{list.join(',')} but got #{val}"
75
+ end
76
+ s
77
+ }
78
+ INTEGER_TYPE = Proc.new { |val, opts| val.to_i }
79
+ FLOAT_TYPE = Proc.new { |val, opts| val.to_f }
80
+ SIZE_TYPE = Proc.new { |val, opts| Config.size_value(val) }
81
+ BOOL_TYPE = Proc.new { |val, opts| Config.bool_value(val) }
82
+ TIME_TYPE = Proc.new { |val, opts| Config.time_value(val) }
83
+ HASH_TYPE = Proc.new { |val, opts|
84
+ param = val.is_a?(String) ? JSON.load(val) : val
85
+ if param.class != Hash
86
+ raise ConfigError, "hash required but got #{val.inspect}"
87
+ end
88
+ param
89
+ }
90
+ ARRAY_TYPE = Proc.new { |val, opts|
91
+ param = val.is_a?(String) ? JSON.load(val) : val
92
+ if param.class != Array
93
+ raise ConfigError, "array required but got #{val.inspect}"
94
+ end
95
+ param
96
+ }
97
+ end
106
98
 
107
- Configurable.register_type(:array, Proc.new { |val, opts|
108
- param = val.is_a?(String) ? JSON.load(val) : val
109
- if param.class != Array
110
- raise ConfigError, "array required but got #{val.inspect}"
111
- end
112
- param
113
- })
99
+ Configurable.register_type(:string, Config::STRING_TYPE)
100
+ Configurable.register_type(:enum, Config::ENUM_TYPE)
101
+ Configurable.register_type(:integer, Config::INTEGER_TYPE)
102
+ Configurable.register_type(:float, Config::FLOAT_TYPE)
103
+ Configurable.register_type(:size, Config::SIZE_TYPE)
104
+ Configurable.register_type(:bool, Config::BOOL_TYPE)
105
+ Configurable.register_type(:time, Config::TIME_TYPE)
106
+ Configurable.register_type(:hash, Config::HASH_TYPE)
107
+ Configurable.register_type(:array, Config::ARRAY_TYPE)
114
108
  end