• logstash match


    [elk@zjtest7-frontend config]$ cat stdin04.conf 
    input {
        stdin {
        }
    }
    filter {
      # drop sleep events
      grok {
        match => [ "message" , "(error|ERROR)" ]
        add_tag => [ "sleep_aaa" ]
        tag_on_failure => [] # prevent default _grokparsefailure tag on real records
      }
    
    
      grok {
        match => { "message" => "SELECT bbb" }
        add_tag => [ "sleep_bbb" ]
      }
      }
    output {
    if "sleep_aaa" in [tags]{
     stdout {
      codec=>rubydebug{}
       }
    }
     else if "sleep_bbb" in [tags]{
     stdout {
      codec=>json
       }
    }
    
    }
    [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin04.conf --configtest
    Configuration OK
    [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin04.conf 
    Settings: Default pipeline workers: 1
    Pipeline main started
    error
    {
           "message" => "error",
          "@version" => "1",
        "@timestamp" => "2016-09-16T03:13:54.288Z",
              "host" => "0.0.0.0",
              "tags" => [
            [0] "sleep_aaa",
            [1] "_grokparsefailure"
        ]
    }
    error414
    {
           "message" => "error414",
          "@version" => "1",
        "@timestamp" => "2016-09-16T03:14:02.496Z",
              "host" => "0.0.0.0",
              "tags" => [
            [0] "sleep_aaa",
            [1] "_grokparsefailure"
        ]
    }
    SELECT bbb
    {"message":"SELECT bbb","@version":"1","@timestamp":"2016-09-16T03:14:19.360Z","host":"0.0.0.0","tags":["sleep_bbb"]}
    SELECT bbb3124234
    {"message":"SELECT bbb3124234","@version":"1","@timestamp":"2016-09-16T03:14:26.959Z","host":"0.0.0.0","tags":["sleep_bbb"]}xvxv
    vvvv

  • 相关阅读:
    PHP中Foreach在引用时的陷阱 j神
    Yii中Session和cookie的用法 j神
    如何解决web大流量、高并发的问题 j神
    PHP无限级分类的递归算法 j神
    关于breadcrumbs j神
    MySQL索引分析和优化 j神
    Yii笔记 j神
    YII中的URL Management j神
    forward与redirect的区别 j神
    网络编程学习笔记
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350255.html
Copyright © 2020-2023  润新知