# Convert Different timezones syslog time to datetime format

**URL:** <https://discuss.elastic.co/t/convert-different-timezones-syslog-time-to-datetime-format/246352>\
**Category:** Logstash\
**Created:** [August 25, 2020, 7:39pm UTC](https://discuss.elastic.co/t/convert-different-timezones-syslog-time-to-datetime-format/246352 "2020-08-25T19:39:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavani\_Reddy](https://avatars.discourse-cdn.com/v4/letter/p/5f9b8f/32.png) [@Pavani\_Reddy](https://discuss.elastic.co/u/Pavani_Reddy)\
**Post date:** [August 25, 2020, 7:39pm UTC](https://discuss.elastic.co/t/convert-different-timezones-syslog-time-to-datetime-format/246352/1 "2020-08-25T19:39:25Z")

</div>

I have following timestamp with different timezones in the log messages.  
Aug 11 03:31:12.942 UTC  
Aug 11 04:31:12.819 GMT  
Aug 10 22:31:51.207 CST  
Aug 10 04:31:38.897 PAC  
Aug 10 22:31:13.210 CDT  
Aug 11 03:31:13.048 PST  
Aug 10 23:31:12.940 EST  
Aug 10 23:31:12.753 EDT

Can someone help me ,how to convert them to datetime format (yyyy-MM-dd HH:mm:ss)?

Thanks in advance,  
Pavani

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 25, 2020, 8:18pm UTC](https://discuss.elastic.co/t/convert-different-timezones-syslog-time-to-datetime-format/246352/2 "2020-08-25T20:18:41Z")

</div>

You can parse those using a date filter.

```
 date { match => ["someField", "MMM dd HH:mm:ss.SSS ZZZ"] }

```

You will need to modify the timezones to unambiguous values before calling the date filter, which you can do using mutate+gsub. For example,

```
mutate { gsub => ["someField", "CDT", "CST6CDT", "somefield", "EST", "EST5EDT"] }

```

(or "Cuba/Havana" if CDT refers to Cuba daylight time).

Also, if your dates do not have a year in them then logstash will guess, and sometimes it will guess wrong. See issues [137](https://github.com/logstash-plugins/logstash-filter-date/issues/137), [100](https://github.com/logstash-plugins/logstash-filter-date/issues/100), and the long discussion of [51](https://github.com/logstash-plugins/logstash-filter-date/issues/51).

---

<div class="post-metadata">

**Author:** ![Pavani\_Reddy](https://avatars.discourse-cdn.com/v4/letter/p/5f9b8f/32.png) [@Pavani\_Reddy](https://discuss.elastic.co/u/Pavani_Reddy)\
**Post date:** [August 26, 2020, 2:57pm UTC](https://discuss.elastic.co/t/convert-different-timezones-syslog-time-to-datetime-format/246352/3 "2020-08-26T14:57:55Z")

</div>

Thanks @Badger,  
But, I have total eight different timezones

Aug 11 03:31:12.942 UTC  
Aug 11 04:31:12.819 GMT  
Aug 10 22:31:51.207 CST  
Aug 10 04:31:38.897 PAC  
Aug 10 22:31:13.210 CDT  
Aug 11 03:31:13.048 PST  
Aug 10 23:31:12.940 EST  
Aug 10 23:31:12.753 EDT

for PST,CST,PAC timezones what is the unambigous values , because the three timezones gives "\_dateparsefailure" tag, Please help me!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 26, 2020, 4:17pm UTC](https://discuss.elastic.co/t/convert-different-timezones-syslog-time-to-datetime-format/246352/4 "2020-08-26T16:17:41Z")

</div>

Given that they are ambiguous I cannot say how you should replace them, but the list of unambiguous timezones is [here](http://joda-time.sourceforge.net/timezones.html).

---

<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:** [September 23, 2020, 4:17pm UTC](https://discuss.elastic.co/t/convert-different-timezones-syslog-time-to-datetime-format/246352/5 "2020-09-23T16:17:46Z")

</div>

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