Thanks,
I tried to do the work around solution as you suggested,
I updated the watcher and trying to send payload to logstash via webhook, but getting error like "path not found", Please find below the simulation result for the exceute action below. Kindly suggest. logstash http input plug in is installed.
{
"watch_id": "inlined",
"node": "zJbMhvCbS3aqrVrBBFHWJg",
"state": "executed",
"user": "elastic",
"status": {
"state": {
"active": true,
"timestamp": "2019-03-21T15:40:55.422Z"
},
"last_checked": "2019-03-21T15:40:55.423Z",
"last_met_condition": "2019-03-21T15:40:55.423Z",
"actions": {
"my_webhook": {
"ack": {
"timestamp": "2019-03-21T15:40:55.422Z",
"state": "awaits_successful_execution"
},
"last_execution": {
"timestamp": "2019-03-21T15:40:55.423Z",
"successful": false,
"reason": "received [404] status code"
}
}
},
"execution_state": "executed",
"version": -1
},
"trigger_event": {
"type": "manual",
"triggered_time": "2019-03-21T15:40:55.423Z",
"manual": {
"schedule": {
"scheduled_time": "2019-03-21T15:40:55.423Z"
}
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"pq-icelog*"
],
"types": ,
"body": {
"size": 20,
"query": {
"bool": {
"must": [
{
"match": {
"eventDetails.eventType": "ERROR"
}
},
{
"range": {
"@timestamp": {
"gte": "now-2d",
"lt": "now"
}
}
}
]
}
},
"aggs": {
"group_by_serviceName": {
"terms": {
"field": "interfaceHeader.className.keyword",
"size": 5
},
"aggs": {
"group_by_logLevel": {
"terms": {
"field": "eventDetails.eventType.keyword",
"size": 5
},
"aggs": {
"get_latest": {
"terms": {
"field": "@timestamp",
"size": 1,
"order": {
"_key": "desc"
}
}
}
}
}
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gte": 0
}
}
},
"metadata": {
"name": "Logstash_Webhook_Alert",
"xpack": {
"type": "json"
}
},
"result": {
"execution_time": "2019-03-21T15:40:55.423Z",
"execution_duration": 26,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 195,
"failed": 0,
"successful": 195,
"skipped": 180
},
"hits": {
"hits": ,
"total": 0,
"max_score": null
},
"took": 19,
"timed_out": false,
"aggregations": {
"group_by_serviceName": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets":
}
}
},
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"pq-icelog*"
],
"types": ,
"body": {
"size": 20,
"query": {
"bool": {
"must": [
{
"match": {
"eventDetails.eventType": "ERROR"
}
},
{
"range": {
"@timestamp": {
"gte": "now-2d",
"lt": "now"
}
}
}
]
}
},
"aggs": {
"group_by_serviceName": {
"terms": {
"field": "interfaceHeader.className.keyword",
"size": 5
},
"aggs": {
"group_by_logLevel": {
"terms": {
"field": "eventDetails.eventType.keyword",
"size": 5
},
"aggs": {
"get_latest": {
"terms": {
"field": "@timestamp",
"size": 1,
"order": {
"_key": "desc"
}
}
}
}
}
}
}
}
}
}
}
},
"condition": {
"type": "compare",
"status": "success",
"met": true,
"compare": {
"resolved_values": {
"ctx.payload.hits.total": 0
}
}
},
"actions": [
{
"id": "my_webhook",
"type": "webhook",
"status": "failure",
"transform": {
"type": "script",
"status": "success",
"payload": {
"hits": ,
"total": 0,
"max_score": null
}
},
"reason": "received [404] status code",
"webhook": {
"request": {
"host": "10.132.1.2",
"port": 9615,
"scheme": "http",
"method": "post",
"path": "testAlert.json",
"headers": {
"Content-type": "application/json"
},
"body": "{hits=, total=0, max_score=null}"
},
"response": {
"status": 404,
"headers": {
"content-length": [
"71"
],
"content-type": [
"application/json"
],
"x-content-type-options": [
"nosniff"
],
"x-cascade": [
"pass"
]
},
"body": "{"path":"/testAlert.json","status":404,"error":{"message":"Not Found"}}"
}
}
}
]
},
"messages":
}