# Time stamp is wrong

**URL:** <https://discuss.elastic.co/t/time-stamp-is-wrong/251957>\
**Category:** Elasticsearch\
**Created:** [October 13, 2020, 7:17pm UTC](https://discuss.elastic.co/t/time-stamp-is-wrong/251957 "2020-10-13T19:17:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor.vera](https://avatars.discourse-cdn.com/v4/letter/v/898d66/32.png) [@victor.vera](https://discuss.elastic.co/u/victor.vera)\
**Post date:** [October 13, 2020, 7:17pm UTC](https://discuss.elastic.co/t/time-stamp-is-wrong/251957/1 "2020-10-13T19:17:51Z")

</div>

**I have a problem with the time stamp I get the date right, but the time is wrong I get like 5 hours in advance, the date is right but I do not know why I get another time of execution, set the time zone in kibana, but I still get the time wrong.**

**this is the watcher code...**  
{  
"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}}",  
"format": "yyyy-MM-dd HH:mm:ss||basic\_time\_no\_millis"  
}  
}  
}  
}  
},  
"aggs": {  
"bucketAgg": {  
"field": "monitor.name.keyword",  
"query": {  
"bool": {  
"must": {  
"match\_all": {}  
},  
"filter": {  
"term": {  
"monitor.name.keyword": "01-2-CAV3000006278-DATOS-BKP-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](mailto:juan.jaramillo@megadvantage.com)",  
"[victor.vera@megadvantage.com](mailto: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}}

Área: Networking

🔔Mensaje Alerta: El enlace ha dejado de responder. Responder correo a [telecomunicaciones@udistrital.edu.co](mailto:telecomunicaciones@udistrital.edu.co)

Ingrese aquí para más información: [https://72dfe17217744236af40cc31b704a664.us-central1.gcp.cloud.es.io:9243/s/distrital/app/uptime#](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  
}  
}  
}  
}

**here is the test when executing the alert the time of execution is wrong**

 ![Screenshot 2020-10-13 141452](https://us1.discourse-cdn.com/elastic/original/3X/0/5/05579f5844c31ba2fdb717fd82b3d239d81de950.png)  
**in this image you can see that you set the time zone in the kibana**  
 ![Screenshot 2020-10-13 140733](https://us1.discourse-cdn.com/elastic/original/3X/8/c/8c650c1ec2ba3f96ac05dcdf25b6cf86f84cbf6e.png)

I would be very grateful for your help

---

<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 10, 2020, 7:17pm UTC](https://discuss.elastic.co/t/time-stamp-is-wrong/251957/2 "2020-11-10T19:17:59Z")

</div>

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