# The time zone of the time stamp is incorrect

**URL:** <https://discuss.elastic.co/t/the-time-zone-of-the-time-stamp-is-incorrect/252081>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-monitoring, elastic-stack-alerting\
**Created:** [October 14, 2020, 5:17pm UTC](https://discuss.elastic.co/t/the-time-zone-of-the-time-stamp-is-incorrect/252081 "2020-10-14T17:17:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan\_David\_Jaramillo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_david_jaramillo/32/76831_2.png) [@Juan\_David\_Jaramillo](https://discuss.elastic.co/u/Juan_David_Jaramillo)\
**Post date:** [October 14, 2020, 5:17pm UTC](https://discuss.elastic.co/t/the-time-zone-of-the-time-stamp-is-incorrect/252081/1 "2020-10-14T17:17:19Z")

</div>

**I have a problem with the time stamp, I have the correct date, but the time is wrong, I have like 5 hours in advance, the date is correct but I do not know why I have another time of execution, I put the time zone but it does not serve me continues to leave the time forward , I need to have the time zone UTC-5 America/Bogota.**

**this is the code**

```auto
{
  "trigger": {
    "schedule": {
      "interval": "1h"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "agenteallot*"
        ],
        "rest_total_hits_as_int": true,
        "body": {
          "size": 0,
          "query": {
            "bool": {
              "filter": {
                "range": {
                  "@timestamp": {
                    "gte": "{{ctx.trigger.scheduled_time}}||-5m",
                    "lte": "{{ctx.trigger.scheduled_time}}",
                    "formats": [
                      "dd/MM/yyyy HH:mm:ss"
                    ],
                    "timezone": "UTC-5"
                  }
                }
              }
            }
          },
          "aggs": {
            "bucketAgg": {
              "query": {
                "bool": {
                  "filter": {
                    "term": {
                      "monitor.name.keyword": "01-1-CAV30328203-DATOS-PPAL-2.7G-99.98"
                    }
                  }
                }
              },
              "aggs": {
                "metricAgg": {
                  "max": {
                    "field": "summary.up"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "script": {
      "source": "ArrayList arr = ctx.payload.aggregations.bucketAgg.buckets; for (int i = 0; i < arr.length; i++) { if (arr[i]['metricAgg'].value >= params.threshold) { return true; } } return false;",
      "lang": "painless",
      "params": {
        "threshold": 0.8
      }
    }
  },
  "actions": {
    "email_1": {
      "email": {
        "profile": "standard",
        "attach_data": {
          "format": "yaml"
        },
        "to": [
          "juan.jaramillo@megadvantage.com",
          "victor.vera@megadvantage.com"
        ],
        "subject": "{{ctx.metadata.name}} {{ctx.payload.results}}",
        "body": {
          "text": """Buen dia, Adjunto registro del reporte.

 ⚠️ALERTA NODO!!! El siguiente enlace perdió la conexión. 

 Estado: Down🔴 

 Nombre del Enlace: {{ctx.payload.results}} 

 🕧Hora: {{ctx.execution_time}} {{ctx.result.execution_time}}

 Área: Networking 

 🔔Mensaje Alerta: El enlace ha dejado de responder. Responder correo a telecomunicaciones@udistrital.edu.co 

 Ingrese aquí para más información: https://72dfe17217744236af40cc31b704a664.us-central1.gcp.cloud.es.io:9243/s/distrital/app/uptime#"""
        }
      }
    }
  },
  "transform": {
    "script": {
      "source": "HashMap result = new HashMap(); ArrayList arr = ctx.payload.aggregations.bucketAgg.buckets; ArrayList filteredHits = new ArrayList(); for (int i = 0; i < arr.length; i++) { HashMap filteredHit = new HashMap(); filteredHit.key = arr[i].key; filteredHit.value = arr[i]['metricAgg'].value; if (filteredHit.value >= params.threshold) { filteredHits.add(filteredHit); } } result.results = filteredHits; return result;",
      "lang": "painless",
      "params": {
        "threshold": 0.8
      }
    }
  }
}

```

**this is the error...**

 ![5 horas adelantado](https://us1.discourse-cdn.com/elastic/original/3X/9/1/91494fac6ae6b73b941e626b348e0a127a805ca8.png)

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [October 14, 2020, 6:13pm UTC](https://discuss.elastic.co/t/the-time-zone-of-the-time-stamp-is-incorrect/252081/2 "2020-10-14T18:13:27Z")

</div>

it is automatically converted to UTC time.

and kibana will convert it back to your local timezone

what you are seeing is correct.

go to kibana, create simple visulization, use X axis as @timestamp and you will see it is 5 hour behind on what you have display.

---

<div class="post-metadata">

**Author:** ![Juan\_David\_Jaramillo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_david_jaramillo/32/76831_2.png) [@Juan\_David\_Jaramillo](https://discuss.elastic.co/u/Juan_David_Jaramillo)\
**Post date:** [October 14, 2020, 9:24pm UTC](https://discuss.elastic.co/t/the-time-zone-of-the-time-stamp-is-incorrect/252081/3 "2020-10-14T21:24:14Z")

</div>

ok, very thanks, men!!

---

<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:** [November 11, 2020, 9:24pm UTC](https://discuss.elastic.co/t/the-time-zone-of-the-time-stamp-is-incorrect/252081/4 "2020-11-11T21:24:24Z")

</div>

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