• tag_on_failure => [] # prevent default _grokparsefailure tag on real records


    [elk@zjtest7-frontend config]$ cat stdin04.conf 
    input {
        stdin {
        }
    }
    filter {
      # drop sleep events
      grok {
        match => { "message" => "SELECT aaa" }
        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 
    Settings: Default pipeline workers: 1
    Pipeline main started
    SELECT bbb
    {"message":"SELECT bbb","@version":"1","@timestamp":"2016-09-15T10:33:12.170Z","host":"0.0.0.0","tags":["_grokparsefailure","sleep_bbb"]}
    
    此时出现了默认的"tags":["_grokparsefailure","sleep_bbb"]
    
    
    /************************************************************
    [elk@zjtest7-frontend config]$ cat stdin04.conf 
    input {
        stdin {
        }
    }
    filter {
      # drop sleep events
      grok {
        match => { "message" => "SELECT aaa" }
        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
       }
    }
    
    }
    a
    [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin04.conf 
    Settings: Default pipeline workers: 1
    Pipeline main started
    SELECT bbb
    {"message":"SELECT bbb","@version":"1","@timestamp":"2016-09-15T10:34:39.194Z","host":"0.0.0.0","tags":["sleep_bbb"]}
    

  • 相关阅读:
    [恢]hdu 1406
    [恢]hdu 1870
    [恢]hdu 1877
    [恢]hdu 1018
    [转载]Delphi 的编译指令(2): 条件语句的更多用法
    关于 class helper for ... 语法
    [转载]Delphi 的编译指令(1): $DEFINE、$UNDEF、$IFDEF等
    [转载]Delphi 的编译指令(3): 常用的预定义条件标识符
    Delphi2009之TStringBuilder类[3]:Replace
    Delphi2009之TStringBuilder类[1]:Create
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350257.html
Copyright © 2020-2023  润新知