I have a watch set up to send an email anytime that the metricbeat index's field "mysql.status.connections" shows nothing over 5 minutes. It works great with the only exception that when the pipeline bottlenecks, all metricbeat data backs up causing the alert to fire falsely (false positive). I am looking at correlating the status down with a filebeat message that has a SQL error code to make my watch more robust and prevent the false positives from occurring while the infrastructure team works on the pipeline. I got the syntax correct (I do not see JSON errors) but when I try to simulate the watch or save the watch, I get the following error:
Watcher: [parse_exception] Expected closing JSON object after parsing input [search] named [mbinfo]
in watch[MyWatch]
I have been unable to find anything that would explain what in the mbinfo is causing this. I will be looking at this in the devtools to see if I can figure it out but if someone has any ideas why this is being caused or has an example that would let me search between two indexes, it would save me a lot of time. Here is the watch that I have and I am open to suggestions as to how to do this correctly:
{
"trigger": {
"schedule": {
"interval": "4m"
}
},
"input": {
"chain": {
"inputs": [
{
"mbinfo": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"my_metricbeat_index"
],
"types": [],
"body": {
"size": 50,
"query": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"from": "now-5m",
"to": "now"
}
}
}
],
"must": [
{
"match": {
"fields.team": "my_team"
}
},
{
"exists": {
"field": "mysql.status.connections"
}
}
]
}
},
"_source": {
"excludes": []
}
}
}
}
},
"fbinfo": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"my_filebeat_index"
],
"types": [],
"body": {
"size": 50,
"query": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"from": "now-5m",
"to": "now"
}
}
}
],
"must": [
{
"match": {
"fields.team": "my_team"
}
},
{
"match_phrase": {
"message": "SQLSTATE = 08s01"
}
}
]
}
},
"_source": {
"excludes": []
}
}
}
}
}
}
]
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"lt": 1
}
}
},
Thank you for your time and assistance with regards to this and the action is just to send an email.