一、该问题的重现步骤是什么?
1. 启动elk;
2. 在docker中增加配置:
blade-admin:
image: "${REGISTER}/blade/blade-admin:${TAG}"
environment:
- TZ=Asia/Shanghai
- JVM_OPTS=-Xmx256m -Xms256m -XX:MaxPermSize=256m
ports:
- 7002:7002
privileged: true
command:
- --spring.profiles.active=test
- --blade.log.elk.destination=192.168.6.97:9000
3.docker里显示配置已经存在:
"Cmd": [
"--spring.profiles.active=test",
"--blade.log.elk.destination=192.168.6.97:9000"
4.docker里显示连接还是默认的配置:
-WARN in net.logstash.logback.appender.LogstashTcpSocketAppender[INFO_LOGSTASH] - Log destination 172.30.0.72:9000: connection failed. java.net.NoRouteToHostException: No route to host (Host unreachable)
at java.net.NoRouteToHostException: No route to host (Host unreachable)
at at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at at java.net.SocksSocketImpl.connect(Unknown Source)
at at java.net.Socket.connect(Unknown Source)
at at net.logstash.logback.appender.AbstractLogstashTcpSocketAppender$TcpSendingEventHandler.openSocket(AbstractLogstashTcpSocketAppender.java:719)
at at net.logstash.logback.appender.AbstractLogstashTcpSocketAppender$TcpSendingEventHandler.onStart(AbstractLogstashTcpSocketAppender.java:639)
at at net.logstash.logback.appender.AsyncDisruptorAppender$EventClearingEventHandler.onStart(AsyncDisruptorAppender.java:351)
at at net.logstash.logback.encoder.com.lmax.disruptor.BatchEventProcessor.notifyStart(BatchEventProcessor.java:224)
at at net.logstash.logback.encoder.com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:120)
at at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at at java.util.concurrent.FutureTask.run(Unknown Source)
at at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
二、你期待的结果是什么?实际看到的又是什么?
能够连上:192.168.6.97:9000
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
2.7.0,Linux
四、请提供详细的错误堆栈信息,这很重要。
-WARN in net.logstash.logback.appender.LogstashTcpSocketAppender[INFO_LOGSTASH] - Log destination 172.30.0.72:9000: connection failed. java.net.NoRouteToHostException: No route to host (Host unreachable)
at java.net.NoRouteToHostException: No route to host (Host unreachable)
at at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at at java.net.SocksSocketImpl.connect(Unknown Source)
at at java.net.Socket.connect(Unknown Source)
at at net.logstash.logback.appender.AbstractLogstashTcpSocketAppender$TcpSendingEventHandler.openSocket(AbstractLogstashTcpSocketAppender.java:719)
at at net.logstash.logback.appender.AbstractLogstashTcpSocketAppender$TcpSendingEventHandler.onStart(AbstractLogstashTcpSocketAppender.java:639)
at at net.logstash.logback.appender.AsyncDisruptorAppender$EventClearingEventHandler.onStart(AsyncDisruptorAppender.java:351)
at at net.logstash.logback.encoder.com.lmax.disruptor.BatchEventProcessor.notifyStart(BatchEventProcessor.java:224)
at at net.logstash.logback.encoder.com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:120)
at at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at at java.util.concurrent.FutureTask.run(Unknown Source)
at at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
五、若有更多详细信息,请在下面提供。
是不是要在这里把blade.log.elk.destination加进去?
blade.log.elk.destination配置到blade-common的LauncherServiceImpl就可以了
具体详细操作可以看文档5.7章节
PropsUtil.(propsLauncherConstant.(profile))
这个已经开启了,这个配置是默认读取的,我现在碰到的问题是在docker部署时通过命令行修改这个参数没起作用,也就是下面的blade.log.elk.destination没起作用:
command:
- --spring.profiles.active=test
- --blade.log.elk.destination=192.168.6.97:9000
PropsUtil.(propsLauncherConstant.(profile))
// 开启elk日志
PropsUtil.setProperty(props, "blade.log.elk.destination", LauncherConstant.elkAddr(profile));
直接从idea里拷贝过来的代码,会把一些字符过滤了?
楼主,解决了吗?我也是遇到同样的问题。
扫一扫访问 Blade技术社区 移动端