Created
March 20, 2019 18:11
-
-
Save rpendela/fe8ba8900c75ac629595ec2a5f1061d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"trigger": { | |
"schedule": { | |
"interval": "60m" | |
} | |
}, | |
"input": { | |
"search": { | |
"request": { | |
"search_type": "query_then_fetch", | |
"indices": [ | |
"dslogs-*" | |
], | |
"types": [], | |
"body": { | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"beat.ip": "10.7.1.109" | |
} | |
}, | |
{ | |
"term": { | |
"levelname": "CRITICAL" | |
} | |
} | |
], | |
"filter": [ | |
{ | |
"range": { | |
"@timestamp": { | |
"gte": "now-60m" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition": { | |
"compare": { | |
"ctx.payload.hits.total": { | |
"gt": 0 | |
} | |
} | |
}, | |
"actions": { | |
"notify-pagerduty": { | |
"throttle_period_in_millis": 300000, | |
"pagerduty": { | |
"description": "ATTENTION: critical logs found in last 1hour and triggered at {{ctx.execution_time}}", | |
"client_url": "https://kibana1.corp.mycompany.com/", | |
"attach_payload": true, | |
"account": "team1", | |
"contexts": [ | |
{ | |
"type": "link", | |
"href": "https://mycompany.pagerduty.com" | |
}, | |
{ | |
"type": "link", | |
"href": "https://mycompany.pagerduty.com", | |
"text": "View the incident on {{ctx.payload.link}}" | |
} | |
] | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"trigger": { | |
"schedule": { | |
"interval": "60m" | |
} | |
}, | |
"input": { | |
"search": { | |
"request": { | |
"search_type": "query_then_fetch", | |
"indices": [ | |
"dslogs-*" | |
], | |
"types": [], | |
"body": { | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"beat.ip": "10.7.1.109" | |
} | |
} | |
], | |
"filter": [ | |
{ | |
"range": { | |
"@timestamp": { | |
"gte": "now-60m" | |
} | |
} | |
} | |
], | |
"should": [ | |
{ | |
"match_phrase": { | |
"levelname": "CRITICAL" | |
} | |
} | |
], | |
"minimum_should_match": 1 | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition": { | |
"compare": { | |
"ctx.payload.hits.total": { | |
"gt": 0 | |
} | |
} | |
}, | |
"actions": { | |
"notify-pagerduty": { | |
"throttle_period_in_millis": 300000, | |
"pagerduty": { | |
"description": "ATTENTION: critical logs found in last 1hour and triggered at {{ctx.execution_time}}", | |
"client_url": "https://kibana1.corp.mycompany.com/", | |
"attach_payload": true, | |
"account": "team1", | |
"contexts": [ | |
{ | |
"type": "link", | |
"href": "https://mycompany.pagerduty.com" | |
}, | |
{ | |
"type": "link", | |
"href": "https://mycompany.pagerduty.com", | |
"text": "View the incident on {{ctx.payload.link}}" | |
} | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment