我正在寻找一种将 source_hostname 发送到 fluentd 目标服务器的方法。
我在logstash上,但我们有代理/服务器端,我们有变量来获取logstash服务器配置文件中的源主机名。
我使用 FluentD 搜索类似的方法,但我发现的唯一方法是在源标记“#{Socket.gethostname}”中设置主机名。但是这样我就不能在目标日志文件的路径中使用主机名。基于来源:http ://docs.fluentd.org/articles/config-file#embedded-ruby-code
在服务器端,这就是我想做的原因:
<source>
type forward
port 24224
bind 192.168.245.100
</source>
<match apache.access.*>
type file
path /var/log/td-agent/apache2/#{hostname}/access
</match>
<match apache.error.*>
type file
path /var/log/td-agent/apache2/#{hostname}/error
</match>
有人可以帮我做这样的事情吗?
提前感谢您的宝贵时间。