BCards-Scripts-Server/nginx/fluentd/fluent.conf
2025-07-22 21:24:07 -03:00

40 lines
867 B
Plaintext

# Fluentd configuration for BCards log aggregation
<source>
@type tail
path /var/log/nginx/access.log
pos_file /fluentd/log/access.log.pos
tag nginx.access
format nginx
time_format %d/%b/%Y:%H:%M:%S %z
</source>
<source>
@type tail
path /var/log/nginx/error.log
pos_file /fluentd/log/error.log.pos
tag nginx.error
format /^(?<time>\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) \[(?<level>\w+)\] (?<message>.*)/
time_format %Y/%m/%d %H:%M:%S
</source>
<filter nginx.**>
@type record_transformer
<record>
hostname "#{Socket.gethostname}"
service nginx
environment production
</record>
</filter>
<match nginx.**>
@type file
path /fluentd/log/nginx
append true
time_slice_format %Y%m%d
time_slice_wait 10m
time_format %Y%m%dT%H%M%S%z
buffer_type file
buffer_path /fluentd/log/nginx.buffer
flush_interval 30s
</match>