"transform": {
"script": {
"source": "DateFormat dateFormat = new SimpleDateFormat (\" yyyy-MM-dd HH: mm: ss z \ "); dateFormat.setTimeZone (TimeZone.getTimeZone (\" Europe / Moscow \ ")); Date date = new Date (); ctx.execution_time = dateFormat.format (date); return ['human_date': ctx.execution_time, 'aggregations': ctx.payload.aggregations] ",
"lang": "painless"
}
}
Via WebHook, the following output is sent to telegrams:
**** Watcher ****
Date / Time: 2019-09-29 10:24:55 MSK
Watcher name: test_watcher
Host: www.domain.com
Request Time (ms): 60.000999450683594
In the Request Time field, the time in milliseconds is displayed with a large number of decimal places. How can I reduce the number of characters to zero? So that there is nothing after the decimal point
Hi, could you explain or show me how the return value of your script results in the output you're showing me? Based on the script alone, it looks like the only date-related return value is the human_date variable, which would be formatted as yyyy-MM-dd HH: mm: ss z. How does that end up in a numeric milliseconds value?
Thanks Aleksandr, I see you also posted this question in Форматирование вывода через Webhook, where Igor was able to answer your question. In the future, if you post the same question in multiple forums could you please link back and forth between the posts? This will help us avoid wasting time by answering the same question twice. Thanks!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.