From cd30aa94a895ee95353fc3d68a08cf51b5db51c0 Mon Sep 17 00:00:00 2001 From: Philippe Weber Date: Tue, 24 May 2016 23:47:27 +0200 Subject: [PATCH] use new event api in generator filter template Fixes #5355 --- .../templates/filter-plugin/lib/logstash/filters/example.rb.erb | 2 +- .../templates/filter-plugin/spec/filters/example_spec.rb.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pluginmanager/templates/filter-plugin/lib/logstash/filters/example.rb.erb b/lib/pluginmanager/templates/filter-plugin/lib/logstash/filters/example.rb.erb index a16ef0ba736..ca5d9f7ca3b 100644 --- a/lib/pluginmanager/templates/filter-plugin/lib/logstash/filters/example.rb.erb +++ b/lib/pluginmanager/templates/filter-plugin/lib/logstash/filters/example.rb.erb @@ -34,7 +34,7 @@ class LogStash::Filters::<%= classify(plugin_name) %> < LogStash::Filters::Base if @message # Replace the event message with our message as configured in the # config file. - event["message"] = @message + event.set("message", @message) end # filter_matched should go in the last line of our successful code diff --git a/lib/pluginmanager/templates/filter-plugin/spec/filters/example_spec.rb.erb b/lib/pluginmanager/templates/filter-plugin/spec/filters/example_spec.rb.erb index ab4f7999377..5dceafe7fc4 100644 --- a/lib/pluginmanager/templates/filter-plugin/spec/filters/example_spec.rb.erb +++ b/lib/pluginmanager/templates/filter-plugin/spec/filters/example_spec.rb.erb @@ -15,7 +15,7 @@ describe LogStash::Filters::<%= classify(plugin_name) %> do sample("message" => "some text") do expect(subject).to include("message") - expect(subject['message']).to eq('Hello World') + expect(subject.get('message')).to eq('Hello World') end end end