-1

I am using ES 5.2. I implemented a watcher.But each time watcher is getting triggered it generate email but google blocks that email due to security concern. So what can be solution for that?

My YML file is as below :

cluster.name: elasticsearch-logging

node.name: "elasticsearch-logging-0"

path.data: /var/lib/elasticsearch/data

xpack.notification.email.account:

gmail_account:

profile: gmail

smtp:

auth: true

starttls.enable: true

host: smtp.gmail.com

port: 587

user: ******.**@gmail.com

password: ******

While doing curl on watcher getting below response :

DOING CURL --

curl -XGET localhost:9200/_xpack/watcher/watch/last_watch

Getting below response:

{
  "found": true,
  "id": "lastwatch",
  "status": {
    "version": 5,
    "state": {
      "active": true,
      "timestamp": "2017-06-16T00:39:16.654Z"
    },
    "lastchecked": "2017-06-16T00:43:00.229Z",
    "last_met_condition": "2017-06-16T00:43:00.229Z",
    "actions": {
      "email_admin": {
        "ack": {
          "timestamp": "2017-06-16T00:39:16.654Z",
          "state": "awaits_successful_execution"
        },
        "last_execution": {
          "timestamp": "2017-06-16T00:43:00.229Z",
          "successful": false,
          "reason": "MessagingException[failed to send email with subject [404 recently encountered] via account [gmail_account]]; nested: AuthenticationFailedException[534-5.7.14 https://accounts.google.com/signin/continue?sarp=1&scc=1&pltn534-5.7.14 q0WEdpll7GFx7wL5ZoIKlaHy0JIWKkJEAaiNf5hWY11ZPPsJb6u7h9z0Xe\n534-5.7.14 kWiT264a1EJgbKW5ESeccxI0uUZ_3X4klQS4jBjB7dDw6pRU490p-yKtXkL2-Ik\n534-5.7.14 vMoQFBgYsmH2WbbGFC3Z63GBpWVH0O9LmpVsB89ZsSreIXN_bb0AX3UWwoX4dTb4UiXtmi\nQI Please log in via your web browser and\n534-5.7.14 then try again.\n534-5.7.14 Learn more at\n534 5.7.14 https://support.google.com/mail/answer/78754 a22sm752699pfc.115 - gsmtp\n]; "
        }
      }
    }
  },
  "watch": {
    "trigger": {
      "schedule": {
        "cron": "0 0/1 * * * ?"
      }
    },
    "input": {
      "search": {
        "request": {
          "search_type": "query_then_fetch",
          "indices": [
            "logstash*"
          ],
          "types": [],
          "body": {
            "query": {
              "bool": {
                "must": {
                  "match": {
                    "methodName": "getSSLConnectionSocketFactory"
                  }
                }
              }
            }
          }
        }
      }
    },
    "condition": {
      "compare": {
        "ctx.payload.hits.total": {
          "gt": 0
        }
      }
    },
    "actions": {
      "email_admin": {
        "email": {
          "profile": "standard",
          "to": [
            "****.*****@gmail.com"
          ],
          "subject": "404 recently encountered"
        }
      }
    }
  }
}
jos
  • 1,082
  • 5
  • 19
  • 45

1 Answers1

0

Looks like a javax.mail issue and you need to turn on less secure apps.

xeraa
  • 10,456
  • 3
  • 33
  • 66
  • Thanks fixed my problem. There was two way - 1- either use less secure app as u said or use key from some third party like pagerduty or something. Second way is much secure as you need not to hardcode ur credential anywhere. That third party key is associated with your login id. – ankush singh Aug 22 '17 at 23:01