# Error writing to pipe, closing pipe

**URL:** <https://discuss.elastic.co/t/error-writing-to-pipe-closing-pipe/31863>\
**Category:** Logstash\
**Created:** [October 8, 2015, 3:01pm UTC](https://discuss.elastic.co/t/error-writing-to-pipe-closing-pipe/31863 "2015-10-08T15:01:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)\
**Post date:** [October 8, 2015, 3:01pm UTC](https://discuss.elastic.co/t/error-writing-to-pipe-closing-pipe/31863/1 "2015-10-08T15:01:20Z")

</div>

Hi ,  
I am trying to call a java file using logstash in output using pipe .

> input  
> {  
> stdin {}  
> }

> filter  
> {  
> ruby  
> {  
> code =\> "  
> event['id']=File.open('/elkt/software/bkup/logstash-1.5.4/bin/wid.id', &:readline)  
> "  
> add\_field =\> ["id", "%{id}"]

> ```
> }
> 
> ```
> 
> }

> output  
> {  
> pipe {  
> command =\> "java HelloWorld %{id}"  
> }  
> stdout {codec =\> rubydebug}  
> }

passing the parameters it is showing this error saying that

> Error writing to pipe, closing pipe. {:command=\>"java HelloWorld '12321321\n", :pipe=\>#\<PipeWrapper:0x4bb4e0e2 @pipe=#\<IO:fd 422\>, @active=true\>, :level=\>:error}

id was :-12321321

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 8, 2015, 7:40pm UTC](https://discuss.elastic.co/t/error-writing-to-pipe-closing-pipe/31863/2 "2015-10-08T19:40:03Z")

</div>

> add\_field =\> ["id", "%{id}"]

This isn't necessary.

> command =\> "java HelloWorld %{id}"

This assumes that HelloWorld.class is in the current directory (or otherwise in the classpath) when the JVM is started. I wouldn't assume anything about the current directory. Try changing the command to `cd /some/path && java HelloWorld %{id}`.

---

<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:** [July 6, 2017, 5:27am UTC](https://discuss.elastic.co/t/error-writing-to-pipe-closing-pipe/31863/3 "2017-07-06T05:27:07Z")

</div>

Closed on July 6, 2017, 5:27am UTC


