简体   繁体   English

匹配Logstash正确的日期格式

[英]match logstash correct date format

I have some logs files with the following timestamp format : 2014-04-22 16:08:22,455 我有一些带有以下时间戳格式的日志文件:2014-04-22 16:08:22,455

I would like to know which is the correct config filter to parse it. 我想知道哪个是解析它的正确配置过滤器。

I have the following pattern: 我有以下模式:

DATE (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})

This is my grok filter: 这是我的希腊过滤器:

grok {
  patterns_dir => "./patterns"
  match => ["message", "%{DATE:date}"]  
}

But then I don't know what to put in the filter date, I know that it's not 但后来我不知道要在过滤日期中加上什么,我知道这不是

date {
  match => ["date","YYYY-MM-dd HH:mm:ss"]
}

Thanks in advance for your help. 在此先感谢您的帮助。

If your grok works correctly (eg you get the "date" field with the contents of your log date correctly groked (parsed) in the output, then this should work: 如果您的日志正常工作(例如,您在输出中正确删除(解析了)日志日期内容的“日期”字段,那么这应该工作:

date {
    match => [ "date" , "yyyy-MM-dd HH:mm:ss,SSS" ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM