# Different timezones for same kind of logs

**URL:** <https://discuss.elastic.co/t/different-timezones-for-same-kind-of-logs/114502>\
**Category:** Logstash\
**Created:** [January 8, 2018, 11:05am UTC](https://discuss.elastic.co/t/different-timezones-for-same-kind-of-logs/114502 "2018-01-08T11:05:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrikantgulia](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@shrikantgulia](https://discuss.elastic.co/u/shrikantgulia)\
**Post date:** [January 8, 2018, 11:05am UTC](https://discuss.elastic.co/t/different-timezones-for-same-kind-of-logs/114502/1 "2018-01-08T11:05:06Z")

</div>

I have two kind of access being taken from two different locations and on applying filter I am not able to replace my @timestamp with timestamp  
my logs are(with different timezones)

1.IP - - [12/Jun/2017:11:52:13 +0200] "GET / HTTP/1.1" 200 1165  
2.IP - - [08/Jan/2018:04:54:41 +0100] "GET /manager HTTP/1.1" 302 -  
and my filter are as below  
if [type] == "access1" {  
grok {  
match =\> {"message" =\> "%{IP:ip}._[%{MONTHDAY:day}/%{MONTH:month}/%{YEAR:year}:%{TIME:time}\s_%{ISO8601\_TIMEZONE:timezone}]\s\*"%{WORD:request}\s\*._"\s_(?\d+)"}  
}  
mutate {  
add\_field =\> {  
"timestamp" =\> "%{year}-%{month}-%{day} %{time} %{timezone}"  
}  
}  
date {  
match =\> ["timestamp", "yyyy-MMM-dd HH:mm:ss", "ISO8601"]  
target =\> "@timestamp"  
}  
}

a help would be really appreciated

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [January 9, 2018, 9:40am UTC](https://discuss.elastic.co/t/different-timezones-for-same-kind-of-logs/114502/2 "2018-01-09T09:40:45Z")

</div>

The first pattern in your date filter does match for the timezone.

You can use the `add_field` directly in the grok filter - it will only add the field if the grok succeeds otherwise put the mutate and date inside a conditional block that checks for not grok parse failure.

---

<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:** [February 6, 2018, 9:40am UTC](https://discuss.elastic.co/t/different-timezones-for-same-kind-of-logs/114502/3 "2018-02-06T09:40:52Z")

</div>

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