Watcher action logging when condition array_compare


(Jo De Troy) #1


I've created a watch with a search creating buckets and an array_compare condition.
I'd like to have an action that logs only the array elements where the condition is met.
Like below:
"condition": {
"array_compare": {
"ctx.payload.aggregations.by_host.buckets": {
"path": "averageResponseDuration",
"gt": {
"value": "200.",
"quantifier": "some"
"actions": {
"my-logging-action": {
"logging": {
"level": "info",
"text": "For {{ctx.payload.aggregations.by_host.buckets.key}} averageresponseDuration in too high. Threshold is 200."

But I don't know how I need to write the action logging text to only show the elements of the buckets that meet the condition, What is the best way to get this? Are there any alternatives possible?


(Alexander Reelsen) #2

Two possibilities: First you write a script transform in the watch, that filters for those buckets. Or, second, you write a bucket_selector pipeline aggregation, see

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.