input {
    file {
       codec => multiline {
           pattern => "^\[2016"
           negate => true
           what => previous
          }
       type => "log4j" 
       path => "/usr/local/soft/logs/*.log"
    }
}
filter {
    grok {
               match => {
                    "message" => "\[(?<CreatedOn>[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}) (?<ErrorLevel>\w+)\] \[(?<TargetMethod>.*)\] \((?<TargetClass>.*)\) - (?<Message>(\w|\s)*)\r\n(?<Stack>.*)"
            }
    }
    mutate {
        rename => { "host" => "ServerIP"}
        remove_field => ["message","tags"]
    }
    }
output {
    elasticsearch {
            hosts => ["114.215.171.188:9200"]
            index=>"logstash-%{type}"  #%{type}-%{+YYYY.MM.dd}
            document_type=>"%{type}"
        }
    stdout{codec=>rubydebug}
}

 

相关文章:

  • 2022-12-23
  • 2021-09-23
  • 2021-08-01
  • 2022-01-25
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-07
  • 2021-12-03
  • 2021-06-20
  • 2022-01-12
  • 2021-08-27
  • 2022-12-23
相关资源
相似解决方案