fluentd 0.10.5 → 0.10.6
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 +9 -0
- data/README.rdoc +8 -0
- data/VERSION +1 -1
- data/configure.in +1 -1
- data/fluentd.gemspec +1 -1
- data/lib/fluent/buffer.rb +6 -16
- data/lib/fluent/command/fluentd.rb +31 -18
- data/lib/fluent/engine.rb +7 -1
- data/lib/fluent/output.rb +13 -15
- data/lib/fluent/plugin/buf_file.rb +10 -6
- data/lib/fluent/plugin/buf_memory.rb +4 -0
- data/lib/fluent/plugin/in_forward.rb +1 -1
- data/lib/fluent/plugin/out_forward.rb +2 -2
- data/lib/fluent/version.rb +1 -1
- metadata +18 -15
data/ChangeLog
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
|
2
|
+
Release 0.10.6 - 2011/11/11
|
3
|
+
|
4
|
+
* Fixed --group NAME cmdline argument
|
5
|
+
* Run configure(conf) after changing user and group
|
6
|
+
* Fixed SIGHUP handling
|
7
|
+
* BasicBuffer plugin uses Configurable module
|
8
|
+
* buf_file uses microseconds + 12 bits random number for unique file name
|
9
|
+
|
10
|
+
|
2
11
|
Release 0.10.5 - 2011/11/08
|
3
12
|
|
4
13
|
* Added out_forward, in_forward
|
data/README.rdoc
CHANGED
@@ -47,6 +47,7 @@ An event consists of *tag*, *time* and *record*. Tag is a string separated with
|
|
47
47
|
$ fluentd &
|
48
48
|
$ echo '{"json":"message"}' | fluent-cat debug.test
|
49
49
|
|
50
|
+
== Meta
|
50
51
|
|
51
52
|
Web site:: http://fluentd.org/
|
52
53
|
Documents:: http://fluentd.org/doc/
|
@@ -55,3 +56,10 @@ Author:: Sadayuki Furuhashi
|
|
55
56
|
Copyright:: (c) 2011 FURUHASHI Sadayuki
|
56
57
|
License:: Apache License, Version 2.0
|
57
58
|
|
59
|
+
Contributed by:
|
60
|
+
|
61
|
+
* Eiichiro Iwata
|
62
|
+
* Masahiro Nakagawa
|
63
|
+
* Takashi Nagayasu
|
64
|
+
* Yuichi Tateno
|
65
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.6
|
data/configure.in
CHANGED
data/fluentd.gemspec
CHANGED
data/lib/fluent/buffer.rb
CHANGED
@@ -113,24 +113,14 @@ class BasicBuffer < Buffer
|
|
113
113
|
include MonitorMixin
|
114
114
|
|
115
115
|
def initialize
|
116
|
-
super
|
117
|
-
@chunk_limit = 16*1024*1024 # TODO default
|
118
|
-
@queue_limit = 64 # TODO default
|
119
|
-
@parallel = false
|
116
|
+
super
|
120
117
|
end
|
121
118
|
|
122
|
-
|
119
|
+
config_param :buffer_chunk_limit, :size, :default => 256*1024*1024
|
120
|
+
config_param :buffer_queue_limit, :integer, :default => 128
|
123
121
|
|
124
122
|
def configure(conf)
|
125
123
|
super
|
126
|
-
|
127
|
-
if chunk_limit = conf['buffer_chunk_limit']
|
128
|
-
@chunk_limit = Config.size_value(chunk_limit)
|
129
|
-
end
|
130
|
-
|
131
|
-
if queue_limit = conf['buffer_queue_limit']
|
132
|
-
@queue_limit = queue_limit.to_i
|
133
|
-
end
|
134
124
|
end
|
135
125
|
|
136
126
|
def start
|
@@ -157,16 +147,16 @@ class BasicBuffer < Buffer
|
|
157
147
|
synchronize do
|
158
148
|
top = (@map[key] ||= new_chunk(key)) # TODO generate unique chunk id
|
159
149
|
|
160
|
-
if top.size + data.bytesize <= @
|
150
|
+
if top.size + data.bytesize <= @buffer_chunk_limit
|
161
151
|
chain.next
|
162
152
|
top << data
|
163
153
|
return false
|
164
154
|
|
165
|
-
elsif data.bytesize > @
|
155
|
+
elsif data.bytesize > @buffer_chunk_limit
|
166
156
|
# TODO
|
167
157
|
raise BufferError, "received data too large"
|
168
158
|
|
169
|
-
elsif @queue.size >= @
|
159
|
+
elsif @queue.size >= @buffer_queue_limit
|
170
160
|
# TODO
|
171
161
|
raise BufferError, "queue size exceeds limit"
|
172
162
|
end
|
@@ -134,31 +134,21 @@ require 'fluent/load'
|
|
134
134
|
|
135
135
|
begin
|
136
136
|
#
|
137
|
-
#
|
137
|
+
# read config file
|
138
138
|
#
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
}
|
144
|
-
|
145
|
-
plugin_dirs.each {|dir|
|
146
|
-
if Dir.exist?(dir)
|
147
|
-
dir = File.expand_path(dir)
|
148
|
-
Fluent::Engine.load_plugin_dir(dir)
|
149
|
-
end
|
150
|
-
}
|
151
|
-
|
152
|
-
Fluent::Engine.read_config(config_path)
|
139
|
+
$log.info "reading config file", :path=>config_path
|
140
|
+
config_fname = File.basename(config_path)
|
141
|
+
config_basedir = File.dirname(config_path)
|
142
|
+
config_data = File.read(config_path)
|
153
143
|
|
154
144
|
|
155
145
|
#
|
156
|
-
#
|
146
|
+
# change user
|
157
147
|
#
|
158
148
|
if chgroup
|
159
149
|
chgid = chgroup.to_i
|
160
150
|
if chgid.to_s != chgroup
|
161
|
-
chgid = `id -
|
151
|
+
chgid = `id -g #{chgroup}`.to_i
|
162
152
|
if $?.to_i != 0
|
163
153
|
exit 1
|
164
154
|
end
|
@@ -177,6 +167,29 @@ begin
|
|
177
167
|
Process::UID.change_privilege(chuid)
|
178
168
|
end
|
179
169
|
|
170
|
+
|
171
|
+
#
|
172
|
+
# run configure
|
173
|
+
#
|
174
|
+
Fluent::Engine.init
|
175
|
+
|
176
|
+
libs.each {|lib|
|
177
|
+
require lib
|
178
|
+
}
|
179
|
+
|
180
|
+
plugin_dirs.each {|dir|
|
181
|
+
if Dir.exist?(dir)
|
182
|
+
dir = File.expand_path(dir)
|
183
|
+
Fluent::Engine.load_plugin_dir(dir)
|
184
|
+
end
|
185
|
+
}
|
186
|
+
|
187
|
+
Fluent::Engine.parse_config(config_data, config_fname, config_basedir)
|
188
|
+
|
189
|
+
|
190
|
+
#
|
191
|
+
# daemonize
|
192
|
+
#
|
180
193
|
trap :INT do
|
181
194
|
Fluent::Engine.stop
|
182
195
|
end
|
@@ -187,7 +200,7 @@ begin
|
|
187
200
|
|
188
201
|
trap :HUP do
|
189
202
|
if log_file
|
190
|
-
|
203
|
+
log_out.reopen(log_file, "a")
|
191
204
|
end
|
192
205
|
end
|
193
206
|
|
data/lib/fluent/engine.rb
CHANGED
@@ -37,7 +37,13 @@ class EngineClass
|
|
37
37
|
|
38
38
|
def read_config(path)
|
39
39
|
$log.info "reading config file", :path=>path
|
40
|
-
|
40
|
+
File.open(path) {|io|
|
41
|
+
parse_config(io, File.basename(path), File.dirname(path))
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_config(io, fname, basepath=Dir.pwd)
|
46
|
+
conf = Config.parse(io, fname, basepath)
|
41
47
|
configure(conf)
|
42
48
|
conf.check_not_fetched {|key,e|
|
43
49
|
$log.warn "parameter '#{key}' in #{e.to_s.strip} is not used."
|
data/lib/fluent/output.rb
CHANGED
@@ -236,28 +236,34 @@ class OutputThread
|
|
236
236
|
next if has_next
|
237
237
|
|
238
238
|
rescue
|
239
|
-
|
240
|
-
$log.warn_backtrace
|
241
|
-
|
239
|
+
e = $!
|
242
240
|
error_count = @error_history.size
|
243
241
|
@error_history << time
|
244
242
|
|
245
243
|
if error_count < @retry_limit
|
246
|
-
$log.
|
244
|
+
$log.warn "failed to flush the buffer, retrying.", :error=>e.to_s
|
245
|
+
$log.warn_backtrace e.backtrace
|
247
246
|
|
248
247
|
elsif @secondary
|
249
248
|
if error_count == @retry_limit
|
249
|
+
$log.warn "failed to flush the buffer.", :error=>e.to_s
|
250
250
|
$log.warn "retry count exceededs limit. falling back to secondary output."
|
251
|
+
$log.warn_backtrace e.backtrace
|
251
252
|
next # retry immediately
|
252
253
|
elsif error_count <= @retry_limit + @secondary_limit
|
253
|
-
$log.
|
254
|
+
$log.warn "failed to flush the buffer, retrying secondary.", :error=>e.to_s
|
255
|
+
$log.warn_backtrace e.backtrace
|
254
256
|
else
|
257
|
+
$log.warn "failed to flush the buffer.", :error=>e.to_s
|
255
258
|
$log.warn "secondary retry count exceededs limit."
|
259
|
+
$log.warn_backtrace e.backtrace
|
256
260
|
write_abort
|
257
261
|
end
|
258
262
|
|
259
263
|
else
|
264
|
+
$log.warn "failed to flush the buffer.", :error=>e.to_s
|
260
265
|
$log.warn "retry count exceededs limit."
|
266
|
+
$log.warn_backtrace e.backtrace
|
261
267
|
write_abort
|
262
268
|
end
|
263
269
|
|
@@ -367,12 +373,12 @@ class TimeSlicedOutput < BufferedOutput
|
|
367
373
|
super
|
368
374
|
@localtime = true
|
369
375
|
#@ignore_old = false # TODO
|
370
|
-
# TODO @flush_interval = 60 # overwrite default flush_interval
|
371
376
|
end
|
372
377
|
|
373
378
|
config_param :time_slice_format, :string, :default => '%Y%m%d'
|
374
|
-
config_param :time_slice_wait, :time, :default => 10*60
|
379
|
+
config_param :time_slice_wait, :time, :default => 10*60
|
375
380
|
config_set_default :buffer_type, 'file' # overwrite default buffer_type
|
381
|
+
# config_set_default :flush_interval, 60 # TODO overwrite default flush_interval
|
376
382
|
|
377
383
|
attr_accessor :localtime
|
378
384
|
|
@@ -386,14 +392,6 @@ class TimeSlicedOutput < BufferedOutput
|
|
386
392
|
@localtime = true
|
387
393
|
end
|
388
394
|
|
389
|
-
if time_slice_format = conf['time_slice_format']
|
390
|
-
@time_slice_format = time_slice_format
|
391
|
-
end
|
392
|
-
|
393
|
-
if time_slice_wait = conf['time_slice_wait']
|
394
|
-
@time_slice_wait = Config.time_value(time_slice_wait)
|
395
|
-
end
|
396
|
-
|
397
395
|
if @localtime
|
398
396
|
@time_slicer = Proc.new {|time|
|
399
397
|
Time.at(time).strftime(@time_slice_format)
|
@@ -98,12 +98,11 @@ class FileBuffer < BasicBuffer
|
|
98
98
|
super
|
99
99
|
end
|
100
100
|
|
101
|
-
PATH_MATCH = /^(.*)[\._](b|q)([0-9a-fA-F]{1,
|
101
|
+
PATH_MATCH = /^(.*)[\._](b|q)([0-9a-fA-F]{1,32})$/
|
102
102
|
|
103
103
|
def new_chunk(key)
|
104
|
-
tsuffix = Engine.now.to_i.to_s(16)
|
105
104
|
encoded_key = encode_key(key)
|
106
|
-
path = "
|
105
|
+
path = make_path(encoded_key, "b")
|
107
106
|
FileBufferChunk.new(key, path)
|
108
107
|
end
|
109
108
|
|
@@ -150,10 +149,9 @@ class FileBuffer < BasicBuffer
|
|
150
149
|
|
151
150
|
m = PATH_MATCH.match(mp)
|
152
151
|
encoded_key = m ? m[1] : ""
|
153
|
-
|
152
|
+
npath = make_path(encoded_key, "q")
|
154
153
|
|
155
|
-
|
156
|
-
chunk.mv(path)
|
154
|
+
chunk.mv(npath)
|
157
155
|
end
|
158
156
|
|
159
157
|
protected
|
@@ -164,6 +162,12 @@ class FileBuffer < BasicBuffer
|
|
164
162
|
def decode_key(encoded_key)
|
165
163
|
URI.decode(encoded_key, /[^-_.a-zA-Z0-9]/n)
|
166
164
|
end
|
165
|
+
|
166
|
+
def make_path(encoded_key, bq)
|
167
|
+
now = Time.now.utc
|
168
|
+
tsuffix = ((now.to_i*1000*1000+now.usec) << 12 | rand(0xfff)).to_s(16)
|
169
|
+
"#{@buffer_path_prefix}#{encoded_key}.#{bq}#{tsuffix}#{@buffer_path_suffix}"
|
170
|
+
end
|
167
171
|
end
|
168
172
|
|
169
173
|
|
@@ -66,6 +66,10 @@ class MemoryBuffer < BasicBuffer
|
|
66
66
|
super
|
67
67
|
end
|
68
68
|
|
69
|
+
# overwrite default buffer_chunk_limit and buffer_queue_limit
|
70
|
+
config_set_default :buffer_chunk_limit, 32*1024*1024
|
71
|
+
config_set_default :buffer_queue_limit, 32
|
72
|
+
|
69
73
|
def configure(conf)
|
70
74
|
super
|
71
75
|
end
|
@@ -224,7 +224,7 @@ class ForwardOutput < BufferedOutput
|
|
224
224
|
|
225
225
|
def on_heartbeat(sockaddr, msg)
|
226
226
|
if node = @nodes[sockaddr]
|
227
|
-
|
227
|
+
#$log.trace "heartbeat from '#{node.name}'", :host=>node.host, :port=>node.port
|
228
228
|
node.heartbeat
|
229
229
|
end
|
230
230
|
end
|
@@ -253,7 +253,7 @@ class ForwardOutput < BufferedOutput
|
|
253
253
|
def tick
|
254
254
|
now = Time.now.to_f
|
255
255
|
phi = @failure.phi(now)
|
256
|
-
|
256
|
+
#$log.trace "phi '#{@name}'", :host=>@host, :port=>@port, :phi=>phi
|
257
257
|
if phi > @phi_threshold
|
258
258
|
$log.info "detached forwarding server '#{@name}'", :host=>@host, :port=>@port, :phi=>phi
|
259
259
|
@available = false
|
data/lib/fluent/version.rb
CHANGED
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.
|
4
|
+
version: 0.10.6
|
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: 2011-11-
|
12
|
+
date: 2011-11-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70241926265840 !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: *
|
24
|
+
version_requirements: *70241926265840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70241926265340 !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: *
|
35
|
+
version_requirements: *70241926265340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yajl-ruby
|
38
|
-
requirement: &
|
38
|
+
requirement: &70241926264760 !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: *
|
46
|
+
version_requirements: *70241926264760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cool.io
|
49
|
-
requirement: &
|
49
|
+
requirement: &70241926264180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70241926264180
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: http_parser.rb
|
60
|
-
requirement: &
|
60
|
+
requirement: &70241926263580 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,18 +65,18 @@ dependencies:
|
|
65
65
|
version: 0.5.1
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70241926263580
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
|
-
requirement: &
|
71
|
+
requirement: &70241926262980 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 0.9.2
|
77
|
-
type: :
|
77
|
+
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70241926262980
|
80
80
|
description: Fluent event collector
|
81
81
|
email: frsyuki@gmail.com
|
82
82
|
executables:
|
@@ -174,6 +174,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
- - ! '>='
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
|
+
segments:
|
178
|
+
- 0
|
179
|
+
hash: -247010597989313430
|
177
180
|
requirements: []
|
178
181
|
rubyforge_project:
|
179
182
|
rubygems_version: 1.8.10
|