Module: Fluent::FlushSupport
- Defined in:
- lib/flydata/fluent-plugins/flydata_plugin_ext/flush_support.rb
Instance Method Summary collapse
- #initialize ⇒ Object
-
#install_custom_signal_handler ⇒ Object
Hack: All that has been added here is ‘Fluent::Engine.shutdown_source`.
Instance Method Details
#initialize ⇒ Object
24 25 26 27 |
# File 'lib/flydata/fluent-plugins/flydata_plugin_ext/flush_support.rb', line 24 def initialize super install_custom_signal_handler end |
#install_custom_signal_handler ⇒ Object
Hack: All that has been added here is ‘Fluent::Engine.shutdown_source`. This should be in fluentd’s supervisor#install_main_process_signal_handlers
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/flydata/fluent-plugins/flydata_plugin_ext/flush_support.rb', line 31 def install_custom_signal_handler trap :USR1 do $log.debug "fluentd main process get SIGUSR1" $log.info "force flushing buffered events" #@log.reopen! # Creating new thread due to mutex can't lock # in main thread during trap context Thread.new { begin Fluent::Engine.shutdown_source Fluent::Engine.flush! $log.debug "flushing thread: flushed" rescue Exception => e $log.warn "flushing thread error: #{e}" end }.run end end |