我正在使用 ES 5.2。我实现了一个观察器。但是每次触发观察者时,它都会生成电子邮件,但由于安全问题,谷歌会阻止该电子邮件。那么有什么解决方案呢?
我的YML文件如下:
cluster.name:弹性搜索日志记录
node.name: "elasticsearch-logging-0">
path.data:/var/lib/elasticsearch/data
xpack.notification.email.account:
gmail_account:
个人资料: Gmail
SMTP:
身份验证:真
starttls.enable: true
主持人:smtp.gmail.com
端口: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 q0WEdpll7GFx7wL5ZoIKlaHy0JIWKkJEAaiNf5hWY11ZPPsJb6u7h9z0Xen534-5.7.14 kWiT264a1EJgbKW5ESeccxI0uUZ_3X4klQS4jBjB7dDw6pRU490p-yKtXkL2-Ikn534-5.7.14 vMoQFBgYsmH2WbbGFC3Z63GBpWVH0O9LmpVsB89ZsSreIXN_bb0AX3UWwoX4dTb4UiXtminQI Please log in via your web browser andn534-5.7.14 then try again.n534-5.7.14 Learn more atn534 5.7.14 https://support.google.com/mail/answer/78754 a22sm752699pfc.115 - gsmtpn]; "
}
}
}
},
"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"
}
}
}
}
}
看起来像一个javax.mail问题,你需要打开不太安全的应用程序。