gpt4 book ai didi

Is there a way to write logs to a file without appending the timestamp using fluentd?(有没有一种方法可以在不附加时间戳的情况下使用fluentd将日志写入文件?)

转载 作者:bug小助手 更新时间:2023-10-24 17:54:32 27 4
gpt4 key购买 nike



I intend to write some logs to a file called output.log using fluentd. Im using this configuration

我打算使用fluentd将一些日志写入一个名为output.log的文件。IM正在使用此配置


<match foo.*>
@type file
path /var/log/output
path_suffix .log
append true
<buffer>
flush_mode interval
flush_interval 1m
</buffer>
format json
</match>

However fluentd is appending timestamps to the output file making it output..log. Is there a workaround to make this file output.log?

但是,fluentd将时间戳附加到输出文件,使其输出..log。是否有解决方法可以使此文件output.log?


更多回答
优秀答案推荐

Check out the documentation. Seems like you can define custom log formats. ( https://docs.fluentd.org/v/0.12/articles/common-log-formats )

请查看文档。看起来您可以定义自定义日志格式。(https://docs.fluentd.org/v/0.12/articles/common-log-formats)


format /^\[[^ ]* \] \[(?<level>[^\]]*)\] \[pid (?<pid>[^\]]*)\] \[client (?<client>[^\]]*)\] (?<message>.*)$/


I know I'm coming in late but it might still serve future readers - the following could help: https://docs.fluentd.org/configuration/buffer-section#empty-keys:

我知道我来晚了,但它仍然可能服务于未来的读者-以下可能会有所帮助:https://docs.fluentd.org/configuration/buffer-section#empty-keys:


So:

所以:


  <store>
@type file
path .../filename
append true
<buffer []>
flush_mode immediate # that's what I wanted for testing
# ...
</buffer>
</store>

Creates file named .../filename.log

创建名为.../filename.log的文件


更多回答

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