# Try to convert UTC timestamp to IST in logstash

**URL:** https://discuss.elastic.co/t/try-to-convert-utc-timestamp-to-ist-in-logstash/272268
**Category:** Logstash
**Created:** [May 6, 2021, 9:36am UTC](https://discuss.elastic.co/t/try-to-convert-utc-timestamp-to-ist-in-logstash/272268 "2021-05-06T09:36:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sudheendra](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@sudheendra](https://discuss.elastic.co/u/sudheendra)
#### Post date: [May 6, 2021, 9:36am UTC](https://discuss.elastic.co/t/try-to-convert-utc-timestamp-to-ist-in-logstash/272268/1 "2021-05-06T09:36:21Z")

</div>

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'))"

}

output  
"@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?](https://discuss.elastic.co/t/how-to-set-timestamp-timezone/28401) also but no use for my scenario.

system time  
timedatectl  
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 .

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 3, 2021, 9:37am UTC](https://discuss.elastic.co/t/try-to-convert-utc-timestamp-to-ist-in-logstash/272268/2 "2021-06-03T09:37:16Z")

</div>

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