# How to change index rotation timezone for Elasticsearch 8.6 for UTC to localtimezone

**URL:** https://discuss.elastic.co/t/how-to-change-index-rotation-timezone-for-elasticsearch-8-6-for-utc-to-localtimezone/348411
**Category:** Elasticsearch
**Created:** [December 1, 2023, 9:33am UTC](https://discuss.elastic.co/t/how-to-change-index-rotation-timezone-for-elasticsearch-8-6-for-utc-to-localtimezone/348411 "2023-12-01T09:33:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pix9](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pix9/32/128388_2.png) [@pix9](https://discuss.elastic.co/u/pix9)
#### Post date: [December 1, 2023, 9:33am UTC](https://discuss.elastic.co/t/how-to-change-index-rotation-timezone-for-elasticsearch-8-6-for-utc-to-localtimezone/348411/1 "2023-12-01T09:33:26Z")

</div>

Hi everyone,

I am facing an issue while running queries on Elasticsearch, we are unable to fetch data between 12:00 AM to 05:30 AM, issue no data can be retrived from index between given time.

Upon further investigation it has been discovered that issue occurs mainly because timezone difference between UTC and local timezone (+05:30 HRS).

we run the queries on specific index created for that particular day (e.g my\_index-YYYY-mm-dd), as we use +05:30 HRS timezone, date changes around 5 hours 30 minutes earlier on our servers whereas on Elasticsearch cluster data keep on populating in previous day's index.

I want my Elasticsearch cluster to rotate the index based on localtime zone this will allow us to run queries more efficiently.

Also I would like to know if we in any-way change timezone on Elasticsearch Cluster will it effect other components of ELK stack as mentioned below?

1. Logstash
2. Kibana
3. Filebeat

(if yes!, please guide me to document material where I can read more about it.)

Thank you.

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [December 1, 2023, 12:26pm UTC](https://discuss.elastic.co/t/how-to-change-index-rotation-timezone-for-elasticsearch-8-6-for-utc-to-localtimezone/348411/2 "2023-12-01T12:26:44Z")

</div>

> [@pix9](#):
>
> I want my Elasticsearch cluster to rotate the index based on localtime zone this will allow us to run queries more efficiently.

That's not possible, both Logstash and Elasticsearch use date time in UTC and this can not be changed.

If your Logstash has an output like `index-%{+YYYY-MM-dd}` it will use the value of the `@timestamp` field to extract the pattern `YYYY-MM-dd`, and this will always be in UTC.

How are you parsing the field `@timestamp`? It is getting the value of the date in your logs correctly, with the timezone offset?

Please share how you are collecting logs, how you are parsing them and some sample messages.

---

<div class="post-metadata">

### Author: ![pix9](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pix9/32/128388_2.png) [@pix9](https://discuss.elastic.co/u/pix9)
#### Post date: [December 1, 2023, 1:04pm UTC](https://discuss.elastic.co/t/how-to-change-index-rotation-timezone-for-elasticsearch-8-6-for-utc-to-localtimezone/348411/3 "2023-12-01T13:04:20Z")

</div>

> How are you parsing the field `@timestamp` ? It is getting the value of the date in your logs correctly, with the timezone offset?

Yes @timestamp field get populated which reflects localtime on Kibana interface.

Still Not sure if it's Kibana which is displaying the field as per UTC.

We are using filebeat to push access logs into cluster which are parced via Logstash.

Do we have any way to check what timezone is getting recorded on these fields?

> Please share how you are collecting logs, how you are parsing them and some sample messages.

what sample message are you expecting?

Raw log or json out from kibana? or some screenshot of sample document?

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [December 1, 2023, 1:49pm UTC](https://discuss.elastic.co/t/how-to-change-index-rotation-timezone-for-elasticsearch-8-6-for-utc-to-localtimezone/348411/4 "2023-12-01T13:49:57Z")

</div>

> [@pix9](#):
>
> Yes @timestamp field get populated which reflects localtime on Kibana interface.

But how are you populating it?

> [@pix9](#):
>
> Still Not sure if it's Kibana which is displaying the field as per UTC.

Kibana will convert all Date fields from UTC to the Browser timezone.

> [@pix9](#):
>
> Do we have any way to check what timezone is getting recorded on these fields?

Logstash date filter will always create a UTC field, if your date string does not have any timezone information, Logstash will assume that this is already in UTC and this can lead to some issues.

You need to share your configuration.

> [@pix9](#):
>
> Raw log or json out from kibana?

You need to share the raw logs and your logstash configuration.

---

<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: [December 29, 2023, 1:50pm UTC](https://discuss.elastic.co/t/how-to-change-index-rotation-timezone-for-elasticsearch-8-6-for-utc-to-localtimezone/348411/5 "2023-12-29T13:50:30Z")

</div>

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