Hi all,
I need to escalate events towards a separate output. The events are received in UTC timezone and need to be converted to Europe/Amsterdam. I've created a date filter to add additional two hours and ruby filter to put it back in the correct format. But I' can't get it working
I have the following code and tried the following configs. Inspired on the event API documentation, but better ideas are welcome .
Tried various options like event.sprintf, event.get with %{MMM dd HH:mm:ss} variable and even .strftime.
Below a the code that isn' working.
filter {
date {
locale=> "en"
match => ["timestamp", "MMM dd HH:mm:ss"]
timezone => "Etc/GMT+2"
}
ruby {
#code=> "event['localtimestamp'] = event.sprintf('%{MMM dd HH:mm:ss}')"
#code => "event.set('localtimestamp', event.sprintf(%{MMM dd HH:mm:ss}))"
#code => "event.set('localtimestamp', event.get('%{MMM dd HH:mm:ss}'))"
code => "event.set('localtimestamp', event.get(%{MMM dd HH:mm:ss}))"
#code => "event.set('localtimestamp', event.get('@timestamp').strftime('%Y-%m-%d_%H-%M-%S'))"
}
}
Does anyone has an idea to convert the time from UTC to Europe/Amsterdam fully or partly ( only formatting) with Ruby filter + event API usage ?