自定义timestamp
在filebeat采集日志时,会需要将日志中的具体时间用于@timestamp字段,供后续的时间查找等等,在7.16版本中可以使用timestamp processor:https://www.elastic.co/guide/en/beats/filebeat/current/processor-timestamp.html 来进行处理
"2022-01-26 06:43:31.632 | log message"
1.1.1.1 - - [27/Jan/2022:17:08:47 +0800] "GET xxxx"
要注意的是layouts必须使用固定的时间来进行表示,之前没认真看文档,导致时间一直是错误时间
以下配置可以同时处理上述日志格式,获取到真实的日志实时作为timestamp字段存储到es中
- script:
lang: javascript
id: timestamp_filter
tag: enable
source:

本文介绍如何在Filebeat 7.16版本中通过timestamp processor配置来自定义日志的时间戳字段@timestamp,以实现精确的日志时间记录,并提供了一个能够处理多种日志格式的示例配置。
最低0.47元/天 解锁文章
1779





