Time in logstash is getting different due to daylight saving time

Hi i am using ruby code in logstash as below and getting the time one hour less.
ruby {
code => "event.set('current_window_end', Time.now());"
}

if current time is 10 :00 (in London) getting the time as 9:00. i have used below code to change the time but not woking.

date {
match => [ "current_window_end", "ISO8601" ]
timezone => "Europe/London"
target => "current_window_end"
}

can some one please help.

It is unclear what result you want. Does this help?

    ruby {
        init => 'require "tzinfo"'
        code => '
            # Sadly Time.now.zone returns EDT, which Timezone.get does not understand
            tz = TZInfo::Timezone.get("US/Eastern")
            now = Time.now()
            event.set("now-utc", now)
            event.set("now-local", tz.utc_to_local(now))
        '
    }

produces

   "now-utc" => 2021-03-31T17:32:58.514Z,
 "now-local" => 2021-03-31T13:32:58.514Z

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