File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 3030 @type forward
3131 port 24224
3232 bind 0.0.0.0
33+ # Add source hostname to records
34+ source_hostname_key source_hostname
3335</source>
3436
3537# Add additional metadata
3840 <record>
3941 hostname "#{Socket.gethostname}"
4042 fluentd_hostname "#{ENV['FLUENTD_HOSTNAME']}"
41- tag ${tag}
4243 </record>
4344</filter>
4445
45- # Clean container names (Ruby needed) by removing leading slashes
46+ # Clean container names and set proper host field
4647<filter docker.**>
4748 @type record_transformer
4849 enable_ruby true
4950 <record>
51+ # cleanup container names by removing leading slashes
5052 container_name ${record["container_name"] ? record["container_name"].sub(/^\//, '') : record["container_name"]}
53+ # Use source hostname from forward input as the host field for GELF
54+ host ${record["source_hostname"] || record["source"] || record["_hostname"] || "unknown"}
5155 </record>
5256</filter>
5357
6468 protocol udp
6569 add_msec_time true
6670 flush_interval 5s
71+ # Use the host field from record for GELF host field
72+ use_record_host true
73+ # Map the correct fields for Graylog
74+ <format>
75+ @type json
76+ </format>
6777 <buffer>
6878 @type file
6979 path /fluentd/buffer/graylog
You can’t perform that action at this time.
0 commit comments