Change the timestamp format in Watcher

"actions": {
"log_error": {
"logging": {
"category": "watcher.logging.bppm.None",
"level": "info",
"text": "Found {{ctx.payload.hits.total}} exception in the server logs (EAP)\n{{#ctx.payload.hits.hits}}[MINOR] {{_source.@timestamp}} {{_source.hostname}} {{_source.wlsdomain}} {{_source.wlsname}} {{_source.msgId}}\n{{/ctx.payload.hits.hits}}"
}
}
}

My Question is how to change the format of {{_source.@timestamp}}??

This is the result:
[None] 2019-12-04 10:45:56 Found 1 exception in the server logs (EAP)
[MINOR] 2019-Dec-04 10:42:08.782 HKT eapdev1c wlsx_eprsvc_dev EprsvcCorpJmsDev_eapdev1c_11627 BEA-310003

I would like to change the format from 2019-Dec-04 10:42:08.782 HKT to 2019-12-04 10:42:08.

Many thanks.

              "range": {
                "@timestamp": {
                  "format": "basic_date_time_no_millis",
                  "time_zone": "Hongkong",
                  "gte": "now-1d/d",
                  "lte": "now"
                }
              }
            },

I have tried to change the format, but it doesnt work indeed.

you need to use a script transform and then change the format of the date, before using it in a mustache template.

GET /eap_wls_server*/_search
{
"_source":"msgId",
"query": {
"match_all": {}
},
"script_fields": {
"@timestamp": {
"script": "doc['@timestamp'].value.toString('yyyy-MM-dd HH:mm:ss')"
}
}
}

I still cannot transform the format

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