# How to add a new Event in logstash java filter

**URL:** <https://discuss.elastic.co/t/how-to-add-a-new-event-in-logstash-java-filter/218959>\
**Category:** Logstash\
**Created:** [February 12, 2020, 11:22am UTC](https://discuss.elastic.co/t/how-to-add-a-new-event-in-logstash-java-filter/218959 "2020-02-12T11:22:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert.hauser](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@robert.hauser](https://discuss.elastic.co/u/robert.hauser)\
**Post date:** [February 12, 2020, 11:22am UTC](https://discuss.elastic.co/t/how-to-add-a-new-event-in-logstash-java-filter/218959/1 "2020-02-12T11:22:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 11, 2020, 11:22am UTC](https://discuss.elastic.co/t/how-to-add-a-new-event-in-logstash-java-filter/218959/2 "2020-03-11T11:22:47Z")

</div>

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