如何将流利的docker容器通过stdin接收的日志的时间戳更改为UTC?

我的Fluent Bit Docker容器正在向通过STDIN接收的日志添加带有本地时间的时间戳;否则,所有通过rsyslog接收或记录的日志似乎都具有UTC时间格式。

我有一个基本的EFK堆栈,我在其中运行Fluent Bit容器作为远程收集器,这些容器将所有日志转发到FluentD中央收集器,后者将所有内容推送到Elasticsearch。

我已经在Fluent Bit配置文件中添加了一个过滤器,在该文件中我尝试了许多修改时间戳的方法,但都没有用。似乎我想得太多了;修改时间戳应该容易得多。

这些都是我尝试使用 fluent-bit.conf 过滤器修改时间戳的所有方式

[FILTER]
    Name         record_modifier
    Match_Regex  ^(?!log.*).*$         ## only match the input received via stdin
    Tag          log.stdout            ## tag to mark input received via stdin 
    Add          sourcetype timestamp  ## tried to add timestamp from lua script 
    Parser       docker                ## tried to use docker parser for timestamp
    Time_key     utc                   ## tried to add timestamp as a key
    script       test.lua              ## sample lua script from fluentbit docs
    call         cb_print              ## call a function from within lua script

什么是使所有时间戳统一到UTC的 de facto 方法?任何帮助或建议,表示赞赏。

blzhi 回答:如何将流利的docker容器通过stdin接收的日志的时间戳更改为UTC?

它的工作方式是docker解析器提取'log'的内容并遵守docker定义的时间戳。

一种快速的解决方法是修改您的parsers.conf并确保docker解析器不解析时间戳,这样Fluent Bit将为您分配UTC的当前时间。

本文链接:https://www.f2er.com/2702215.html

大家都在问