zoukankan      html  css  js  c++  java
  • logstash urldecode filter 插件

    Urldecode filter plugin
    
    设置                           输入类型             	
    	
    
    field                           字符串
    
    [elk@node01 conf]$ cat t6.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:ipaddress}s*(?<aaaa>([a-z]+S+[0-9]+))s*(?<bbbb>([0-9]+S+[a-z]+)).*"]  
        } 
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          }
    
    
    [elk@node01 conf]$ logstash -f t6.conf 
    Settings: Default pipeline workers: 4
    Pipeline main started
    10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb
    {
           "message" => "10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb",
          "@version" => "1",
        "@timestamp" => "2018-07-28T06:34:12.556Z",
              "host" => "node01",
         "ipaddress" => "10.2.3.4",
              "aaaa" => "a%E6%B3%B0%E9%9A%86999",
              "bbbb" => "99998%E6%B5%8B%E8%AF%95bbb"
    }
    
    	
    add_fileds  
    
    [elk@node01 conf]$ cat t6.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:ipaddress}s*(?<aaaa>([a-z]+S+[0-9]+))s*(?<bbbb>([0-9]+S+[a-z]+)).*"]  
        } 
     mutate {
      add_field =>["eeeee","ffffff"]
     }
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          }
    	  
    	  
    
    [elk@node01 conf]$ logstash -f t6.conf  
    Settings: Default pipeline workers: 4
    Pipeline main started
    10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb
    {
           "message" => "10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb",
          "@version" => "1",
        "@timestamp" => "2018-07-28T06:39:39.207Z",
              "host" => "node01",
         "ipaddress" => "10.2.3.4",
              "aaaa" => "a%E6%B3%B0%E9%9A%86999",
              "bbbb" => "99998%E6%B5%8B%E8%AF%95bbb",
             "eeeee" => "ffffff"
    }
    
    	
    field string:
    [elk@node01 conf]$ cat t6.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:ipaddress}s*(?<aaaa>([a-z]+S+[0-9]+))s*(?<bbbb>([0-9]+S+[a-z]+)).*"]  
        } 
     mutate {
      add_field =>["eeeee","ffffff"]
     }
      urldecode{
      field=>[aaaa]
    }
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          } 
    	  
    
    [elk@node01 conf]$ logstash -f t6.conf 
    Settings: Default pipeline workers: 4
    Pipeline main started
    10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb
    {
           "message" => "10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb",
          "@version" => "1",
        "@timestamp" => "2018-07-28T06:42:18.906Z",
              "host" => "node01",
         "ipaddress" => "10.2.3.4",
              "aaaa" => "a泰隆999",
              "bbbb" => "99998%E6%B5%8B%E8%AF%95bbb",
             "eeeee" => "ffffff"
    }
    
    	
    	
    Invalid setting for urldecode filter plugin:
    
      filter {
        urldecode {
          # This setting must be a string
          # Expected string, got ["aaaa", "bbbb"]
          field => ["aaaa", "bbbb"]
          ...
        }
      } {:level=>:error}	
    	
      urldecode{
      field=>[aaaa,bbbb]
    }
    
    这样写是不行的 
    
    [elk@node01 conf]$ cat t6.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:ipaddress}s*(?<aaaa>([a-z]+S+[0-9]+))s*(?<bbbb>([0-9]+S+[a-z]+)).*"]  
        } 
     mutate {
      add_field =>["eeeee","ffffff"]
     }
      urldecode{
      field=>aaaa
    }
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          } 
    [elk@node01 conf]$ logstash -f t6.conf 
    Settings: Default pipeline workers: 4
    Pipeline main started
    10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb
    {
           "message" => "10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb",
          "@version" => "1",
        "@timestamp" => "2018-07-28T06:47:46.966Z",
              "host" => "node01",
         "ipaddress" => "10.2.3.4",
              "aaaa" => "a泰隆999",
              "bbbb" => "99998%E6%B5%8B%E8%AF%95bbb",
             "eeeee" => "ffffff"
    }
    
    
    [elk@node01 conf]$ cat t6.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:ipaddress}s*(?<aaaa>([a-z]+S+[0-9]+))s*(?<bbbb>([0-9]+S+[a-z]+)).*"]  
        } 
     mutate {
      add_field =>["eeeee","ffffff"]
     }
      urldecode{
       all_fields=>true
    }
      
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          } 
    [elk@node01 conf]$ logstash -f t6.conf 
    Settings: Default pipeline workers: 4
    Pipeline main started
    10.2.3.4 a%E6%B3%B0%E9%9A%86999 99998%E6%B5%8B%E8%AF%95bbb
    {
           "message" => "10.2.3.4 a泰隆999 99998测试bbb",
          "@version" => "1",
        "@timestamp" => "2018-07-28T06:51:16.625Z",
              "host" => "node01",
         "ipaddress" => "10.2.3.4",
              "aaaa" => "a泰隆999",
              "bbbb" => "99998测试bbb",
             "eeeee" => "ffffff"
    }	
    	
  • 相关阅读:
    Atitit 图像处理类库 halcon11  安装与环境搭建attilax总结
    Atitit  undac网络设备管理法案 (路由器 交换机等)    法案编号USRr101510
    Atitit 图像处理 halcon类库的使用  范例边缘检测 attilax总结
    Atitit Seed-Filling种子填充算法attilax总结
    Atitti 图像处理 特征提取的科技树 attilax总结
    Atitit 软件体系的进化,是否需要一个处理中心
    Atitit 项目的主体设计与结构文档 v5
    Atitti 过程导向 vs 结果导向 attilax的策略
    Atitti 过程导向 vs 结果导向 attlax的策
    Atitit 版本管理----分支管理
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349076.html
Copyright © 2011-2022 走看看