Watcher - Use field data from input to condition script calc

We are triying to deploy a watcher alert to compare values into a field of some logs

The problem is:

we need to compare 2 fields loaded in input:

1- metricbeat logs with some specific field
2- metricbeat logs with some specific field

But we are not able to extract the value of each log in that input to do:
data_field 1 - data_field 2

how can I get these fields values individually to calculate condition?


You probably want a script condition from which you could reference the value from ctx.payload.* . Alternatively, if you want use a specific condition you could use a compare condition and reference with the mustache syntax {{ctx.payload.*}}.

When building out a Watch it is often useful for debugging to add an action like the following to see what is available via ctx.payload.

"actions": {
        "my_logger": {
            "logging": {
                "text": "Watch payload = {{ctx.payload}}",
                "level": "debug"

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