fluentd 0.10.10 → 0.10.11

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,20 @@
1
1
 
2
+ Release 0.10.11 - 2012/02/10
3
+
4
+ * out_forward supports 'standby' parameter
5
+ * out_forward handles 'hard_timeout' correctly
6
+
7
+
8
+ Release 0.10.10 - 2012/02/09
9
+
10
+ * in_forward and out_forward don't raise exceptions in callback handlers of
11
+ cool.io not to stop Loop#run
12
+ * TimeSlicedOutput ignores time_slice_wait if flush_interval is specified
13
+ * in_tail follows symbolic links correctly
14
+ * in_http supports "Content-Type: application/json"
15
+ * TestDriver#run sleeps 0.5 seconds for the out_exec_filter plugin
16
+
17
+
2
18
  Release 0.10.9 - 2012/01/19
3
19
 
4
20
  * Fixed TimeSlicedOutputTestDriver
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.10
1
+ 0.10.11
@@ -66,15 +66,17 @@ class ForwardOutput < ObjectBufferedOutput
66
66
  weight = e['weight']
67
67
  weight = weight ? weight.to_i : 60
68
68
 
69
+ standby = !!e['standby']
70
+
69
71
  name = e['name']
70
72
  unless name
71
73
  name = "#{host}:#{port}"
72
74
  end
73
75
 
74
- failure = FailureDetector.new(@heartbeat_interval.to_f/2, @hard_timeout)
76
+ failure = FailureDetector.new(@heartbeat_interval.to_f/2, @hard_timeout, Time.now.to_i.to_f)
75
77
  sockaddr = Socket.pack_sockaddr_in(port, host)
76
78
  port, host = Socket.unpack_sockaddr_in(sockaddr)
77
- @nodes[sockaddr] = Node.new(name, host, port, weight, failure,
79
+ @nodes[sockaddr] = Node.new(name, host, port, weight, standby, failure,
78
80
  @phi_threshold, recover_sample_size)
79
81
  $log.info "adding forwarding server '#{name}'", :host=>host, :port=>port, :weight=>weight
80
82
  }
@@ -83,15 +85,8 @@ class ForwardOutput < ObjectBufferedOutput
83
85
  def start
84
86
  super
85
87
 
86
- @weight_array = []
87
- gcd = @nodes.values.map {|n| n.weight }.inject(0) {|r,w| r.gcd(w) }
88
- @nodes.each_value {|n|
89
- (n.weight / gcd).times {
90
- @weight_array << n
91
- }
92
- }
93
- @weight_array.sort_by { rand }
94
-
88
+ @rand_seed = Random.new.seed
89
+ rebuild_weight_array
95
90
  @rr = 0
96
91
 
97
92
  @loop = Coolio::Loop.new
@@ -145,6 +140,44 @@ class ForwardOutput < ObjectBufferedOutput
145
140
  end
146
141
 
147
142
  private
143
+ def rebuild_weight_array
144
+ standby_nodes, regular_nodes = @nodes.values.partition {|n|
145
+ n.standby?
146
+ }
147
+
148
+ lost_weight = 0
149
+ regular_nodes.each {|n|
150
+ unless n.available?
151
+ lost_weight += n.weight
152
+ end
153
+ }
154
+ $log.debug "rebuilding weight array", :lost_weight=>lost_weight
155
+
156
+ if lost_weight > 0
157
+ standby_nodes.each {|n|
158
+ if n.available?
159
+ regular_nodes << n
160
+ $log.info "using standby node #{n.host}:#{n.port}", :weight=>n.weight
161
+ lost_weight -= n.weight
162
+ break if lost_weight <= 0
163
+ end
164
+ }
165
+ end
166
+
167
+ weight_array = []
168
+ gcd = regular_nodes.map {|n| n.weight }.inject(0) {|r,w| r.gcd(w) }
169
+ regular_nodes.each {|n|
170
+ (n.weight / gcd).times {
171
+ weight_array << n
172
+ }
173
+ }
174
+
175
+ r = Random.new(@rand_seed)
176
+ weight_array.sort_by { r.rand }
177
+
178
+ @weight_array = weight_array
179
+ end
180
+
148
181
  # MessagePack FixArray length = 2
149
182
  FORWARD_HEADER = [0x92].pack('C')
150
183
 
@@ -204,8 +237,11 @@ class ForwardOutput < ObjectBufferedOutput
204
237
  def on_timer
205
238
  return if @finished
206
239
  @nodes.each_pair {|sockaddr,n|
207
- n.tick
240
+ if n.tick
241
+ rebuild_weight_array
242
+ end
208
243
  begin
244
+ #$log.trace "sending heartbeat #{n.host}:#{n.port}"
209
245
  @usock.send "", 0, sockaddr
210
246
  rescue
211
247
  # TODO log
@@ -235,49 +271,75 @@ class ForwardOutput < ObjectBufferedOutput
235
271
  def on_heartbeat(sockaddr, msg)
236
272
  if node = @nodes[sockaddr]
237
273
  #$log.trace "heartbeat from '#{node.name}'", :host=>node.host, :port=>node.port
238
- node.heartbeat
274
+ if node.heartbeat
275
+ rebuild_weight_array
276
+ end
239
277
  end
240
278
  end
241
279
 
242
280
  class Node
243
- def initialize(name, host, port, weight, failure,
281
+ def initialize(name, host, port, weight, standby, failure,
244
282
  phi_threshold, recover_sample_size)
245
283
  @name = name
246
284
  @host = host
247
285
  @port = port
248
286
  @weight = weight
287
+ @standby = standby
249
288
  @failure = failure
250
289
  @phi_threshold = phi_threshold
251
290
  @recover_sample_size = recover_sample_size
252
291
  @available = true
253
292
  end
254
293
 
255
- attr_reader :name, :host, :port
256
- attr_reader :weight
257
- attr_writer :available
294
+ attr_reader :name, :host, :port, :weight
295
+ attr_writer :weight, :standby, :available
258
296
 
259
297
  def available?
260
298
  @available
261
299
  end
262
300
 
301
+ def standby?
302
+ @standby
303
+ end
304
+
263
305
  def tick
264
306
  now = Time.now.to_f
307
+ if !@available
308
+ if @failure.hard_timeout?(now)
309
+ @failure.clear
310
+ end
311
+ return nil
312
+ end
313
+
314
+ if @failure.hard_timeout?(now)
315
+ $log.info "detached forwarding server '#{@name}'", :host=>@host, :port=>@port, :hard_timeout=>true
316
+ @available = false
317
+ @failure.clear
318
+ return true
319
+ end
320
+
265
321
  phi = @failure.phi(now)
266
322
  #$log.trace "phi '#{@name}'", :host=>@host, :port=>@port, :phi=>phi
267
323
  if phi > @phi_threshold
268
324
  $log.info "detached forwarding server '#{@name}'", :host=>@host, :port=>@port, :phi=>phi
269
325
  @available = false
270
326
  @failure.clear
327
+ return true
328
+ else
329
+ return false
271
330
  end
272
331
  end
273
332
 
274
333
  def heartbeat
275
334
  now = Time.now.to_f
276
335
  @failure.add(now)
277
- if !@available && @failure.sample_size > @recover_sample_size &&
278
- @failure.phi(now) <= @phi_threshold
336
+ #$log.trace "heartbeat from '#{@name}'", :host=>@host, :port=>@port, :available=>@available, :sample_size=>@failure.sample_size
337
+ if !@available && @failure.sample_size > @recover_sample_size
279
338
  $log.info "recovered forwarding server '#{@name}'", :host=>@host, :port=>@port
280
339
  @available = true
340
+ return true
341
+ else
342
+ return nil
281
343
  end
282
344
  end
283
345
 
@@ -290,27 +352,26 @@ class ForwardOutput < ObjectBufferedOutput
290
352
  PHI_FACTOR = 1.0 / Math.log(10.0)
291
353
  SAMPLE_SIZE = 1000
292
354
 
293
- def initialize(init_int, hard_timeout)
294
- @last = 0
355
+ def initialize(init_int, hard_timeout, init_last)
356
+ @last = init_last
295
357
  @init_int = init_int
296
358
  @hard_timeout = hard_timeout
297
- @window = []
298
- @failure = false
359
+ @window = [init_int]
360
+ end
361
+
362
+ def hard_timeout?(now)
363
+ now - @last > @hard_timeout
299
364
  end
300
365
 
301
366
  def add(now)
302
- if @last > 0
303
- int = now - @last
367
+ if @window.empty?
368
+ @window << @init_int
369
+ @last = now
304
370
  else
305
- int = @init_int
306
- end
307
- if int <= @hard_timeout
371
+ int = now - @last
308
372
  @window << int
309
373
  @window.shift if @window.length > SAMPLE_SIZE
310
374
  @last = now
311
- true
312
- else
313
- false
314
375
  end
315
376
  end
316
377
 
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
 
3
- VERSION = '0.10.10'
3
+ VERSION = '0.10.11'
4
4
 
5
5
  end
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.10
4
+ version: 0.10.11
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-02-09 00:00:00.000000000Z
12
+ date: 2012-02-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
16
- requirement: &70325962479480 !ruby/object:Gem::Requirement
16
+ requirement: &70203141220220 !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: *70325962479480
24
+ version_requirements: *70203141220220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70325962478220 !ruby/object:Gem::Requirement
27
+ requirement: &70203141219740 !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: *70325962478220
35
+ version_requirements: *70203141219740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yajl-ruby
38
- requirement: &70325962474920 !ruby/object:Gem::Requirement
38
+ requirement: &70203141219240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70325962474920
46
+ version_requirements: *70203141219240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cool.io
49
- requirement: &70325962473640 !ruby/object:Gem::Requirement
49
+ requirement: &70203141218740 !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: *70325962473640
57
+ version_requirements: *70203141218740
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: http_parser.rb
60
- requirement: &70325962469580 !ruby/object:Gem::Requirement
60
+ requirement: &70203141218220 !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: *70325962469580
68
+ version_requirements: *70203141218220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &70325962465420 !ruby/object:Gem::Requirement
71
+ requirement: &70203141217440 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.9.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70325962465420
79
+ version_requirements: *70203141217440
80
80
  description:
81
81
  email: frsyuki@gmail.com
82
82
  executables:
@@ -86,7 +86,6 @@ executables:
86
86
  extensions: []
87
87
  extra_rdoc_files:
88
88
  - ChangeLog
89
- - ChangeLog.cp
90
89
  - README
91
90
  - README.rdoc
92
91
  files:
@@ -155,7 +154,6 @@ files:
155
154
  - test/plugin/out_roundrobin.rb
156
155
  - test/plugin/out_stream.rb
157
156
  - ChangeLog
158
- - ChangeLog.cp
159
157
  - README
160
158
  - README.rdoc
161
159
  homepage: http://fluentd.org/
@@ -1,265 +0,0 @@
1
-
2
- Release 0.10.10 - 2012/01/19
3
-
4
- * in_forward and on_forward don't raise exceptions in callback handlers of
5
- cool.io not to stop Loop#run
6
- * TimeSlicedOutput ignores time_slice_wait if flush_interval is specified
7
- * in_tail follows symbolic links correctly
8
- * in_http supports "Content-Type: application/json"
9
- * TestDriver#run sleeps 0.5 seconds for the out_exec_filter plugin
10
-
11
-
12
- Release 0.10.9 - 2012/01/19
13
-
14
- * Fixed TimeSlicedOutputTestDriver
15
- * Updated cool.io 1.0.0 -> 1.1.0
16
- * TextParser: fixed regexp of syslog parser to work with rsyslog on CentOS
17
- * out_exec_filter: improve performance by using buffering
18
- * out_exec_filter: added num_children parameter
19
- * out_exec_filter: added remove_prefix/add_prefix parameters
20
- * out_tail: show warning if pos_file parameter is not set
21
- * out_copy: fixed problems when event stream is not repeatable
22
-
23
-
24
- Release 0.10.8 - 2011/12/03
25
-
26
- * Added Supervisor: restart process on SIGHUP or unexpected end of process
27
- * Added -i commandline option which allows inline config
28
- * Added TimeSlicedOutputTestDriver
29
- * BufferedOutput outputs 'retry succeeded' message
30
- * Use Gem::Specification instead of Gem.searcher which is obsoleted
31
- * Added BasicBuffer#chunk_limit -> buffer_chunk_limit alias for backward
32
- compatibility
33
- * buf_file: fixed to work with keys which contains '/'
34
-
35
-
36
- Release 0.10.7 - 2011/11/16
37
-
38
- * Supports multi-threaded on buffered output plugins ('num_threads')
39
- * Supports multi-process on input plugins ('detach_process')
40
- * Added ObjectBufferedOutput
41
- * Ensure to call 'shutdown' method of started plugins
42
- * in_tail supports 'pos_file' option that stores read position to a file
43
-
44
-
45
- Release 0.10.6 - 2011/11/11
46
-
47
- * Fixed --group NAME cmdline argument
48
- * Run configure(conf) after changing user and group
49
- * Fixed SIGHUP handling
50
- * BasicBuffer plugin uses Configurable module
51
- * buf_file uses microseconds + 12 bits random number for unique file name
52
-
53
-
54
- Release 0.10.5 - 2011/11/08
55
-
56
- * Added out_forward, in_forward
57
- * Added out_exec, in_exec
58
- * Added out_exec_filter
59
-
60
-
61
- Release 0.10.4 - 2011/11/07
62
-
63
- * TestDriver uses klass.dup.module_eval instead of inheriting class to
64
- override methods
65
- * fixed encoding problem of String#[] in FileBufferChunk#<<(data)
66
-
67
-
68
- Release 0.10.3 - 2011/10/21
69
-
70
- * Supports 'include' in config file
71
- * Supports "http://" schema
72
- * Supports wildcards
73
-
74
-
75
- Release 0.10.2 - 2011/10/18
76
-
77
- * Fixed EventStream#to_msgpack_stream (thanks CkReal)
78
- * Added gemspec.required_ruby_version = '~> 1.9.2' (thanks sakuro)
79
-
80
-
81
- Release 0.10.1 - 2011/10/16
82
-
83
- * SetTimeKeyMixin accepts include_time_key parameter
84
- * SetTagKeyMixin accepts include_tag_key parameter
85
- * Fixed Makefile.am
86
- * Fixed MemoryBufferChunk#msgpack_each
87
-
88
-
89
- Release 0.10.0 - 2011/10/16
90
-
91
- * Removed Event class
92
- * def format(tag, event) -> format(time, tag, record)
93
- * def emit(tag, event) -> emit(tag, time, record)
94
- * Added plugin APIs
95
- * Added Configurable
96
- * Added TimeFormatter
97
- * Added SetTimeKeyMixin
98
- * Added SetTagKeyMixin
99
- * Added InputTestDriver
100
- * Added Gemfile, gemspec and .rvmrc files
101
-
102
-
103
- Release 0.9.20 - 2011/10/07
104
-
105
- * Config#has_key? sets used flag not to show warning
106
- * in_tcp supports JSON
107
- * Depends on Yajl
108
- * Fixed fluentd -r option
109
- * Fixed autogen.sh to create plugins directory
110
-
111
-
112
- Release 0.9.19 - 2011/10/07
113
-
114
- * Secondary outputs work only when error count exceededs retry_limit
115
- * Secondary outputs retry upto secondary_limit
116
- * Added Output#secondary_init
117
- * Added unit test driver for output plugins
118
- * Added Fluent::Test.test? method
119
- * Added comparision methods (<=>, ==, eql? and hash) to Event class
120
- * Added test cases for out_copy, out_roundrobin and out_file
121
-
122
-
123
- Release 0.9.18 - 2011/10/04
124
-
125
- * Performance improvements
126
- * in_tcp uses lazy deserialization
127
- * Engine caches results of Match#match
128
- * out_file caches results of strftime
129
- * Fixed TextParser.register_template
130
-
131
-
132
- Release 0.9.17 - 2011/10/03
133
-
134
- * TimeSlicedOutput caches results of strftime() for performance
135
- * Fixed TextParser.register_template (thanks eiichiroi)
136
- * Fixed fluent-cat --port argument to work
137
-
138
-
139
- Release 0.9.16 - 2011/10/01
140
-
141
- * Fixed it can't use relative path for --plugin command line argument
142
- * Fixed out_copy to work with non-repeatable event streams
143
-
144
-
145
- Release 0.9.15 - 2011/09/21
146
-
147
- * Set default encoding to ASCII-8BIT
148
- * Fixed thread issues in BasicBuffer
149
- * Performance improvements
150
-
151
-
152
- Release 0.9.14 - 2011/09/21
153
-
154
- * Fixed to write unexpected error to log files
155
- * Plugin loader uses GemSpec if it is available to load newer plugin
156
- * Added Config.bool_value method for plugins
157
-
158
-
159
- Release 0.9.13 - 2011/09/21
160
-
161
- * Updated out_file plugin
162
- * Uses localtime by default
163
- * Uses \t to separate time, tag and JSON.
164
- * Uses ISO-8601 for the time format
165
-
166
-
167
- Release 0.9.12 - 2011/09/20
168
-
169
- * Updated out_file plugin
170
- * Supports log compression
171
- * Slices log files every day by default
172
-
173
-
174
- Release 0.9.11 - 2011/09/19
175
-
176
- * Added out_null plugin
177
- * Added out_roundrobin plugin
178
- * in_http supports keep-alive
179
- * in_tcp and in_unix detect network failure
180
-
181
-
182
- Release 0.9.10 - 2011/09/07
183
-
184
- * Periodic timer enqueues buffer chunks only when queue is empty
185
-
186
-
187
- Release 0.9.9 - 2011/09/06
188
-
189
- * in_tail strips \n at the end of log line
190
- * Uses newer one if multiple plugins are found
191
-
192
-
193
- Release 0.9.8 - 2011/08/16
194
-
195
- * in_http plugin supports 'Expect: 100-continue' header
196
- * Added --user and --group command line arguments to change privilege
197
- * Changed default retry_limit parameter from 8 to 17
198
- * Changed default buffer_chunk_limit parameter from 1m to 16m
199
- * Changed default buffer_queue_limit parameter from 100 to 64
200
-
201
-
202
- Release 0.9.7 - 2011/08/06
203
-
204
- * Load plugins named fluent_plugin.rb installed by RubyGems
205
- * Load plugins located on fluent/plugin/{buf,in,out}_{type} installed by RubyGems
206
- * Removed out_tdlog plugin to fluent-plugin-td gem
207
-
208
-
209
- Release 0.9.6 - 2011/08/06
210
-
211
- * Force flush buffered events on SIGUSR1
212
- * out_tdlog uses event tag for the database and table name
213
- * Fluent can log Fluent logs
214
- * Colorize Fluent logs on console
215
- * Changed default unix domain socket path to /var/run/fluent/fluent.sock
216
- * Makefile.am and configure.in aware fakeroot
217
-
218
-
219
- Release 0.9.5 - 2011/07/23
220
-
221
- * Added <secondary> tag that fallbacks to secondary output when it can't
222
- write to primary output.
223
- * <match> pattern supports **; matches any fragments recursively.
224
- * <match> pattern supports {x,y,...}; matches any of the inner patterns.
225
-
226
-
227
- Release 0.9.4 - 2011/07/22
228
-
229
- * Switched EventMachine to Cool.io
230
- * in_tail continues to follow file if it is deleted on Linux
231
- * Added fluentd --setup option that installs sample configuration file
232
- * Added out_tdlog plugin
233
-
234
-
235
- Release 0.9.3 - 2011/07/05
236
-
237
- * Disable EventMachine.epoll because it doesn't work correctly on
238
- Ruby 1.9 with threads
239
- * in_tcp and in_unix uses EventMachine instead of threads
240
- * Set BasicSocket.do_not_reverse_lookup = true
241
-
242
-
243
- Release 0.9.2 - 2011/07/03
244
-
245
- * Added TimeSlicedOutput that splits buffer chunk exactly based on the time
246
- * Changed structure of buffers from queue to map + queue
247
- * Show waring if configuration parameters are not used
248
- * Added out_time_file plugin
249
-
250
-
251
- Release 0.9.1 - 2011/06/26
252
-
253
- * Added in_tail plugin
254
- * Added in_syslog plugin
255
- * Added out_stdout plugin
256
- * Added out_tcp plugin
257
- * Added out_unix plugin
258
- * Improved performance of in_http plugin by replacing WEBrick + thread
259
- with EventMachine
260
-
261
-
262
- Release 0.9.0 - 2011/06/20
263
-
264
- * First release
265
-