How to print my error stack trace from watchers or/and alerts in an email?

The title said it all.

"actions": {
        "email_action": {
          "throttle_period_in_millis": 900000,
          "email": {
            "profile": "standard",
            "to": [
              "myEmail@SMTP.com"
            ],
            "subject": "{{ctx.payload.hits.total}} Errors have occured in the logs",
            "body": {
              "text": "{{ctx.payload.hits.total}} Errors have occured in the logs in the last X minute. You can check the latest in the below link",
              "html": "Error name or error stack trace: {ctx._source.@timestamp} {{ctx._source.@timestamp}} {{ctx.payload.hits.2._source.@timestamp}} {{ctx.payload.hits.3._source.@timestamp}}"
            }
          }
        }
      },

That does not work. Any cue?

Are you getting any errors when running that or just not displaying any results?

Sorry for my late reply.

I'm not having any errors because I receive the email.
In the email, it is not displaying any results often replacing the variable by blank.

Like that:
HostName

&& && Query Link: https://URL [{ctx._source.@timestamp}]

Between the '&', there are only blanks.

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