File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
src/main/java/co/elastic/logstash/filters/elasticintegration Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1134,6 +1134,35 @@ def path; @path; end
11341134 # end
11351135 end
11361136
1137+ describe 'with terminate processor' do
1138+ let ( :pipeline_processor ) {
1139+ '{
1140+ "terminate": {
1141+ "if": "ctx.error != null",
1142+ "tag": "terminated_ingest_pipeline"
1143+ }
1144+ },
1145+ {
1146+ "append": {
1147+ "field": "append_field",
1148+ "value": ["integration", "test"]
1149+ }
1150+ }'
1151+ }
1152+
1153+ it 'terminates the ingest pipeline' do
1154+ events = [ LogStash ::Event . new (
1155+ "message" => "Send message to pipeline which gets terminated." ,
1156+ "error" => "This is intentionally placed error." ,
1157+ "data_stream" => data_stream ) ]
1158+
1159+ subject . multi_filter ( events ) . each do |event |
1160+ expect ( event . get ( "[@metadata][target_ingest_pipeline]" ) ) . to include ( "_none" )
1161+ # intentionally placed append processor to check if it is not executed after terminate processor
1162+ expect ( event . get ( "append_field" ) ) . to be_nil
1163+ end
1164+ end
1165+ end
11371166 end
11381167
11391168 context '#multi-pipeline execution' do
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ public EventProcessorBuilder() {
122122 org .elasticsearch .ingest .common .SetProcessor .TYPE ,
123123 org .elasticsearch .ingest .common .SortProcessor .TYPE ,
124124 org .elasticsearch .ingest .common .SplitProcessor .TYPE ,
125+ "terminate" , // note: upstream constant is package-private
125126 org .elasticsearch .ingest .common .TrimProcessor .TYPE ,
126127 org .elasticsearch .ingest .common .URLDecodeProcessor .TYPE ,
127128 org .elasticsearch .ingest .common .UppercaseProcessor .TYPE ,
You can’t perform that action at this time.
0 commit comments