Hi,
I have a log with events from different timezones, where the timestamps are all UTC. I also have the names of the timezones, e.g. "Europe/Madrid". I want to check if the event occurred during office hours in the local time zone, i.e. first convert the timestamp to the local timezone and then check if the converted time is between , for example, 9 and 17. Assuming 7-day work-week. I am looking for something like this:
ruby {
code =>
"
localTime = event.get('timestamp').time.convert( event.get('timeZone') )
if localTime.hour > 8 && localTime.hour < 18
event.set('duringOfficeHours', true)
end
"
}
where the convert-function is unknown to me, i.e. what I am looking for. I have seen a reference to a DateTime.in_time_zone method in some forums, but it does not seem to exist in my logstash 5.2.2.
Is this possible to accomplish? Thanks in advance!