# How to add locale timezone in metricbeat

**URL:** https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845
**Category:** Beats
**Tags:** metricbeat
**Created:** [June 28, 2018, 6:37pm UTC](https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845 "2018-06-28T18:37:40Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![r.ganeshbabu](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r.ganeshbabu](https://discuss.elastic.co/u/r.ganeshbabu)
#### Post date: [June 28, 2018, 6:37pm UTC](https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845/1 "2018-06-28T18:37:40Z")

</div>

Hi All,

I have installed metricbeat 6.3.0 in my windows 8 and I configured few metricsets in system module and I am sending data to logstash output and also I have the enable the **add\_locale** in the metricbeat.yml as like below,

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/d/fdd0523c8c9db6c42b0ac745cf92fc89c5b67d4b.png)

Please correct me if my configuration is wrong.

Since the timestamp field value is not matching with my machine local time zone and I want the timestamp value to be changed from UTC to local time zone value

Please let me know your thoughts it would be very helpful.

Regards,  
Ganeshbabu R

---

<div class="post-metadata">

### Author: ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)
#### Post date: [June 28, 2018, 7:41pm UTC](https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845/2 "2018-06-28T19:41:18Z")

</div>

The correct configuration to have Metricbeat add the locale name in `beat.timezone` is

```auto
processors:
- add_locale:
    format: abbreviation

```

But why do you need this? This processor is usually only needed when the data contained in the event has some relation to the timezone (e.g. has timestamps in logs without timezones or you are interpreting whether a user logon occurred during normal working hours).

Are you trying to change `@timezone` from UTC to your local timezone? If so, the first please see the advice [here](https://discuss.elastic.co/t/how-to-set-timestamp-timezone/28401/2?u=andrewkroh).

---

<div class="post-metadata">

### Author: ![r.ganeshbabu](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r.ganeshbabu](https://discuss.elastic.co/u/r.ganeshbabu)
#### Post date: [June 29, 2018, 8:17am UTC](https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845/3 "2018-06-29T08:17:58Z")

</div>

> [@andrewkroh](#):
>
> The correct configuration to have Metricbeat add the locale name in `beat.timezone` is

@andrewkroh

I have configured the beat.timezone in metricbeat.yml as like below,

**With format as abbreviation**

![image](https://us1.discourse-cdn.com/elastic/original/3X/c/b/cb0cff1b7cdcda18a535d5f4c5c6fb17bc2262ab.png)

**With format as offset**

![image](https://us1.discourse-cdn.com/elastic/original/3X/d/c/dc0be0d2b748e3cef3a29320b9c6005b8c0af706.png)

I tried both of them separately but the value of the timestamp is showing in the UTC. Since the metricbeat is running in my machine which is in IST, so I want the timestamp value to be in IST.

Please correct me if my syntax is wrong in the configuration.

> [@andrewkroh](#):
>
> But why do you need this?

I am sending the metricbeat data to graylog through logstash output and in my graylog i have created beats input so the data will receive to that port successfully.

When the data is sending to graylog it will check the timestamp field and if the timestamp does not contain timezone information it will assume that this timestamp without timezone information is UTC so I don't want that to happen.

So that's why I am trying to send data with timezone. Please let me your thoughts it would be very helpful.

Thanks,  
Ganeshbabu R

---

<div class="post-metadata">

### Author: ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)
#### Post date: [June 29, 2018, 1:00pm UTC](https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845/4 "2018-06-29T13:00:51Z")

</div>

I think you are not understanding what the `add_locale` processor does.

- It does not change the timezone of @timestamp from UTC to the host's local timezone.
- It does not accept `beat.timezone` as a parameter. (see my example config above or the [docs](https://www.elastic.co/guide/en/beats/metricbeat/current/add-locale.html)).
- It does determine the host's currently configured timezone and add a new field to the event named `beat.timezone` that has a value containing the either the timezone abbreviation or offset from UTC in `hh.mm` format.
- There is no way to change `@timezone` to anything other than UTC on the Beat side.

> [@r.ganeshbabu](#):
>
> When the data is sending to graylog it will check the timestamp field and if the timestamp does not contain timezone information it will assume that this timestamp without timezone information is UTC so I don't want that to happen.

The `@timestamp` values produced by Beats are an ISO 8601 format of `2006-01-02T15:04:05.000Z`. They do contain a timezone as indicated by the `Z` for Zulu time (UTC). So why not just pass this through to Graylog as is?

I don't know of built-in filters for changing `@timestamp` to a different timezone (this is a common task). But I found some ruby code [here](https://stackoverflow.com/a/23797006) that might work.

---

<div class="post-metadata">

### Author: ![r.ganeshbabu](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r.ganeshbabu](https://discuss.elastic.co/u/r.ganeshbabu)
#### Post date: [July 3, 2018, 12:29pm UTC](https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845/5 "2018-07-03T12:29:44Z")

</div>

> [@andrewkroh](#):
>
> It does determine the host's currently configured timezone and add a new field to the event named `beat.timezone` that has a value containing the either the timezone abbreviation or offset from UTC in `hh.mm` format.

@andrewkroh  
Thanks for the detailed clarification about beat.timezone. Now I am clearly understood how add\_locale is works.

> [@andrewkroh](#):
>
> The `@timestamp` values produced by Beats are an ISO 8601 format of `2006-01-02T15:04:05.000Z` . They do contain a timezone as indicated by the `Z` for Zulu time (UTC). So why not just pass this through to Graylog as is?

After the clarification I passed the same @timestamp value to Graylog.

Regards,  
Ganeshbabu R

---

<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: [July 31, 2018, 12:29pm UTC](https://discuss.elastic.co/t/how-to-add-locale-timezone-in-metricbeat/137845/6 "2018-07-31T12:29:48Z")

</div>

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