i copy the request to my configure .
i read offical website long times ...
"condition": {
"script": "if (ctx.payload.aggregations.minutes.buckets.size() == 0) return false; def latest = ctx.payload.aggregations.minutes.buckets[-1]; def node = latest.nodes.buckets[0]; return node && node.cpu && node.cpu.value >= 75;"
},
this example is same with my configure , i think it will match this bytes... not dashbord "Sum of bytes",so i don't know how to compute "Sum of bytes " . ctx.payload.aggregations.bytes? ctx.payload.hits.total? or
"condition" : {
"compare" : { "ctx.payload.hits.total" : { "gt" : 50,000.000 }}
},
?
and then, a day has gone by again. i trys any ways , but it doesn't still success. i'm going to crazy!!>_<
i can't fixed error ....
i edit my configure in the morning...
{
"trigger" : {
"schedule" : { "interval" : "5s" }
},
"input" : {
"search" : {
"request" : {
"indices" : [ "access-2016.02.24" ],
"body" : {
"query" : {
"filtered": {
"query": {
"query_string": {
"query": "*",
"analyze_wildcard": true
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-5m",
"lte": "now"
}
}
}
],
"must_not":
}
}
}
},
"size": 0,
"aggs": {
"date_histogram": {
"field": "@timestamp",
"interval": "5s",
"time_zone": "Asia/Shanghai"
},
"aggs": {
"3": {
"terms": {
"field": "type",
"size": 3,
"order": {
"1": "desc"
}
},
"aggs": {
"1": {
"sum": {
"field": "bytes"
}
}
}
}
}
}
}
}
}
},
"throttle_period": "5s",
"condition" : {
"compare" : { "ctx.payload.aggregations.bytes.size()" : { "gt" : 50000000} }
},
"actions" : {
"send_email" : {
"email" : {
"to" : "kim@qq.com",
"subject" : "netflow is too high",
"body" : "netflow is too high "
}
}
}
}
@spinscale please help me !! foreign friends !
Thanks a lot!!