Skip to content

Instantly share code, notes, and snippets.

@narayanan1993
Created October 12, 2017 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save narayanan1993/580a31a79723d1b91eb9a8141a4f7def to your computer and use it in GitHub Desktop.
Save narayanan1993/580a31a79723d1b91eb9a8141a4f7def to your computer and use it in GitHub Desktop.
{
"_index": "looker",
"_type": "watch",
"_id": "vif50fghfed-7xs56mrtk16-55li19hd1um",
"_version": 1,
"found": true,
"_source": {
"title": "watcher_title",
"disable": false,
"report": false,
"trigger": {
"schedule": {
"later": "every 5 mins"
}
},
"input": {
"chain": {
"inputs": [
{
"first": {
"search": {
"request": {
"index": [
"<flights-{now/d}>"
],
"body": {
"query": {
"bool": {
"must": [
{
"match": {
"msg": {
"query": "morgan",
"type": "phrase"
}
}
},
{
"match": {
"path": {
"query": "/flights/v1/reprice",
"type": "phrase"
}
}
},
{
"range": {
"status_code": {
"gte": 400,
"lte": 600
}
}
},
{
"range": {
"@timestamp": {
"from": "now-2m",
"to": "now"
}
}
}
],
"must_not": {
"match": {
"status_code": {
"query": 517,
"type": "phrase"
}
}
}
}
}
}
}
}
}},
{
"second": {
"search": {
"request": {
"index": [
"<flights-{now/d-7d}>"
],
"body": {
"query": {
"bool": {
"must": [
{
"match": {
"msg": {
"query": "morgan",
"type": "phrase"
}
}
},
{
"match": {
"path": {
"query": "/flights/v1/reprice",
"type": "phrase"
}
}
},
{
"range": {
"status_code": {
"gte": 400,
"lte": 600
}
}
},
{
"range": {
"@timestamp": {
"from": "now-2m",
"to": "now" }
}
}
],
"must_not": {
"match": {
"status_code": {
"query": 517,
"type": "phrase"
}
}
}
}
}
}
}
}
}}
]
}
},
"condition": {
"script": {
"script": "first.payload.hits.total > 100"
}
},
"actions": {
"email_admin": {
"throttle_period": "0h15m0s",
"email": {
"to": "alarm@localhost",
"from": "sentinl@localhost",
"subject": "Sentinl Alarm",
"priority": "high",
"body": "Found {{payload.hits.total}} Events"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment