gmail阻止我的弹性搜索观察者电子邮件

时间:2017-06-16 01:04:25

标签: elasticsearch elasticsearch-x-pack

我正在使用ES 5.2。我实现了一个观察者。但每次观察者被触发它都会生成电子邮件,但谷歌因为安全问题而阻止该电子邮件。那么什么可以解决这个问题?

我的YML文件如下:

cluster.name:elasticsearch-logging

node.name:" elasticsearch-logging-0"

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

xpack.notification.email.account:

gmail_account:

个人资料:gmail

SMTP:

auth:true

starttls.enable:true

主持人:smtp.gmail.com

port:587

用户:******。** @ gmail.com

密码:******

当观察者的卷曲低于响应时:

做卷曲 -

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

得到以下回复:

{
  "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"
        }
      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

看起来像javax.mail issue,您需要启用less secure apps