ELK-如何从日志文件中选择时间戳而不是插入时间戳

时间:2018-12-16 13:28:38

标签: elasticsearch logstash kibana

我知道有很多解决方案,但是我找不到最佳解决方案。

我正在使用ELK ** 5.x,**我正在尝试将Kibana配置为依赖于日志文件中的时间戳而不是插入时间戳中的时间戳

这是“日志”文件中的示例:

{"@timestamp":"2018-05-01T00:00:44.191Z","@version":"1","host":"x.x.x.x","lt":{"ln":"abc","mp":"2","lo":x.x,"bi":null,"px":x.x,"dm":"x","py":x.x,"pz":x.x.,"apMac":"x:x:x:x:x:x","am":null,"ap":null,"sc":-x,"ar":null,"as":0,"la":x.x,"si":"x:x:x:x:x:x","lh":null,"pn":2,"po":0},"type":"x"}

此Logstash配置文件:

filter {
    grok {
         match => ["message", "%{TIMESTAMP_ISO8601:tstamp}"]
    }

    date {
 match => ["mytimestamp", "dd/MMM/YYYY:HH:mm:ss +ZZZ"]
         }
    }

但是Kibana显示了此内容:

No results found 
Unfortunately I could not find any results matching your search. I tried really hard. I looked all over the place and frankly, I just couldn't find anything good. Help me, help you. Here are some ideas:

1 个答案:

答案 0 :(得分:1)

filter {
grok {
match => ["message", "%{TIMESTAMP_ISO8601:tstamp}"]
}
date {
match => ["tstamp", "ISO8601"]
}

}