# Change timezone for rotation

**URL:** <https://discuss.elastic.co/t/change-timezone-for-rotation/86580>\
**Category:** Logstash\
**Created:** [May 21, 2017, 4:42pm UTC](https://discuss.elastic.co/t/change-timezone-for-rotation/86580 "2017-05-21T16:42:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aled](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Aled](https://discuss.elastic.co/u/Aled)\
**Post date:** [May 21, 2017, 4:42pm UTC](https://discuss.elastic.co/t/change-timezone-for-rotation/86580/1 "2017-05-21T16:42:54Z")

</div>

Hello,

i'm using the date-based log rotation with the file output plugin.  
My problem is that the time is in UTC timezone and i'm in CEST/CET timezone.  
Consequence is that log are not rotated at midnight as expected.  
Does someone know how to change the timezone to correct this behavior (system date/time is correct) ?

Kr,

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 22, 2017, 6:15am UTC](https://discuss.elastic.co/t/change-timezone-for-rotation/86580/2 "2017-05-22T06:15:46Z")

</div>

The `%{+YYYY etc}` notation always reads the `@timestamp` field and always uses UTC. You'll have to use a ruby filter to create a separate field containing the local time and then reference that field in the file output's `path` option.

---

<div class="post-metadata">

**Author:** ![Aled](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Aled](https://discuss.elastic.co/u/Aled)\
**Post date:** [May 23, 2017, 2:15pm UTC](https://discuss.elastic.co/t/change-timezone-for-rotation/86580/3 "2017-05-23T14:15:44Z")

</div>

Thanks for your reply.  
"You'll have to use a ruby filter to create a separate field containing the local time and then reference that field in the file output's path option."  
As i am totally new to that, any advice on how to do that ?

Kr,

---

<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 20, 2017, 2:15pm UTC](https://discuss.elastic.co/t/change-timezone-for-rotation/86580/4 "2017-06-20T14:15:56Z")

</div>

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