From 8507b3c250cd54352eaf564d1c21abaa4cf6d35f 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..d97e8614f6 100644 --- a/lib/fluent/supervisor.rb +++ b/lib/fluent/supervisor.rb @@ -75,6 +75,16 @@ def run_rpc_server Process.kill :TERM, $$ nil } + @rpc_server.mount_proc('/api/processes.flushBuffersAndKillWorkers') { |req, res| + $log.debug "fluentd RPC got /api/processes.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/plugins.flushBuffers') { |req, res| $log.debug "fluentd RPC got /api/plugins.flushBuffers request" unless Fluent.windows?