ELK实时日志分析平台部署搭建详细实现过程(3)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ">

<modelVersion>4.0.0</modelVersion>

<groupId>elk3</groupId>

<artifactId>elk3</artifactId>

<version>0.0.1-SNAPSHOT</version>

<name>elk3</name>

<dependency>

<groupId>log4j</groupId>

<artifactId>log4j</artifactId>

<version>1.2.17</version>

</dependency>

</project>

 

3 log4j.properties

Log4j.properties,将Log4j的日志输出到 SocketAppender ,因为官网是这么说的E:\u\elk\pic\01_5.png:

ELK实时日志分析平台部署搭建详细实现过程

Log4j.properties文件:

log4j.rootLogger=INFO,console

# for package com.demo.elk, log would be sent to socket appender.

log4j.logger.com.demo.elk=DEBUG, socket

# appender socket

log4j.appender.socket=org.apache.log4j.net.SocketAppender

log4j.appender.socket.Port=4567

log4j.appender.socket.RemoteHost=192.168.121.62

log4j.appender.socket.layout=org.apache.log4j.PatternLayout

log4j.appender.socket.layout.ConversionPattern=%d [%-5p] [%l] %m%n

log4j.appender.socket.ReconnectionDelay=10000

# appender console

log4j.appender.console=org.apache.log4j.ConsoleAppender

log4j.appender.console.target=System.out

log4j.appender.console.layout=org.apache.log4j.PatternLayout

log4j.appender.console.layout.ConversionPattern=%d [%-5p] [%l] %m%n

 

注意:这里的端口号需要跟Logstash监听的端口号一致,这里是4567。

4.5eclipse调试结果

1eclipse查看调试结果

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/07190aa507ca84666b78c4082906ea0d.html