1、elk收集tomcat普通日志:

只在logstash节点增加如下文件,重启logstash即可:

cat >>/home/logstash-6.3.0/config/tomcat_test.conf<<EOF
input {
     file {
        path => ["/usr/local/tomcat/logs/localhost_access_log.2019-02-12.txt"]
        type => "tomcat_log"
        start_position => "beginning"
codec => json
     }
}
filter {
date {
match => [ "timestamp" , "YYYY-MM-dd HH:mm:ss" ]
}
}
output {
elasticsearch {
        hosts => ["192.168.0.91:9200"]
        index => "tomcat-pc-%{+YYYY.MM.dd}"
    }
    stdout {
codec => rubydebug
    }
}
EOF



2、elk收集tomcat中catalina.out日志

只在logstash节点增加如下文件,重启logstash即可:

cat >>/home/logstash-6.3.0/config/tomcat_catalina.out.conf<<EOF
input {
     file {
        path => ["/usr/local/tomcat/logs/catalina.out"]
        type => "tomcat_log"
        start_position => "beginning"
codec => json
     }
}
filter {
date {
match => [ "timestamp" , "YYYY-MM-dd HH:mm:ss" ]
}
}
output {
elasticsearch {
        hosts => ["192.168.0.91:9200"]
        index => "tomcat-pc-%{+YYYY.MM.dd}"
    }
    stdout {
codec => rubydebug
    }
}
EOF


参照文档:

https://www.cnblogs.com/kakarott/p/8118906.html

 

相关文章:

  • 2021-10-19
  • 2022-01-01
  • 2021-09-29
  • 2021-07-30
  • 2021-06-24
  • 2021-05-30
猜你喜欢
  • 2021-11-07
  • 2021-10-11
  • 2021-08-25
  • 2021-08-10
  • 2022-12-23
  • 2022-03-04
  • 2021-06-22
相关资源
相似解决方案