In some cases notifications don’t contain log error body (timestamp, error text, etc.)
{
"query": {
"bool": {
"filter": [
{
"bool": {
"filter": [
{
"multi_match": {
"query": "integration",
"fields": [],
"type": "phrase",
"operator": "OR",
"slop": 0,
"prefix_length": 0,
"max_expansions": 50,
"lenient": true,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1
}
},
{
"multi_match": {
"query": "ERROR",
"fields": [],
"type": "phrase",
"operator": "OR",
"slop": 0,
"prefix_length": 0,
"max_expansions": 50,
"lenient": true,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
{
"range": {
"@timestamp": {
"from": "now-5m",
"to": null,
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
and trigger
{
"title": "{{#ctx.results.0.hits.hits}}{{ctx.results.0.hits.hits.}}
<FONT size=3>LOG FILE: {{_source.log.file.path}}<br>
<FONT size=3>TIMESTAMP: {{_source.javalog.timestamp}}<br>
<FONT size=3>CLASS: {{_source.javalog.class}}<br><pre>
<FONT size=3>MESSAGE: {{_source.javalog.message}}</pre><br><br>{{/ctx.results.0.hits.hits}}",
"text": "Logged error(s) in environment"
}
Expected result:
LOG FILE: /server.log
TIMESTAMP: 2020-02-25 21:35:12,504
CLASS: com.integrations.restapi.OrderServiceMESSAGE: com.integrations.restapi.
Actual result:
LOG FILE: /server.log
TIMESTAMP:
CLASS:MESSAGE: