diff --git a/CHANGELOG.md b/CHANGELOG.md index e68d6311..237b55b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 9.0.2 + - Add `terminate` processor support [#345](https://github.com/elastic/logstash-filter-elastic_integration/pull/345) + ## 9.0.1 - Introduces `proxy` param to support proxy [#320](https://github.com/elastic/logstash-filter-elastic_integration/pull/320) diff --git a/VERSION b/VERSION index 37ad5c8b..3beeadd4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.0.1 +9.0.2 diff --git a/spec/integration/elastic_integration_spec.rb b/spec/integration/elastic_integration_spec.rb index 6fb89b26..f8c053cb 100644 --- a/spec/integration/elastic_integration_spec.rb +++ b/spec/integration/elastic_integration_spec.rb @@ -1134,6 +1134,35 @@ def path; @path; end # end end + describe 'with terminate processor' do + let(:pipeline_processor) { + '{ + "terminate": { + "if": "ctx.error != null", + "tag": "terminated_ingest_pipeline" + } + }, + { + "append": { + "field": "append_field", + "value": ["integration", "test"] + } + }' + } + + it 'terminates the ingest pipeline' do + events = [LogStash::Event.new( + "message" => "Send message to pipeline which gets terminated.", + "error" => "This is intentionally placed error.", + "data_stream" => data_stream)] + + subject.multi_filter(events).each do |event| + expect(event.get("[@metadata][target_ingest_pipeline]")).to include("_none") + # intentionally placed append processor to check if it is not executed after terminate processor + expect(event.get("append_field")).to be_nil + end + end + end end context '#multi-pipeline execution' do diff --git a/src/main/java/co/elastic/logstash/filters/elasticintegration/EventProcessorBuilder.java b/src/main/java/co/elastic/logstash/filters/elasticintegration/EventProcessorBuilder.java index 84552d3c..7f1548dd 100644 --- a/src/main/java/co/elastic/logstash/filters/elasticintegration/EventProcessorBuilder.java +++ b/src/main/java/co/elastic/logstash/filters/elasticintegration/EventProcessorBuilder.java @@ -122,6 +122,7 @@ public EventProcessorBuilder() { org.elasticsearch.ingest.common.SetProcessor.TYPE, org.elasticsearch.ingest.common.SortProcessor.TYPE, org.elasticsearch.ingest.common.SplitProcessor.TYPE, + "terminate", // note: upstream constant is package-private org.elasticsearch.ingest.common.TrimProcessor.TYPE, org.elasticsearch.ingest.common.URLDecodeProcessor.TYPE, org.elasticsearch.ingest.common.UppercaseProcessor.TYPE,