Last active
February 9, 2017 17:09
-
-
Save darkshade9/2f1bcf608edb823563de2d4d9c42e0db to your computer and use it in GitHub Desktop.
This file contains hidden or 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": "60s" | |
| } | |
| }, | |
| "input": { | |
| "search": { | |
| "request": { | |
| "indices": [ | |
| "haproxy-*" | |
| ], | |
| "body": { | |
| "query": { | |
| "filtered": { | |
| "query": { | |
| "match": { | |
| "http_status_code": "502" | |
| } | |
| }, | |
| "filter": { | |
| "range": { | |
| "@timestamp": { | |
| "gt": "now-5m" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "condition": { | |
| "compare": { | |
| "ctx.payload.hits.total": { | |
| "gt": 10 | |
| } | |
| } | |
| }, | |
| "actions": { | |
| "email_admin": { | |
| "throttle_period": "15m", | |
| "email": { | |
| "to": [ "[email protected]" ], | |
| "subject": "Errors Detected", | |
| "body": "Within the last 5 minutes, I have detected {{ctx.payload.hits.total}} errors that match the description of the subject. Attached is the payload.", | |
| "attachments": { | |
| "attached_data": { | |
| "data": { | |
| "format": "json" | |
| } | |
| } | |
| }, | |
| "priority": "high" | |
| } | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Searches every 60 seconds inside of the haproxy-* index for the field http_status_code that matches 502 between now and 5 minutes against the @timestamp date/time frame, and if the number of events exceed 10 then send a high priority email, but do not repeat this email for 15 minutes. Include the payload of the hits in the email.