zoukankan      html  css  js  c++  java
  • logstash grok

    input {
            file {
                    path => "/opt/service/test-service/logs/catalina-error*.log"
                    type => "study-center-service"
                    start_position=> "beginning"
                    stat_interval => 1
                }
    }
    
    
    filter {
    
    		multiline {
                pattern => "^d{4}-d{1,2}-d{1,2}sd{1,2}:d{1,2}:d{1,2}.d{3}"
                negate => true
                what => "previous"
            }
            grok { 
                match => { "message" => '%{DATA:time} %{LOGLEVEL:level} %{NOTSPACE:javaclass} %{INT:line} | %{NOTSPACE:serviceName} | %{NOTSPACE:serviceNode} | %{NOTSPACE:uri} | %{NOTSPACE:header} | %{NOTSPACE:request} | %{NOTSPACE:messages}'}
                match => {"time" => '%{NOTSPACE:time}'}
                match => {"level" => '%{NOTSPACE:level}'}
                match => {"javaclass" => '%{NOTSPACE:javaclass}'}
                match => {"line" => '%{NOTSPACE:line}'}
                match => {"serviceName" => '%{NOTSPACE:serviceName}'}
                match => {"serviceNode" => '%{NOTSPACE:serviceNode}'}
                match => {"uri" => '%{NOTSPACE:uri}'}
                match => {"header" => '%{NOTSPACE:header}'}
                match => {"request" => '%{NOTSPACE:request}'}
                match => {"messages" => '%{NOTSPACE:messages}'}
                break_on_match => true
    	}
    }
    
    output {
            if !("_grokparsefailure" in [tags]) {
                    elasticsearch {
                            hosts => ["192.168.2.187:9200"]
                            index => "%{[type]}-%{+YYYY.MM.dd}"
                    }
            }
    }
    

      

  • 相关阅读:
    JavaWeb(一)
    关于servlet的配置
    jquery中attr和prop的区别
    javascript-02
    javascript-01
    css
    css-02
    html扫盲-01
    Java 之 FileReader FileInputStream InputStreamReader BufferedReader 作用与区别
    Eclipse项目的.classpath文件
  • 原文地址:https://www.cnblogs.com/ipyanthony/p/11178330.html
Copyright © 2011-2022 走看看