fluentd 0.10.36 → 0.10.37
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.
- checksums.yaml +7 -0
- data/.travis.yml +2 -2
- data/ChangeLog +8 -0
- data/lib/fluent/config.rb +285 -289
- data/lib/fluent/config_dsl.rb +74 -0
- data/lib/fluent/engine.rb +250 -247
- data/lib/fluent/env.rb +5 -5
- data/lib/fluent/event.rb +120 -124
- data/lib/fluent/input.rb +13 -17
- data/lib/fluent/load.rb +1 -0
- data/lib/fluent/log.rb +238 -242
- data/lib/fluent/match.rb +132 -137
- data/lib/fluent/mixin.rb +151 -155
- data/lib/fluent/parser.rb +201 -205
- data/lib/fluent/plugin.rb +117 -121
- data/lib/fluent/plugin/buf_file.rb +8 -0
- data/lib/fluent/plugin/exec_util.rb +49 -0
- data/lib/fluent/plugin/in_exec.rb +44 -30
- data/lib/fluent/plugin/in_forward.rb +4 -2
- data/lib/fluent/plugin/in_http.rb +5 -0
- data/lib/fluent/plugin/in_stream.rb +5 -2
- data/lib/fluent/plugin/out_exec_filter.rb +4 -47
- data/lib/fluent/plugin/out_stdout.rb +21 -1
- data/lib/fluent/process.rb +358 -362
- data/lib/fluent/status.rb +25 -30
- data/lib/fluent/supervisor.rb +277 -281
- data/lib/fluent/test/base.rb +35 -39
- data/lib/fluent/test/input_test.rb +68 -63
- data/lib/fluent/test/output_test.rb +98 -101
- data/lib/fluent/version.rb +1 -1
- data/test/configdsl.rb +77 -0
- data/test/plugin/in_exec.rb +73 -13
- data/test/plugin/in_gc_stat.rb +1 -1
- data/test/plugin/in_object_space.rb +2 -2
- data/test/plugin/out_stdout.rb +45 -2
- data/test/scripts/exec_script.rb +26 -0
- metadata +31 -46
data/lib/fluent/status.rb
CHANGED
@@ -16,39 +16,34 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
module Fluent
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
record[name] = block.call
|
19
|
+
class StatusClass
|
20
|
+
def initialize
|
21
|
+
@entries = {}
|
22
|
+
@mutex = Mutex.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def register(instance, name, &block)
|
26
|
+
@mutex.synchronize {
|
27
|
+
(@entries[instance.object_id] ||= {})[name] = block
|
28
|
+
}
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
def each(&block)
|
33
|
+
@mutex.synchronize {
|
34
|
+
@entries.each {|obj_id,hash|
|
35
|
+
record = {}
|
36
|
+
hash.each_pair {|name,block|
|
37
|
+
record[name] = block.call
|
38
|
+
}
|
39
|
+
block.call(record)
|
41
40
|
}
|
42
|
-
block.call(record)
|
43
41
|
}
|
44
|
-
|
42
|
+
end
|
45
43
|
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Don't use this class from plugins.
|
49
|
-
# The interface may be changed
|
50
|
-
Status = StatusClass.new
|
51
|
-
|
52
44
|
|
45
|
+
# Don't use this class from plugins.
|
46
|
+
# The interface may be changed
|
47
|
+
Status = StatusClass.new
|
53
48
|
end
|
54
49
|
|
data/lib/fluent/supervisor.rb
CHANGED
@@ -16,364 +16,360 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
module Fluent
|
19
|
+
class Supervisor
|
20
|
+
class LoggerInitializer
|
21
|
+
def initialize(path, level, chuser, chgroup)
|
22
|
+
@path = path
|
23
|
+
@level = level
|
24
|
+
@chuser = chuser
|
25
|
+
@chgroup = chgroup
|
26
|
+
end
|
19
27
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def init
|
31
|
-
if @path && @path != "-"
|
32
|
-
@io = File.open(@path, "a")
|
33
|
-
if @chuser || @chgroup
|
34
|
-
chuid = @chuser ? `id -u #{@chuser}`.to_i : nil
|
35
|
-
chgid = @chgroup ? `id -g #{@chgroup}`.to_i : nil
|
36
|
-
File.chown(chuid, chgid, @path)
|
28
|
+
def init
|
29
|
+
if @path && @path != "-"
|
30
|
+
@io = File.open(@path, "a")
|
31
|
+
if @chuser || @chgroup
|
32
|
+
chuid = @chuser ? `id -u #{@chuser}`.to_i : nil
|
33
|
+
chgid = @chgroup ? `id -g #{@chgroup}`.to_i : nil
|
34
|
+
File.chown(chuid, chgid, @path)
|
35
|
+
end
|
36
|
+
else
|
37
|
+
@io = STDOUT
|
37
38
|
end
|
38
|
-
else
|
39
|
-
@io = STDOUT
|
40
|
-
end
|
41
39
|
|
42
|
-
|
40
|
+
$log = Fluent::Log.new(@io, @level)
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
$log.enable_color(false) if @path
|
43
|
+
$log.enable_debug if @level <= Fluent::Log::LEVEL_DEBUG
|
44
|
+
end
|
47
45
|
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
def stdout?
|
47
|
+
@io == STDOUT
|
48
|
+
end
|
51
49
|
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
def reopen!
|
51
|
+
if @path && @path != "-"
|
52
|
+
@io.reopen(@path, "a")
|
53
|
+
end
|
54
|
+
self
|
55
55
|
end
|
56
|
-
self
|
57
56
|
end
|
58
|
-
end
|
59
57
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
58
|
+
def initialize(opt)
|
59
|
+
@config_path = opt[:config_path]
|
60
|
+
@log_path = opt[:log_path]
|
61
|
+
@log_level = opt[:log_level]
|
62
|
+
@daemonize = opt[:daemonize]
|
63
|
+
@chgroup = opt[:chgroup]
|
64
|
+
@chuser = opt[:chuser]
|
65
|
+
@libs = opt[:libs]
|
66
|
+
@plugin_dirs = opt[:plugin_dirs]
|
67
|
+
@inline_config = opt[:inline_config]
|
68
|
+
@suppress_interval = opt[:suppress_interval]
|
69
|
+
@dry_run = opt[:dry_run]
|
70
|
+
|
71
|
+
@log = LoggerInitializer.new(@log_path, @log_level, @chuser, @chgroup)
|
72
|
+
@finished = false
|
73
|
+
@main_pid = nil
|
74
|
+
end
|
77
75
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
76
|
+
def start
|
77
|
+
require 'fluent/load'
|
78
|
+
@log.init
|
79
|
+
|
80
|
+
dry_run if @dry_run
|
81
|
+
start_daemonize if @daemonize
|
82
|
+
install_supervisor_signal_handlers
|
83
|
+
until @finished
|
84
|
+
supervise do
|
85
|
+
read_config
|
86
|
+
change_privilege
|
87
|
+
init_engine
|
88
|
+
install_main_process_signal_handlers
|
89
|
+
run_configure
|
90
|
+
finish_daemonize if @daemonize
|
91
|
+
run_engine
|
92
|
+
exit 0
|
93
|
+
end
|
94
|
+
$log.error "fluentd main process died unexpectedly. restarting." unless @finished
|
95
95
|
end
|
96
|
-
$log.error "fluentd main process died unexpectedly. restarting." unless @finished
|
97
96
|
end
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
|
102
|
-
def dry_run
|
103
|
-
read_config
|
104
|
-
change_privilege
|
105
|
-
init_engine
|
106
|
-
install_main_process_signal_handlers
|
107
|
-
run_configure
|
108
|
-
exit 0
|
109
|
-
rescue => e
|
110
|
-
$log.error "Dry run failed: #{e}"
|
111
|
-
exit 1
|
112
|
-
end
|
113
97
|
|
114
|
-
|
115
|
-
@wait_daemonize_pipe_r, @wait_daemonize_pipe_w = IO.pipe
|
98
|
+
private
|
116
99
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
100
|
+
def dry_run
|
101
|
+
read_config
|
102
|
+
change_privilege
|
103
|
+
init_engine
|
104
|
+
install_main_process_signal_handlers
|
105
|
+
run_configure
|
122
106
|
exit 0
|
107
|
+
rescue => e
|
108
|
+
$log.error "Dry run failed: #{e}"
|
109
|
+
exit 1
|
123
110
|
end
|
124
111
|
|
125
|
-
|
126
|
-
|
127
|
-
@wait_daemonize_pipe_r = nil
|
112
|
+
def start_daemonize
|
113
|
+
@wait_daemonize_pipe_r, @wait_daemonize_pipe_w = IO.pipe
|
128
114
|
|
129
|
-
|
130
|
-
|
115
|
+
if fork
|
116
|
+
# console process
|
117
|
+
@wait_daemonize_pipe_w.close
|
118
|
+
@wait_daemonize_pipe_w = nil
|
119
|
+
wait_daemonize
|
120
|
+
exit 0
|
121
|
+
end
|
131
122
|
|
132
|
-
|
133
|
-
|
134
|
-
|
123
|
+
# daemonize intermediate process
|
124
|
+
@wait_daemonize_pipe_r.close
|
125
|
+
@wait_daemonize_pipe_r = nil
|
135
126
|
|
136
|
-
|
137
|
-
|
138
|
-
end
|
127
|
+
# in case the child process forked during run_configure
|
128
|
+
@wait_daemonize_pipe_w.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
139
129
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
130
|
+
Process.setsid
|
131
|
+
exit!(0) if fork
|
132
|
+
File.umask(0)
|
133
|
+
|
134
|
+
# supervisor process
|
135
|
+
@supervisor_pid = Process.pid
|
145
136
|
end
|
146
137
|
|
147
|
-
|
148
|
-
|
138
|
+
def wait_daemonize
|
139
|
+
supervisor_pid = @wait_daemonize_pipe_r.read
|
140
|
+
if supervisor_pid.empty?
|
141
|
+
# initialization failed
|
142
|
+
exit! 1
|
143
|
+
end
|
149
144
|
|
150
|
-
|
151
|
-
|
152
|
-
f.write supervisor_pid
|
153
|
-
}
|
154
|
-
end
|
145
|
+
@wait_daemonize_pipe_r.close
|
146
|
+
@wait_daemonize_pipe_r = nil
|
155
147
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
STDERR.reopen("/dev/null", "w")
|
161
|
-
@wait_daemonize_pipe_w.write @supervisor_pid.to_s
|
162
|
-
@wait_daemonize_pipe_w.close
|
163
|
-
@wait_daemonize_pipe_w = nil
|
148
|
+
# write pid file
|
149
|
+
File.open(@daemonize, "w") {|f|
|
150
|
+
f.write supervisor_pid
|
151
|
+
}
|
164
152
|
end
|
165
|
-
end
|
166
|
-
|
167
|
-
def supervise(&block)
|
168
|
-
start_time = Time.now
|
169
153
|
|
170
|
-
|
171
|
-
|
172
|
-
|
154
|
+
def finish_daemonize
|
155
|
+
if @wait_daemonize_pipe_w
|
156
|
+
STDIN.reopen("/dev/null")
|
157
|
+
STDOUT.reopen("/dev/null", "w")
|
158
|
+
STDERR.reopen("/dev/null", "w")
|
159
|
+
@wait_daemonize_pipe_w.write @supervisor_pid.to_s
|
160
|
+
@wait_daemonize_pipe_w.close
|
161
|
+
@wait_daemonize_pipe_w = nil
|
162
|
+
end
|
173
163
|
end
|
174
164
|
|
175
|
-
|
176
|
-
|
177
|
-
STDOUT.reopen("/dev/null", "w")
|
178
|
-
STDERR.reopen("/dev/null", "w")
|
179
|
-
@wait_daemonize_pipe_w.close
|
180
|
-
@wait_daemonize_pipe_w = nil
|
181
|
-
end
|
165
|
+
def supervise(&block)
|
166
|
+
start_time = Time.now
|
182
167
|
|
183
|
-
|
184
|
-
|
185
|
-
|
168
|
+
$log.info "starting fluentd-#{Fluent::VERSION}"
|
169
|
+
@main_pid = fork do
|
170
|
+
main_process(&block)
|
171
|
+
end
|
186
172
|
|
187
|
-
|
173
|
+
if @daemonize && @wait_daemonize_pipe_w
|
174
|
+
STDIN.reopen("/dev/null")
|
175
|
+
STDOUT.reopen("/dev/null", "w")
|
176
|
+
STDERR.reopen("/dev/null", "w")
|
177
|
+
@wait_daemonize_pipe_w.close
|
178
|
+
@wait_daemonize_pipe_w = nil
|
179
|
+
end
|
188
180
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
end
|
193
|
-
end
|
181
|
+
Process.waitpid(@main_pid)
|
182
|
+
@main_pid = nil
|
183
|
+
ecode = $?.to_i
|
194
184
|
|
195
|
-
|
196
|
-
begin
|
197
|
-
block.call
|
198
|
-
|
199
|
-
rescue Fluent::ConfigError
|
200
|
-
$log.error "config error", :file=>@config_path, :error=>$!.to_s
|
201
|
-
$log.debug_backtrace
|
202
|
-
unless @log.stdout?
|
203
|
-
console = Fluent::Log.new(STDOUT, @log_level).enable_debug
|
204
|
-
console.error "config error", :file=>@config_path, :error=>$!.to_s
|
205
|
-
console.debug_backtrace
|
206
|
-
end
|
185
|
+
$log.info "process finished", :code=>ecode
|
207
186
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
unless @log.stdout?
|
212
|
-
console = Fluent::Log.new(STDOUT, @log_level).enable_debug
|
213
|
-
console.error "unexpected error", :error=>$!.to_s
|
214
|
-
console.error_backtrace
|
187
|
+
if !@finished && Time.now - start_time < 1
|
188
|
+
$log.warn "process died within 1 second. exit."
|
189
|
+
exit ecode
|
215
190
|
end
|
216
191
|
end
|
217
192
|
|
218
|
-
|
219
|
-
|
193
|
+
def main_process(&block)
|
194
|
+
begin
|
195
|
+
block.call
|
196
|
+
|
197
|
+
rescue Fluent::ConfigError
|
198
|
+
$log.error "config error", :file=>@config_path, :error=>$!.to_s
|
199
|
+
$log.debug_backtrace
|
200
|
+
unless @log.stdout?
|
201
|
+
console = Fluent::Log.new(STDOUT, @log_level).enable_debug
|
202
|
+
console.error "config error", :file=>@config_path, :error=>$!.to_s
|
203
|
+
console.debug_backtrace
|
204
|
+
end
|
220
205
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
begin
|
229
|
-
Process.kill(:INT, pid)
|
230
|
-
rescue Errno::ESRCH
|
231
|
-
# ignore processes already died
|
232
|
-
end
|
206
|
+
rescue
|
207
|
+
$log.error "unexpected error", :error=>$!.to_s
|
208
|
+
$log.error_backtrace
|
209
|
+
unless @log.stdout?
|
210
|
+
console = Fluent::Log.new(STDOUT, @log_level).enable_debug
|
211
|
+
console.error "unexpected error", :error=>$!.to_s
|
212
|
+
console.error_backtrace
|
233
213
|
end
|
234
214
|
end
|
215
|
+
|
216
|
+
exit! 1
|
235
217
|
end
|
236
218
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
219
|
+
def install_supervisor_signal_handlers
|
220
|
+
trap :INT do
|
221
|
+
$log.debug "fluentd supervisor process get SIGINT"
|
222
|
+
@finished = true
|
223
|
+
if pid = @main_pid
|
224
|
+
# kill processes only still exists
|
225
|
+
unless Process.waitpid(pid, Process::WNOHANG)
|
226
|
+
begin
|
227
|
+
Process.kill(:INT, pid)
|
228
|
+
rescue Errno::ESRCH
|
229
|
+
# ignore processes already died
|
230
|
+
end
|
247
231
|
end
|
248
232
|
end
|
249
233
|
end
|
250
|
-
end
|
251
234
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
235
|
+
trap :TERM do
|
236
|
+
$log.debug "fluentd supervisor process get SIGTERM"
|
237
|
+
@finished = true
|
238
|
+
if pid = @main_pid
|
239
|
+
# kill processes only still exists
|
240
|
+
unless Process.waitpid(pid, Process::WNOHANG)
|
241
|
+
begin
|
242
|
+
Process.kill(:TERM, pid)
|
243
|
+
rescue Errno::ESRCH
|
244
|
+
# ignore processes already died
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
258
248
|
end
|
259
|
-
end
|
260
249
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
250
|
+
trap :HUP do
|
251
|
+
$log.debug "fluentd supervisor process get SIGHUP"
|
252
|
+
$log.info "restarting"
|
253
|
+
if pid = @main_pid
|
254
|
+
Process.kill(:TERM, pid)
|
255
|
+
# don't resuce Erro::ESRSH here (invalid status)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
trap :USR1 do
|
260
|
+
$log.debug "fluentd supervisor process get SIGUSR1"
|
261
|
+
@log.reopen!
|
262
|
+
if pid = @main_pid
|
263
|
+
Process.kill(:USR1, pid)
|
264
|
+
# don't resuce Erro::ESRSH here (invalid status)
|
265
|
+
end
|
267
266
|
end
|
268
267
|
end
|
269
|
-
end
|
270
268
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
269
|
+
def read_config
|
270
|
+
$log.info "reading config file", :path=>@config_path
|
271
|
+
@config_fname = File.basename(@config_path)
|
272
|
+
@config_basedir = File.dirname(@config_path)
|
273
|
+
@config_data = File.read(@config_path)
|
274
|
+
if @inline_config == '-'
|
275
|
+
@config_data << "\n" << STDIN.read
|
276
|
+
elsif @inline_config
|
277
|
+
@config_data << "\n" << @inline_config.gsub("\\n","\n")
|
278
|
+
end
|
280
279
|
end
|
281
|
-
end
|
282
280
|
|
283
|
-
|
284
|
-
|
285
|
-
|
281
|
+
def run_configure
|
282
|
+
Fluent::Engine.parse_config(@config_data, @config_fname, @config_basedir)
|
283
|
+
end
|
286
284
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
285
|
+
def change_privilege
|
286
|
+
if @chgroup
|
287
|
+
chgid = @chgroup.to_i
|
288
|
+
if chgid.to_s != @chgroup
|
289
|
+
chgid = `id -g #{@chgroup}`.to_i
|
290
|
+
if $?.to_i != 0
|
291
|
+
exit 1
|
292
|
+
end
|
294
293
|
end
|
294
|
+
Process::GID.change_privilege(chgid)
|
295
295
|
end
|
296
|
-
Process::GID.change_privilege(chgid)
|
297
|
-
end
|
298
296
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
297
|
+
if @chuser
|
298
|
+
chuid = @chuser.to_i
|
299
|
+
if chuid.to_s != @chuser
|
300
|
+
chuid = `id -u #{@chuser}`.to_i
|
301
|
+
if $?.to_i != 0
|
302
|
+
exit 1
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
user_groups = `id -G #{@chuser}`.split.map(&:to_i)
|
303
307
|
if $?.to_i != 0
|
304
308
|
exit 1
|
305
309
|
end
|
310
|
+
|
311
|
+
Process.groups = Process.groups | user_groups
|
312
|
+
Process::UID.change_privilege(chuid)
|
306
313
|
end
|
314
|
+
end
|
307
315
|
|
308
|
-
|
309
|
-
|
310
|
-
|
316
|
+
def init_engine
|
317
|
+
require 'fluent/load'
|
318
|
+
Fluent::Engine.init
|
319
|
+
if @suppress_interval
|
320
|
+
Fluent::Engine.suppress_interval(@suppress_interval)
|
311
321
|
end
|
312
322
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
end
|
323
|
+
@libs.each {|lib|
|
324
|
+
require lib
|
325
|
+
}
|
317
326
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
327
|
+
@plugin_dirs.each {|dir|
|
328
|
+
if Dir.exist?(dir)
|
329
|
+
dir = File.expand_path(dir)
|
330
|
+
Fluent::Engine.load_plugin_dir(dir)
|
331
|
+
end
|
332
|
+
}
|
323
333
|
end
|
324
334
|
|
325
|
-
|
326
|
-
|
327
|
-
|
335
|
+
def install_main_process_signal_handlers
|
336
|
+
# Strictly speaking, these signal handling is not thread safe.
|
337
|
+
# But enough safe to limit twice call of Fluent::Engine.stop.
|
328
338
|
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
339
|
+
trap :INT do
|
340
|
+
$log.debug "fluentd main process get SIGINT"
|
341
|
+
unless @finished
|
342
|
+
@finished = true
|
343
|
+
$log.debug "getting start to shutdown main process"
|
344
|
+
Fluent::Engine.stop
|
345
|
+
end
|
333
346
|
end
|
334
|
-
}
|
335
|
-
end
|
336
347
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
@finished = true
|
345
|
-
$log.debug "getting start to shutdown main process"
|
346
|
-
Fluent::Engine.stop
|
348
|
+
trap :TERM do
|
349
|
+
$log.debug "fluentd main process get SIGTERM"
|
350
|
+
unless @finished
|
351
|
+
@finished = true
|
352
|
+
$log.debug "getting start to shutdown main process"
|
353
|
+
Fluent::Engine.stop
|
354
|
+
end
|
347
355
|
end
|
348
|
-
end
|
349
356
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
@finished = true
|
354
|
-
$log.debug "getting start to shutdown main process"
|
355
|
-
Fluent::Engine.stop
|
357
|
+
trap :HUP do
|
358
|
+
# TODO
|
359
|
+
$log.debug "fluentd main process get SIGHUP"
|
356
360
|
end
|
357
|
-
end
|
358
361
|
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
+
trap :USR1 do
|
363
|
+
$log.debug "fluentd main process get SIGUSR1"
|
364
|
+
$log.info "force flushing buffered events"
|
365
|
+
@log.reopen!
|
366
|
+
Fluent::Engine.flush!
|
367
|
+
end
|
362
368
|
end
|
363
369
|
|
364
|
-
|
365
|
-
|
366
|
-
$log.info "force flushing buffered events"
|
367
|
-
@log.reopen!
|
368
|
-
Fluent::Engine.flush!
|
370
|
+
def run_engine
|
371
|
+
Fluent::Engine.run
|
369
372
|
end
|
370
373
|
end
|
371
|
-
|
372
|
-
def run_engine
|
373
|
-
Fluent::Engine.run
|
374
|
-
end
|
375
|
-
end
|
376
|
-
|
377
|
-
|
378
374
|
end
|
379
375
|
|