目的
fluentdで集約した際にどのサーバで記録されたログなのかわからなくなるため
config
td−agent2に標準でついてくるFilterプラグインを使用
#単純にtail
<source>
type tail
path ログ場所
format none
tag tag.hostname #適当に
</source>
#hostname追加
<filter tag.hostname>
@type record_transformer
<record>
hostname ${hostname}
</record>
</filter>
#転送
# 集約サーバーへ送信,.
<match tag.hostname>
type forward
<server>
</server>
</match>
結果
2015-10-26T12:14:22+09:00 tag.hostname {"message":"host:〜〜〜〜〜〜"hostname":"送信してきたホスト名"}