diff --git a/lib/logstash/agent.rb b/lib/logstash/agent.rb index 1ab88556d..6db1af296 100644 --- a/lib/logstash/agent.rb +++ b/lib/logstash/agent.rb @@ -117,8 +117,14 @@ class LogStash::Agent < Clamp::Command end # Make SIGINT shutdown the pipeline. - trap_id = Stud::trap("INT") do - @logger.warn(I18n.t("logstash.agent.interrupted")) + sigint_id = Stud::trap("INT") do + @logger.warn(I18n.t("logstash.agent.sigint")) + pipeline.shutdown + end + + # Make SIGTERM shutdown the pipeline. + sigterm_id = Stud::trap("TERM") do + @logger.warn(I18n.t("logstash.agent.sigterm")) pipeline.shutdown end @@ -154,7 +160,8 @@ class LogStash::Agent < Clamp::Command return 1 ensure @log_fd.close if @log_fd - Stud::untrap("INT", trap_id) unless trap_id.nil? + Stud::untrap("INT", sigint_id) unless sigint_id.nil? + Stud::untrap("TERM", sigterm_id) unless sigterm_id.nil? end # def execute def show_version diff --git a/locales/en.yml b/locales/en.yml index 071ae5170..7fd62833e 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -57,8 +57,10 @@ en: the '-f yourlogstash.conf' flag? error: >- Error: %{error} - interrupted: >- - Interrupt received. Shutting down the pipeline. + sigint: >- + SIGINT received. Shutting down the pipeline. + sigterm: >- + SIGTERM received. Shutting down the pipeline. configtest-flag-information: |- You may be interested in the '--configtest' flag which you can use to validate logstash's configuration before you choose