Error writing to pipe, closing pipe


(Navneet Mathpal) #1

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


(Magnus B├Ąck) #2

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}.


(system) #3