Hi!
I need to create a watch, that will search through several indicies for certain events and then save each doc as a separate event to a new index.
I have already read this topic, got the idea but still hunting for working approach.
If anyone can provide an example of working script transform - that would be prefect.
I am on 6.6.1.
Here is my watch:
{
"trigger": {
"schedule": {
"interval": "1m"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"networklogs-cisco-step_dit*",
"networklogs-fortinet-step_dit*"
],
"types": [
"doc"
],
"body": {
"size": 50,
"query": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"lt": "now",
"gte": "now-5m"
}
}
},
{
"term": {
"destination.port": 445
}
},
{
"terms": {
"event.action": [
"pass",
"passthrough",
"log-only",
"allowed",
"accept",
"dns",
"ip-conn",
"allow",
"allowed"
]
}
}
]
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gte": 1
}
}
},
"actions": {
"create_incident": {
"transform": {
"script": {
"source": "<I stucked here>"
}
},
"index": {
"index": "alerts",
"doc_type": "doc"
}
}
}
}