diff --git a/logstash-core/lib/logstash/patches/clamp.rb b/logstash-core/lib/logstash/patches/clamp.rb index ad690d776d5..1fc953718c4 100644 --- a/logstash-core/lib/logstash/patches/clamp.rb +++ b/logstash-core/lib/logstash/patches/clamp.rb @@ -79,16 +79,13 @@ def define_deprecated_writer_for(option, opts, &block) new_flag = opts[:new_flag] new_value = opts.fetch(:new_value, value) passthrough = opts.fetch(:passthrough, false) - deprecated_msg = opts[:deprecated_msg] + obsoleted_version = opts[:obsoleted_version] - LogStash::DeprecationMessage.instance << - if new_flag - "DEPRECATION WARNING: The flag #{option.switches} has been deprecated, please use \"--#{new_flag}=#{new_value}\" instead." - elsif deprecated_msg - deprecated_msg - else - "DEPRECATION WARNING: The flag #{option.switches} has been deprecated and may be removed in a future release." - end + dmsg = "DEPRECATION WARNING: The flag #{option.switches} has been deprecated" + dmsg += obsoleted_version.nil? ? " and may be removed in a future release" : " and will be removed in version #{obsoleted_version}" + dmsg += new_flag.nil? ? ".": ", please use \"--#{new_flag}=#{new_value}\" instead." + + LogStash::DeprecationMessage.instance << dmsg if passthrough LogStash::SETTINGS.set(option.attribute_name, value) diff --git a/logstash-core/lib/logstash/runner.rb b/logstash-core/lib/logstash/runner.rb index 27d3e6005ed..20119d90467 100644 --- a/logstash-core/lib/logstash/runner.rb +++ b/logstash-core/lib/logstash/runner.rb @@ -267,7 +267,7 @@ class LogStash::Runner < Clamp::StrictCommand I18n.t("logstash.runner.flag.event_api.tags.illegal"), :default => LogStash::SETTINGS.get_default("event_api.tags.illegal"), :attribute_name => "event_api.tags.illegal", :passthrough => true, - :deprecated_msg => I18n.t("logstash.runner.tags-illegal-deprecated") + :obsoleted_version => "9" # We configure the registry and load any plugin that can register hooks # with logstash, this needs to be done before any operation. diff --git a/logstash-core/locales/en.yml b/logstash-core/locales/en.yml index ac2319554a9..2521a68255d 100644 --- a/logstash-core/locales/en.yml +++ b/logstash-core/locales/en.yml @@ -139,8 +139,6 @@ en: configtest-flag-information: |- You may be interested in the '--configtest' flag which you can use to validate logstash's configuration before you choose to restart a running system. - tags-illegal-deprecated: >- - The flag '--event_api.tags.illegal' is deprecated and will be removed in version 9. tags-illegal-warning: >- Setting `event_api.tags.illegal` to `warn` allows illegal values in the reserved `tags` field, which may crash pipeline unexpectedly. This flag is deprecated and will be removed in version 9. diff --git a/logstash-core/spec/logstash/runner_spec.rb b/logstash-core/spec/logstash/runner_spec.rb index cb07fde6d51..0408e9de173 100644 --- a/logstash-core/spec/logstash/runner_spec.rb +++ b/logstash-core/spec/logstash/runner_spec.rb @@ -384,7 +384,7 @@ let(:runner_deprecation_logger_stub) { double("DeprecationLogger(Runner)").as_null_object } let(:args) { ["--event_api.tags.illegal", "warn", "-e", pipeline_string] } before(:each) { allow(runner).to receive(:deprecation_logger).and_return(runner_deprecation_logger_stub) } - DEPRECATED_MSG="The flag '--event_api.tags.illegal' is deprecated and will be removed in version 9" + DEPRECATED_MSG="The flag [\"--event_api.tags.illegal\"] has been deprecated and will be removed in version 9" it "gives deprecation message when setting to `warn`" do expect(runner_deprecation_logger_stub).to receive(:deprecated)