How to add a new Event in logstash java filter

Hi,

i cloned the incoming event in the filter, but I do not know how to add it.

i have tried.
events.add(newEvent);

I get an exception:
java.util.ConcurrentModificationException: null
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) ~[?:1.8.0_232]
at java.util.ArrayList$Itr.next(ArrayList.java:859) ~[?:1.8.0_232]
at de.tm.logstash.filters.Filter.filter(Filter.java:91) ~[logstash-filter-filter-1.0.0.jar:?]
at org.logstash.config.ir.compiler.JavaFilterDelegatorExt.doMultiFilter(JavaFilterDelegatorExt.java:63) ~[logstash-core.jar:?]
at org.logstash.config.ir.compiler.AbstractFilterDelegatorExt.multiFilter(AbstractFilterDelegatorExt.java:115) ~[logstash-core.jar:?]
at org.logstash.generated.CompiledDataset2.compute(Unknown Source) ~[?:?]
at org.logstash.generated.CompiledDataset3.compute(Unknown Source) ~[?:?]
at org.logstash.generated.CompiledDataset4.compute(Unknown Source) ~[?:?]
at org.logstash.execution.WorkerLoop.run(WorkerLoop.java:64) [logstash-core.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:36) [jruby-complete-9.2.8.0.jar:?]
at usr.local.Cellar.logstash.$7_dot_5_dot_2.libexec.logstash_minus_core.lib.logstash.java_pipeline.RUBY$block$start_workers$5(/usr/local/Cellar/logstash/7.5.2/libexec/logstash-core/lib/logstash/java_pipeline.rb:262) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:136) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:77) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.runtime.Block.call(Block.java:129) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.RubyProc.call(RubyProc.java:295) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.RubyProc.call(RubyProc.java:274) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.RubyProc.call(RubyProc.java:270) [jruby-complete-9.2.8.0.jar:?]
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:105) [jruby-complete-9.2.8.0.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
warning: thread "[main]>worker4" terminated with exception (report_on_exception is true):
java.lang.IllegalStateException: java.util.ConcurrentModificationException
at org.logstash.execution.WorkerLoop.run(org/logstash/execution/WorkerLoop.java:85)
at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:440)
at org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:304)
at usr.local.Cellar.logstash.$7_dot_5_dot_2.libexec.logstash_minus_core.lib.logstash.java_pipeline.start_workers(/usr/local/Cellar/logstash/7.5.2/libexec/logstash-core/lib/logstash/java_pipeline.rb:262)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:295)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:274)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:270)
at java.lang.Thread.run(java/lang/Thread.java:748)
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
at java.util.ArrayList$Itr.next(ArrayList.java:859)
at de.tm.logstash.filters.Filter.filter(Filter.java:91)
at org.logstash.config.ir.compiler.JavaFilterDelegatorExt.doMultiFilter(JavaFilterDelegatorExt.java:63)
at org.logstash.config.ir.compiler.AbstractFilterDelegatorExt.multiFilter(AbstractFilterDelegatorExt.java:115)
at org.logstash.generated.CompiledDataset2.compute(Unknown Source)
at org.logstash.generated.CompiledDataset3.compute(Unknown Source)
at org.logstash.generated.CompiledDataset4.compute(Unknown Source)
at org.logstash.execution.WorkerLoop.run(WorkerLoop.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440)
at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304)
at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:36)
at usr.local.Cellar.logstash.$7_dot_5_dot_2.libexec.logstash_minus_core.lib.logstash.java_pipeline.RUBY$block$start_workers$5(/usr/local/Cellar/logstash/7.5.2/libexec/logstash-core/lib/logstash/java_pipeline.rb:262)
at org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:136)
at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:77)
at org.jruby.runtime.Block.call(Block.java:129)
at org.jruby.RubyProc.call(RubyProc.java:295)
at org.jruby.RubyProc.call(RubyProc.java:274)
at org.jruby.RubyProc.call(RubyProc.java:270)
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:105)
at java.lang.Thread.run(Thread.java:748)
[

I need some help

Thanks

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.