Skip to content

Commit

Permalink
Add script processor to fix grok behaviour of ES 8.7.x+
Browse files Browse the repository at this point in the history
  • Loading branch information
shmsr committed Jun 12, 2023
1 parent e234ffb commit 6f60bd5
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,30 @@
"ignore_missing": true
}
},
{
"script": {
"lang": "painless",
"if": "ctx?.mysql != null",
"source": "for (field in params.fields) { if (ctx.mysql[field] instanceof List) { def vals = ctx.mysql[field]; vals = vals.stream().distinct().sorted().collect(Collectors.toList()); if (vals.size() == 1) { ctx.mysql[field] = vals[0] } else { ctx.mysql[field] = vals } } }",
"params": {
"fields": [
"thread_id"
]
}
}
},
{
"script": {
"lang": "painless",
"if": "ctx?.mysql?.slowlog != null",
"source": "for (field in params.fields) { if (ctx.mysql.slowlog[field] instanceof List) { def vals = ctx.mysql.slowlog[field]; vals = vals.stream().distinct().sorted().collect(Collectors.toList()); if (vals.size() == 1) { ctx.mysql.slowlog[field] = vals[0] } else { ctx.mysql.slowlog[field] = vals } } }",
"params": {
"fields": [
"schema"
]
}
}
},
{
"remove": {
"field": "message"
Expand Down

0 comments on commit 6f60bd5

Please sign in to comment.