From 9116cdb850af388f44a9115b0f405e0d040a935e Mon Sep 17 00:00:00 2001 From: TAGOMORI Satoshi Date: Mon, 1 Aug 2016 12:44:48 +0900 Subject: [PATCH] add a RPC call to flush buffers and stop workers --- lib/fluent/supervisor.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/fluent/supervisor.rb b/lib/fluent/supervisor.rb index c8ad426a0e..6823ba6d44 100644 --- a/lib/fluent/supervisor.rb +++ b/lib/fluent/supervisor.rb @@ -82,6 +82,16 @@ def run_rpc_server end nil } + @rpc_server.mount_proc('/api/plugins.flushBuffersAndKillWorkers') { |req, res| + $log.debug "fluentd RPC got /api/plugins.flushBuffersAndKillWorkers request" + if Fluent.windows? + $log.warn "operation 'flushBuffersAndKillWorkers' is not supported on Windows now." + else + Process.kill :USR1, $$ + Process.kill :TERM, $$ + end + nil + } @rpc_server.mount_proc('/api/config.reload') { |req, res| $log.debug "fluentd RPC got /api/config.reload request" if Fluent.windows?