2017年12月27日 | Leave a comment 问题: ELK docker log4j12 部署备忘 解决: docker-ce v17+ log4j 1.2.xx(此配置不支持 log4j2 ELK各组件的版本不能乱改) docker network create elknet docker run -d –name es –network elknet -p 9200:9200 elasticsearch:2.3 docker run -d –name mykibana –network elknet -e ELASTICSEARCH_URL=http://es:9200 -p 5601:5601 kibana:4.5 docker run -d –name logstash1 -p 3456:3456 –network elknet logstash:2.3 logstash -e ‘input { log4j { mode=>”server” host=>”0.0.0.0″ port=>3456 type=>”log4j” } } output { elasticsearch { hosts=>[ “es” ] } }’ log4j.properties: #log4j 1.2.x log4j.rootLogger = DEBUG,console,tcp log4j.appender.console = org.apache.log4j.ConsoleAppender log4j.appender.console.layout = org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.tcp=org.apache.log4j.net.SocketAppender log4j.appender.tcp.Port=3456 log4j.appender.tcp.RemoteHost=localhost log4j.appender.tcp.ReconnectionDelay=10000 log4j.appender.tcp.Application=ssmm 12345678910111213 #log4j 1.2.x log4j.rootLogger = DEBUG,console,tcp log4j.appender.console = org.apache.log4j.ConsoleAppenderlog4j.appender.console.layout = org.apache.log4j.PatternLayoutlog4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.tcp=org.apache.log4j.net.SocketAppenderlog4j.appender.tcp.Port=3456log4j.appender.tcp.RemoteHost=localhostlog4j.appender.tcp.ReconnectionDelay=10000log4j.appender.tcp.Application=ssmm 参考: https://www.kancloud.cn/hanxt/elk/158871