Hi guys,
I'm trying to write a script within watcher that applies a transform to each log before sending it through slack. My current script is like this:
"script": {
"source": """
ctx.payload.hits.hits.forEach(hit -> hit._source.python_log_message = \a\.matcher(hit._source.python_log_message).replaceAll(''));
return ctx.payload
""",
"lang": "painless"
}
For some reason, it is erroring out, but i'm using the examples in the painless guide. Any reason why this would not work? It works perfectly if I, for example, do this:
"script": {
"source": """
ctx.payload.hits.hits.forEach(hit -> hit._source.python_log_message = 'hello');
return ctx.payload
""",
"lang": "painless"
}