Ruby code not getting executed

Hi,

The ruby code in BOLD is not getting executed. Any idea? The first ruby code is getting executed and tags are getting added but not the second one.

filter {
csv {
separator => ","
columns => ["tds_audittimestamp" , "msg_id", "ext_id", "source_system", "msg_type", "msg_status", "msg_timestamp", "effective_timestamp", "temp_timestamp", "tracking_id", "execution_timestamp", "orginating_system","trade_insertion_at_source","workflow_status"]
}
date{
match => [ "trade_insertion_at_source", "yyyy/MM/dd HH:mm:ss.SSS" ]
timezone => "UTC"
target => "trade_insertion_at_source"
}
date{
match => [ "execution_timestamp", "yyyyMMdd HH:mm:ss" ]
timezone => "UTC"
target => "execution_timestamp"
}
date{
match => [ "effective_timestamp", "UNIX_MS"]
target => "effective_timestamp"
}
date{
match => [ "tds_audittimestamp", "UNIX_MS"]
target => "tds_audittimestamp"
}
date{
match => [ "temp_timestamp", "UNIX_MS"]
target => "temp_timestamp"
}
#Generate end-2-end latency for messages with below criteria only.
if [msg_type] == "ON_MESSAGE" and [msg_status] == "END"
{
ruby {
init => "require 'time'"
code => "
startdatetime = Time.iso8601(event.get('execution_timestamp').to_s).to_i;
enddatetime = Time.iso8601(event.get('tds_audittimestamp').to_s).to_i;
event.set('e2e_latency_seconds',enddatetime - startdatetime);
"
add_tag => ["sabre_end"]
}
}

if [msg_type] == "ON_MESSAGE" and [msg_status"] == "START"
{
ruby {
code => ""
add_tag => ["sabre_start"]
}
}
}

Looks like you have a " too much there?

Ouch. I have a bad eye. Sorry about that. Fixed and working now.

Is there a desktop software to write logstash config which can point out such mistakes?

Not that I know of.

Thanks mate!

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