Try to convert UTC timestamp to IST in logstash

Hi ,

I need to convert the log UTC to my local time in IST .

Used ruby Filter to convert to local time .

My filter in logstash.yaml file
filter {
ruby {

code => "event.set('new_date', event.get('[@timestamp]').time.localtime.strftime('%Y-%m-%d %H:%M:%S.%L'))"


"@timestamp" => 2021-05-06T09:30:47.785Z"
"new_date" => "2021-05-06 09:30:47.785",

I am not seeing any difference after conversion .
Follow this How to set @timestamp timezone? also but no use for my scenario.

system time
Local time: Thu 2021-05-06 15:06:50 IST
Universal time: Thu 2021-05-06 09:36:50 UTC
RTC time: Thu 2021-05-06 09:36:52
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

Any kind of help is much appreciated .

Thank you in advance .

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