0
点赞
收藏
分享

微信扫一扫

ELK一次错误日志弄到一行

Java架构领域 2022-02-07 阅读 36

示例:(只看红色部分即可)

input {

        file {
                        path => ["/opt/logs/normal.log"]
                        start_position => "beginning"
                        type => "normal"
        }
        file {
                path => ["/opt/logs/error.log"]
                start_position => "beginning"
                type => "error"

                codec=>multiline  {
                        pattern => "^%{TIMESTAMP_ISO8601}"
                        negate => true
                        what => previous
                }

        }


}

output {

        if [type] == "hr-yg-error" {
                elasticsearch {
                        hosts => ["192.168.168.121:9200"]
                        index => "error-%{+YYYY-MM}"
                        codec => rubydebug
                }
        }
        if [type] == "hr-yg-normal" {
                elasticsearch {
                        hosts => ["192.168.168.121:9200"]
                        index => "normal-%{+YYYY-MM}"
                        codec => rubydebug
                }
        }
}
 

举报

相关推荐

0 条评论