Thank you for replying. I tried looking into this but still couldn't find a way to parse my Watcher event into the respective fields.
For now I've evolved to the point I can make the Watcher to gather the documents and trigger events into the desired index. But I still can't format the documents so it goes into the right fields.
My current Watcher configuration is this:
{
"trigger": {
"schedule": {
"interval": "1m"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"heartbeat-*"
],
"rest_total_hits_as_int": true,
"body": {
"size": 10,
"_source": [
"monitor.name",
"monitor.type",
"url.full",
"monitor.status"
],
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-30m"
}
}
},
{
"match": {
"monitor.status": {
"query": "down"
}
}
}
]
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gte": 0
}
}
},
"actions": {
"index_action": {
"index": {
"index": "watcher_ti"
}
}
}
}
And the returned documents comes as this:
{
"_index": "watcher_ti",
"_id": "9utADZABVTr_EGDCNTvM",
"_version": 1,
"_score": 0,
"_source": {
"_shards": {
"total": 400,
"failed": 0,
"successful": 400,
"skipped": 399
},
"hits": {
"hits": [
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "89A_DZABnV4Un6b4uJuA",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "i9A-DZABnV4Un6b4zkch",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "5889DZABnV4Un6b44_6_",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "Xs88DZABnV4Un6b4-chf",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "vM88DZABnV4Un6b4Dpf_",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "Xc87DZABnV4Un6b4JGmf",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "xc86DZABnV4Un6b4Ojw9",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Web Backend CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "http://X.X.X.9:8082"
}
},
"_id": "m845DZABnV4Un6b4Uek7",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Application yyyy 1 CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "https://xxxCLIENT.tontonton.com/yyyy.html"
}
},
"_id": "NsosDZABnV4Un6b4PkPv",
"_score": 4.7359004
},
{
"_index": ".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
"_source": {
"monitor": {
"name": "Application yyyy 2 CLIENT",
"type": "http",
"status": "down"
},
"url": {
"full": "https://xxxCLIENT2.tontonton.com/yyyy.html"
}
},
"_id": "N8osDZABnV4Un6b4PkPv",
"_score": 4.7359004
}
],
"total": 136,
"max_score": 4.7359004
},
"took": 41,
"timed_out": false
},
"fields": {
"_shards.successful": [
400
],
"hits.hits._source.monitor.status.keyword": [
"down",
"down",
"down",
"down",
"down",
"down",
"down",
"down",
"down",
"down"
],
"took": [
41
],
"hits.hits._score": [
4.7359004,
4.7359004,
4.7359004,
4.7359004,
4.7359004,
4.7359004,
4.7359004,
4.7359004,
4.7359004,
4.7359004
],
"hits.total": [
136
],
"_shards.skipped": [
399
],
"hits.hits._source.monitor.status": [
"down",
"down",
"down",
"down",
"down",
"down",
"down",
"down",
"down",
"down"
],
"hits.hits._id.keyword": [
"89A_DZABnV4Un6b4uJuA",
"i9A-DZABnV4Un6b4zkch",
"5889DZABnV4Un6b44_6_",
"Xs88DZABnV4Un6b4-chf",
"vM88DZABnV4Un6b4Dpf_",
"Xc87DZABnV4Un6b4JGmf",
"xc86DZABnV4Un6b4Ojw9",
"m845DZABnV4Un6b4Uek7",
"NsosDZABnV4Un6b4PkPv",
"N8osDZABnV4Un6b4PkPv"
],
"hits.hits._index.keyword": [
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001"
],
"hits.hits._source.monitor.type": [
"http",
"http",
"http",
"http",
"http",
"http",
"http",
"http",
"http",
"http"
],
"timed_out": [
false
],
"hits.hits._source.url.full": [
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"https://xxxCLIENT.tontonton.com/yyyy.html",
"https://xxxCLIENT2.tontonton.com/yyyy.html"
],
"hits.max_score": [
4.7359004
],
"_shards.total": [
400
],
"hits.hits._source.url.full.keyword": [
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"http://X.X.X.9:8082",
"https://xxxCLIENT.tontonton.com/yyyy.html",
"https://xxxCLIENT2.tontonton.com/yyyy.html"
],
"hits.hits._source.monitor.type.keyword": [
"http",
"http",
"http",
"http",
"http",
"http",
"http",
"http",
"http",
"http"
],
"hits.hits._source.monitor.name.keyword": [
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Application yyyy 1 CLIENT",
"Application yyyy 2 CLIENT"
],
"hits.hits._source.monitor.name": [
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Web Backend CLIENT",
"Application yyyy 1 CLIENT",
"Application yyyy 2 CLIENT"
],
"hits.hits._index": [
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001",
".ds-heartbeat-8.11.3-2024.06.12-2024.06.12-000001"
],
"hits.hits._id": [
"89A_DZABnV4Un6b4uJuA",
"i9A-DZABnV4Un6b4zkch",
"5889DZABnV4Un6b44_6_",
"Xs88DZABnV4Un6b4-chf",
"vM88DZABnV4Un6b4Dpf_",
"Xc87DZABnV4Un6b4JGmf",
"xc86DZABnV4Un6b4Ojw9",
"m845DZABnV4Un6b4Uek7",
"NsosDZABnV4Un6b4PkPv",
"N8osDZABnV4Un6b4PkPv"
],
"_shards.failed": [
0
]
}
}
Now the issue I'm having is to set these documents into their fields instead of the giant array of Hits, which gather all documents inside a single one.