5

logstash过滤器(2)date

 2 years ago
source link: https://wakzz.cn/2019/01/17/logstash/%E8%BF%87%E6%BB%A4%E5%99%A8(2)date/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

logstash过滤器(2)date

祈雨的博客
2019-01-17

按指定的时间格式读取事件的指定字段值后,赋值给指定的字段(默认为@timestamp)。

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

参数 类型 是否必须 默认值

match array 否 []

target string 否 @timestamp

timezone string 否

match

按指定的时间格式格式化指定字段,可以指定多个时间格式,参数为[ field, formats... ],例如:

match => [ "logdate", "yyyy-MM-dd HH:mm:ss",  "yyyy-MM-dd", "ISO8601" ]

target

将匹配的时间戳赋值给定的目标字段中。默认为赋值给@timestamp字段。

timezone

指定日期解析的shiqu,有效的ID值域在Joda.org可用时区页面上。

logstash会将时间格式化为UTC时间,即比北京时间早8小时。如果非要校准该8小时时间差,可指定timezone字段为UTC+0的时区。但是不建议这么做,因为elasticsearch内部也是使用UTC时间储存时间,使用错误的时区会导致需要做额外的时间转换处理。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK