gpt4 book ai didi

regex - FluentD 日期时间格式不匹配

转载 作者:行者123 更新时间:2023-12-02 04:35:31 27 4
gpt4 key购买 nike

这是我的 FluentD 解析器配置:

<filter format.3.**>                                                                                                                                                                                                                                                      
@type parser
format /^\[(?<module>[^\]]+)\] (?<time>.+): (?<msg>.*)$/
time_format %Y-%m-%d %H:%M:%S
key_name log
keep_time_key true
reserve_data false
</filter>

这是一个示例日志行:

[Macaron] 2017-04-26 16:54:26: Started GET / for 172.20.0.0  

在我得到的 FluentD 错误日志中:

2017-04-27 12:01:58 +0000 [warn]: plugin/filter_parser.rb:69:rescue in block in filter_stream: invalid time format: value = 2017-04-27 12:01:58, error_class = ArgumentError, error = invalid strptime format - `%Y-%m-%d %H:%M:%S'

重要的是:

invalid time format: value = 2017-04-27 12:01:58, error_class = ArgumentError, error = invalid strptime format - `%Y-%m-%d %H:%M:%S'

但我看不出 %Y-%m-%d %H:%M:%S2017-04-27 12:01:58 不匹配,或者为什么这种格式无效。

according to this tool it should match

最佳答案

我想通了,日志中有一些特殊字符可以设置颜色。显然,当将它们复制粘贴到 fluentular.herokuapp.com 时,它们没有被复制,这就是它在那里工作的原因:

{"log":"[Macaron] \u001b[1;32m2017-04-27 12:34:07: Completed /node 200 OK in 1.163351ms\u001b[0m\n","stream":"stdout","time":"2017-04-27T12:34:07.953993591Z"}

关于regex - FluentD 日期时间格式不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43657331/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com