[ELK] File 文件监控

来源:互联网 发布:织梦淘宝客模板 编辑:程序博客网 时间:2024/06/14 10:34

input {

 

    file {

        path =>"/data/es-logs/oldboy.log"          #定义文件路径

        type =>"es-error"                                        #定义标签

        start_position =>"beginning"                    #从头读取

        codec => multiline{                                      #多行插件

            pattern =>"^\["                                         #以【开头

            negate =>"true"                                        #默认是false。若为true,则将不匹配的并入一行

            what =>"previous"                                  #what => "previous" or "next"上一行或下一行的关系

 

        }

    }

}

 

 

output {

 

    if [type] == "es-error" {

        elasticsearch {

            hosts =>["192.168.1.75:9200"]

            index =>"es-error-%{+YYYY.MM.dd}"

        }

    }

}

原创粉丝点击