zoukankan      html  css  js  c++  java
  • logstash 删除message host字段

    [elk@node01 conf]$ cat t3.conf 
    input {
      syslog {
       port=>"514"
       }
    }
    
    output {  
            stdout {  
                codec => rubydebug  
            }  
          } 
    [elk@node01 conf]$ cat t4.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:xxxx}"]  
        } 
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          } 
    [elk@node01 conf]$ logstash -f t4.conf 
    Settings: Default pipeline workers: 4
    Pipeline main started
    192.168.137.1
    {
           "message" => "192.168.137.1",
          "@version" => "1",
        "@timestamp" => "2018-04-07T03:03:55.366Z",
              "host" => "node01",
              "xxxx" => "192.168.137.1"
    }
    
    [elk@node01 conf]$ 
    [elk@node01 conf]$ cat t4.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:xxxx}"]  
        } 
     mutate {  
      remove_field =>["message"]
    }
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          } 
    [elk@node01 conf]$ logstash -f t4.conf 
    Settings: Default pipeline workers: 4
    Pipeline main started
    192.168.137.1
    {
          "@version" => "1",
        "@timestamp" => "2018-04-07T03:07:02.258Z",
              "host" => "node01",
              "xxxx" => "192.168.137.1"
    }
    
    
    
    [elk@node01 conf]$ cat t4.conf 
    input {
       stdin{}
    }
    
    filter {  
        grok {  
            match => ["message", "%{IPORHOST:xxxx}"]  
        } 
     mutate {  
      remove_field =>["message"]
      remove_field =>["host"]
    }
    }
    output {  
            stdout {  
                codec => rubydebug  
            }  
          } 
    [elk@node01 conf]$ logstash -f t4.conf 
    Settings: Default pipeline workers: 4
    Pipeline main started
    192.168.137.1
    {
          "@version" => "1",
        "@timestamp" => "2018-04-07T03:08:35.546Z",
              "xxxx" => "192.168.137.1"
    }

  • 相关阅读:
    解决Docker安装慢
    Spring Boot源码分析-启动过程
    Ubuntu安装Docker
    Jenkins搭建
    Hexo搭建静态博客站点
    FactoryBean简介以及Mybatis-Spring应用
    ArrayList源码分析
    Spring AOP-用代理代替繁琐逻辑
    Spring Validation-用注解代替代码参数校验
    Netty学习(4):NIO网络编程
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349209.html
Copyright © 2011-2022 走看看