Fluent out_file 插件,每天创建一个输出文件
Fluent out_file plugin to create single output file for each day
我正在使用 out_file fluent 插件(版本 0.12.35)将输出写入本地文件。我的流利配置看起来像:
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<source>
@type http
port 8888
bind 0.0.0.0
body_size_limit 32m
keepalive_timeout 10s
</source>
<match **>
type file
path /var/log/test/logs
format json
time_slice_format %Y%m%d
time_slice_wait 24h
compress gzip
include_tag_key true
utc
buffer_path /var/log/test/logs.*
</match>
这会每 ~10 分钟创建多个 gz 文件。
-rw-r--r-- 1 root root 256546 May 6 07:03 logs.20170506_0.log.gz
-rw-r--r-- 1 root root 260730 May 6 07:14 logs.20170506_1.log.gz
-rw-r--r-- 1 root root 261155 May 6 07:25 logs.20170506_2.log.gz
-rw-r--r-- 1 root root 258903 May 6 08:56 logs.20170506_10.log.gz
-rw-r--r-- 1 root root 282680 May 6 09:08 logs.20170506_11.log.gz
...
-rw-r--r-- 1 root root 261973 May 6 10:44 logs.20170506_19.log.gz
我想知道每天创建一个 gzip 文件的方法。即使将 time_slice_wait
设置为 24h
也无济于事。
在配置中遗漏了一件愚蠢的事情:https://docs.fluentd.org/output/file#append
更新配置
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<source>
@type http
port 8888
bind 0.0.0.0
body_size_limit 32m
keepalive_timeout 10s
</source>
<match **>
type file
path /var/log/test/logs
format json
time_slice_format %Y%m%d
time_slice_wait 24h
compress gzip
include_tag_key true
utc
buffer_path /var/log/test/logs.*
append true
</match>
如果有人继续出错,在匹配块中,type
也应该是 @type
。
我正在使用 out_file fluent 插件(版本 0.12.35)将输出写入本地文件。我的流利配置看起来像:
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<source>
@type http
port 8888
bind 0.0.0.0
body_size_limit 32m
keepalive_timeout 10s
</source>
<match **>
type file
path /var/log/test/logs
format json
time_slice_format %Y%m%d
time_slice_wait 24h
compress gzip
include_tag_key true
utc
buffer_path /var/log/test/logs.*
</match>
这会每 ~10 分钟创建多个 gz 文件。
-rw-r--r-- 1 root root 256546 May 6 07:03 logs.20170506_0.log.gz
-rw-r--r-- 1 root root 260730 May 6 07:14 logs.20170506_1.log.gz
-rw-r--r-- 1 root root 261155 May 6 07:25 logs.20170506_2.log.gz
-rw-r--r-- 1 root root 258903 May 6 08:56 logs.20170506_10.log.gz
-rw-r--r-- 1 root root 282680 May 6 09:08 logs.20170506_11.log.gz
...
-rw-r--r-- 1 root root 261973 May 6 10:44 logs.20170506_19.log.gz
我想知道每天创建一个 gzip 文件的方法。即使将 time_slice_wait
设置为 24h
也无济于事。
在配置中遗漏了一件愚蠢的事情:https://docs.fluentd.org/output/file#append
更新配置
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<source>
@type http
port 8888
bind 0.0.0.0
body_size_limit 32m
keepalive_timeout 10s
</source>
<match **>
type file
path /var/log/test/logs
format json
time_slice_format %Y%m%d
time_slice_wait 24h
compress gzip
include_tag_key true
utc
buffer_path /var/log/test/logs.*
append true
</match>
如果有人继续出错,在匹配块中,type
也应该是 @type
。