Elastic X-pack features enablement in docker

Hi Team,

I have used the dockerization concept for ELK. And now I'm trying to configure the email account through docker-compose.yml but am getting unknown settings error.

Please find the config as below,

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2
environment:
- cluster.name=my-cluster
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms10g -Xmx10g"
- xpack.watcher.enabled=true
- xpack.notification.email.account:
gmail_account:
profile: gmail
smtp:
auth: true
starttls.enable: true
host: smtp.gmail.com
port: 25
user:myemail@gmail.com
password: abcdefg

Could someone please help me what went wrong over here.

Thanks in advance!

Hi,

This is not the correct way to configure watcher or any Elasticsearch configuration for that matter. Please refer to our documentation on How to configure Elasticsearch on Docker

@ikakavas, Thanks for your response!

I have gone through the some of the elastic blocks and changed my configuration. Now able to see the email action in the kibana.

Configuration as below.
- xpack.notification.email.account.smtp.auth=true
- xpack.notification.email.account.smtp.starttls.enable=true
- xpack.notification.email.account.smtp.host=smtp.gmail.com
- xpack.notification.email.account.smtp.port=25
- xpack.notification.email.account.smtp.user= myemail@gmail.com
- xpack.notification.email.account.smtp.password=asdfgvf

But still, am facing some issue in triggering an email from kibana:pensive::weary:
Also, my account was enabled with two-step verification. As mentioned in the document, now am trying to use the App Password to send email from Watcher.

Error message in below.

"ERROR][o.e.x.w.a.e.ExecutableEmailAction] [reizUl3] failed to execute action [inlined/email_1]
javax.mail.MessagingException: failed to send email with subject [Watch [ss] has exceeded the threshold] via account [gmail_account]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:147) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:139) ~[?:?]
at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:72) ~[?:?]
at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:144) [x-pack-core-6.3.2.jar:6.3.2]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:475) [x-pack-watcher-6.3.2.jar:6.3.2]
at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:305) [x-pack-watcher-6.3.2.jar:6.3.2]
at org.elasticsearch.xpack.watcher.transport.actions.execute.TransportExecuteWatchAction$1.doRun(TransportExecuteWatchAction.java:154) [x-pack-watcher-6.3.2.jar:6.3.2]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.3.2.jar:6.3.2]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:626) [elasticsearch-6.3.2.jar:6.3.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:844) [?:?]
Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 120000
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2118) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:712) ~[?:?]
at javax.mail.Service.connect(Service.java:366) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.lambda$executeConnect$2(Account.java:153) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.executeConnect(Account.java:152) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:111) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:145) ~[?:?]
... 13 more
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:400) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:243) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:225) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:402) ~[?:?]
at java.net.Socket.connect(Socket.java:591) ~[?:?]
at com.sun.mail.util.WriteTimeoutSocket.connect(WriteTimeoutSocket.java:113) ~[?:?]
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:329) ~[?:?]
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2084) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:712) ~[?:?]
at javax.mail.Service.connect(Service.java:366) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.lambda$executeConnect$2(Account.java:153) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.executeConnect(Account.java:152) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:111) ~[?:?]
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:145) ~[?:?]"

Please correct me if am doing anything wrong over here.

Thanks

Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 120000

Looks like things inside your container cannot connect to smtp.gmail.com. You should look into your architecture and network connectivity, this seems to be a non Elasticsearch specific issue.

1 Like

Thanks, @ikakavas,

Then I will try to enable SMTP service inside my docker container.

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