Logstash ruby convert seconds to milliseconds

I'm trying to convert responsetime from nginx access logs which is in seconds to milliseconds using ruby.

I was able to successfully GROK the access log.

grok {
match => { "message" => "%{IPV4:clientip} - - [%{HTTPDATE:requesttimestamp}] "%{WORD:httpmethod} /" %{NUMBER:responsecode:int} %{NUMBER:responsesize:int} "-" "-" "-" "%{NUMBER:responsetimems:float}""}
}
ruby {
code => "event.set('responsetimems', event.get('responsetimems').to_i * 1000))"
}

Am i doing anything wrong here ?

That looks correct. What does an example event coming out of Logstash look like?

I fixed it. Its an extra ) at the end. Thanks.

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