• logstash multiline 按数字开头合并


    [elk@node01 conf]$ cat t7.conf 
    input {
        file {
                    type => "viewip"
                    path => ["/home/elk/conf/cccc.txt"]
                    start_position=>"beginning"
                    
            }
        
    }
    filter {
      multiline {  
      pattern => "^[0-9]"
      negate=>true  
      what=>"previous"  
     }  
    }
    
    output {
         elasticsearch {
                    hosts => "192.168.137.2:9200"
                    index => "logstash-viewip-%{+YYYY.MM.dd}"
            }
       stdout {
       codec=>rubydebug{}
     }
    }
    
    [elk@node01 conf]$ cat cccc.txt 
    1.1.1.1
    aaaaaaa
    bbbbbbb
    2.2.2.2
    ccccccc
    ddddddd
    3.3.3.3
    eeeeeee
    fffffff
    4.4.4.4
    ggggggg
    hhhhhhh
    5.5.5.5
    iiiiiii
    jjjjjjj
    kkkkkkk
    
    [elk@node01 conf]$ logstash -f t7.conf 
    Settings: Default pipeline workers: 4
    Defaulting pipeline worker threads to 1 because there are some filters that might not work with multiple worker threads {:count_was=>4, :filters=>["multiline"], :level=>:warn}
    Pipeline main started
    {
           "message" => "1.1.1.1
    aaaaaaa
    bbbbbbb",
          "@version" => "1",
        "@timestamp" => "2018-07-31T02:31:33.540Z",
              "path" => "/home/elk/conf/cccc.txt",
              "host" => "node01",
              "type" => "viewip",
              "tags" => [
            [0] "multiline"
        ]
    }
    {
           "message" => "2.2.2.2
    ccccccc
    ddddddd",
          "@version" => "1",
        "@timestamp" => "2018-07-31T02:31:35.294Z",
              "path" => "/home/elk/conf/cccc.txt",
              "host" => "node01",
              "type" => "viewip",
              "tags" => [
            [0] "multiline"
        ]
    }
    {
           "message" => "3.3.3.3
    eeeeeee
    fffffff",
          "@version" => "1",
        "@timestamp" => "2018-07-31T02:31:35.296Z",
              "path" => "/home/elk/conf/cccc.txt",
              "host" => "node01",
              "type" => "viewip",
              "tags" => [
            [0] "multiline"
        ]
    }
    {
           "message" => "4.4.4.4
    ggggggg
    hhhhhhh",
          "@version" => "1",
        "@timestamp" => "2018-07-31T02:31:35.309Z",
              "path" => "/home/elk/conf/cccc.txt",
              "host" => "node01",
              "type" => "viewip",
              "tags" => [
            [0] "multiline"
        ]
    }
    {
           "message" => "5.5.5.5
    iiiiiii
    jjjjjjj
    kkkkkkk
    ",
          "@version" => "1",
        "@timestamp" => "2018-07-31T02:31:35.319Z",
              "path" => "/home/elk/conf/cccc.txt",
              "host" => "node01",
              "type" => "viewip",
              "tags" => [
            [0] "multiline"
        ]
    }
    
    
  • 相关阅读:
    python打印出当下的小时、分钟
    flask_ajax登录注册
    flask_SQlalchemy的复杂使用
    flask使用现有的数据表、在网页中显示数据
    js 的DOMdocument的使用
    pymysql的是使用
    通过ajax修改div id="div1" 的值
    关于django2.2使用xadmin的方法
    DOS windows 使用bat脚本获取 IP MAC 系统信息
    apache https 双向证书生成
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349072.html
Copyright © 2020-2023  润新知