From 5cbc1aa221005d4c3a0a2976b593e5dc3cba01cd Mon Sep 17 00:00:00 2001 From: Jordan Sissel Date: Sun, 16 Jun 2013 22:43:26 -0700 Subject: [PATCH] - make SIGHUP configure logging again (causes the logfile to be reopened) --- lib/logstash/agent.rb | 8 +++++++- locales/en.yml | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/logstash/agent.rb b/lib/logstash/agent.rb index a40921894..fed403549 100644 --- a/lib/logstash/agent.rb +++ b/lib/logstash/agent.rb @@ -96,6 +96,11 @@ class LogStash::Agent < Clamp::Command pipeline.shutdown end + Stud::trap("HUP") do + @logger.info(I18n.t("logstash.agent.sighup")) + configure_logging(log_file) + end + # TODO(sissel): Get pipeline completion status. pipeline.run return 0 @@ -201,7 +206,8 @@ class LogStash::Agent < Clamp::Command end puts "Sending all output to #{path}." - @logger.subscribe(file) + @logger.unsubscribe(@logger_subscription) if @logger_subscription + @logger_subscription = @logger.subscribe(file) else @logger.subscribe(STDOUT) end diff --git a/locales/en.yml b/locales/en.yml index e57b4a283..62cefcbf0 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -50,6 +50,8 @@ en: For more information on plugin statuses, see http://logstash.net/docs/%{LOGSTASH_VERSION}/plugin_status agent: + sighup: >- + SIGHUP received. missing-configuration: >- No configuration file was specified. Perhaps you forgot to provide the '-f yourlogstash.conf' flag?