I am creating an application where I need to send an email alert for my logs. Here is input to create a watcher:

PUT _xpack/watcher/watch/log_error_watch
{
  "trigger" : {
    "schedule" : { "interval" : "10s" } 
  },
  "input" : {
    "search" : {
      "request" : {
        "indices" : [ "testindexv4" ],
        "body" : {
          "query" : {
            "match" : { "log_level": "ERROR" }
          }
        }
      }
    }
  }
  ,
  "actions" : {
  "send_email" : { 
    "email" : { 
      "to" : "<mailId>@gmail.com", 
      "subject" : "Watcher Notification", 
      "body" : "error logs found" 
    }
  }
}
}

Here is configuration for elasticsearch.yml

xpack.security.enabled: false
xpack.notification.email.account:
      standard_account:
         profile: standard
         smtp:
             auth: false
             starttls.enable: false
             starttls.required: false
             host: smtp.gmail.com
             port: 587

When I try to run my watcher, I get the error as:

reason": "530 5.7.0 Must issue a STARTTLS command first. o63-v6sm4041934ywc.36 - gsmtp\n

any solution on the same please?

1

There are 1 best solutions below

0
On BEST ANSWER

It's solved now, all I need to do is enable TLS authentication.

Here is my updated content of elasticsearch.yml:

xpack.security.enabled: false 
xpack.notification.email.account:
      standard_account:
         profile: standard
         smtp:
             auth: true
             starttls.enable: true
             starttls.required: true
             host: smtp.gmail.com
             port: 587
             user: <mailId>
             password: <passowrd>