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的文件
更多回答
我是一名优秀的程序员,十分优秀!