Day of Week from timestamp using ruby code

Hi,

I am trying to get the day of the week(Sun,Mon..) from the timestamp field in the log with the below code:

ruby {
code => 'event.set("day_of_week", event.get('@timestamp').time.strftime '%a')'
}

But getting " ERROR logstash.agent - fetched an invalid config".
Please suggest.

Don't mix single and double quotes in your Ruby snippet. If you use single quotes for the code option then you should only use double quotes in the code, or vice versa.

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