glogcenter/fluentd/fluent.conf
2024-09-05 17:51:13 +08:00

49 lines
989 B
Plaintext

<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<system>
log_level info
</system>
<filter *>
@type record_transformer
enable_ruby
<record>
loglevel ${case record["log"] when /.*\[info\].*/i then "INFO" when /.*\[warning\].*/i then "WARN" when /.*\[error\].*/i then "ERROR" else "DEBUG" end}
text ${record["log"]}
servername ${record["container_name"]}
serverip ${"192.168.1.9"}
date ${time.strftime('%Y-%m-%d %H:%M:%S.%3N')}
system ${"geonode"}
</record>
remove_keys container_id,container_name,source,log
</filter>
<match *>
@type copy
<http>
request_header X-GLC-AUTH glogcenter
</http>
<store>
@type http
endpoint http://127.0.0.1:8080/glc/v1/log/addBatch
open_timeout 2
http_method post
json_array true
<format>
@type json
</format>
<buffer>
flush_interval 1s
</buffer>
</store>
<store>
@type stdout
<format>
@type json
</format>
</store>
</match>