Created
January 25, 2023 20:31
-
-
Save richcollier/ad0558b741d03f19489c5d5bab11d1ec 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
POST _watcher/watch/_execute | |
{ | |
"watch": { | |
"trigger": { | |
"schedule": { | |
"interval": "1m" | |
} | |
}, | |
"input": { | |
"search": { | |
"request": { | |
"indices": [ | |
"kibana_sample_data_logs" | |
], | |
"body": { | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"query_string": { | |
"query": "error" | |
} | |
}, | |
{ | |
"range": { | |
"@timestamp": { | |
"gte": "now-1m" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
}, | |
"condition": { | |
"compare": { | |
"ctx.payload.hits.total": { | |
"gte": 1 | |
} | |
} | |
}, | |
"actions" : { | |
"create_otrs" : { | |
"transform": { | |
"script": """return ['Ticket':['Queue':'EngineeringTeam','Priority':'P3','CustomerUser':'root@localhost','Title':'RESTCreateTest','State':'new','Type':'Incident'],'Article':['ContentType':'text/plain;charset=utf8','Subject':'RestCreateTest','Body':'Thisisonlyatest']]""" | |
}, | |
"webhook" : { | |
"method" : "POST", | |
"host" : "echo.zuplo.io", | |
"scheme" : "https", | |
"port": 443, | |
"body": "{{#toJson}}ctx.payload{{/toJson}}", | |
"auth" : { | |
"basic" : { | |
"username" : "myusername", | |
"password" : "mypassword" | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment