• kibana上传日志时间与日志里面的时间不同


    中间加了一层转换,日志从filebeat采集进入logstash,然后将日志中的时间字段覆盖到es的@timestamp字段,kibana会将这个字段当做是日志的上传时间

    input {
      beats {
        port => 10515
      }
    }
    
    filter{
      if "xxx" in [tags]{
        grok {
            match => ["message","%{TIMESTAMP_ISO8601:log.date}"]
        }
        date {
            match => ["log.date", "yyyy-MM-dd HH:mm:ss,SSS"]
            target => "@timestamp"
        }
      }
      if "xxx" in [tags]{
        grok {
            match => ["message","%{TIMESTAMP_ISO8601:timestamp8601}"]
        }
        date {
            match => ["timestamp8601", "yyyy-MM-dd HH:mm:ss.SSS"]
            target => "@timestamp"
        }
      }
      if "xxx" in [tags]{
        grok {
            match => ["message","%{TIMESTAMP_ISO8601:timestamp8601}"]
        }
        date {
            match => ["timestamp8601", "yyyy-MM-dd HH:mm:ss.SSS"]
            target => "@timestamp"
        }
      }
    
    }
    
    output {
      if "xxx" in [tags]{
         elasticsearch {
           hosts => ["http://xxx:9200"]
           #index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
           index => "xxx-%{+YYYY.MM}"
           user => "xxx"
           password => "xxx"
         }
      }
    
      if "xxx" in [tags]{
         elasticsearch {
           hosts => ["http://xxx:9200"]
           #index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
           index => "xxx-%{+YYYY.MM}"
           user => "xxx"
           password => "xxx"
         }
      }
      if "xxx" in [tags]{
         elasticsearch {
           hosts => ["http://xxx:9200"]
           #index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
           index => "xxx-%{+YYYY.MM}"
           user => "xxx"
           password => "xxx"
         }
      }
    
    }
    

      

  • 相关阅读:
    pyhon学习日记第八天tkinter模块6
    python学习日记第八天tkinter模块5
    python学习日记第七天tkinter模块4
    python学习日记第七天tkinter模块3
    python学习日记第六天tkinter模块2
    python学习日记第六天tkinter模块学习1
    python学习日记第五天(飞机大战)
    python学习日记第四天
    python学习日记第三天(实例)
    Demo Nec
  • 原文地址:https://www.cnblogs.com/bill2014/p/15040986.html
Copyright © 2020-2023  润新知