2017年12月27日 | Leave a comment 问题: 解决: 下载文件 docker-compose.yaml 见下边 执行 cd <dir> docker-compose up -d log4j.properties 见下边,然后用 log4j (1.x) 写点东西 访问kibana http://localhost:5601 查看 ELK 效果 在win10 docker 17 -ce / docker-compose 1.16 上上测试通过 docker-compose.yaml: version: "3" services: es: image: elasticsearch:2.3 networks: - elknet logstash: image: logstash:2.3 entrypoint: - logstash - -e - input { log4j { mode=>"server" host=>"0.0.0.0" port=>3456 type=>"log4j" } } output { elasticsearch { hosts=>[ "es" ] } } networks: - elknet ports: - "3456:3456" depends_on: - es - kibana kibana: image: kibana:4.5 environment: ELASTICSEARCH_URL: http://es:9200 networks: - elknet ports: - "5601:5601" depends_on: - es networks: elknet: 123456789101112131415161718192021222324252627282930313233 version: "3"services: es: image: elasticsearch:2.3 networks: - elknet logstash: image: logstash:2.3 entrypoint: - logstash - -e - input { log4j { mode=>"server" host=>"0.0.0.0" port=>3456 type=>"log4j" } } output { elasticsearch { hosts=>[ "es" ] } } networks: - elknet ports: - "3456:3456" depends_on: - es - kibana kibana: image: kibana:4.5 environment: ELASTICSEARCH_URL: http://es:9200 networks: - elknet ports: - "5601:5601" depends_on: - esnetworks: elknet: log4j.properties: 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 1234567891011 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 参考: