Hello there,
I am currently struggling with calculating the hour of the day from the timestamp of a log record using painless. The painless code (with adjusted field accessor) works as a scripted field.
Wether date_hour field nor the pipeline_failure_message is filled.
I appreciate any hint on how to debug this and at least get some error information. Or is there an easier way to do it?
I am using Elasticsearch 7.5.
{
"processors" : [
{
"script": {
"lang": "painless",
"source": "ZonedDateTime input = ctx._source['@timestamp']; DateTimeFormatter dtf = DateTimeFormatter.ofPattern('HH'); ctx.date_hour = input.format(dtf); ",
"on_failure" : [
{
"set" : {
"field" : "pipeline_failure_message",
"value" : "{{ _ingest.on_failure_message }}"
}
}
]
}
}
]
}
Thanks in advance.