fluent/fluentd — pull request #80 by baepiff (2012-11-22 10:43:16+00:00)
Title: Please add hostname command option to in_tail

I added hostname command option.
Because I operate over 100 servers and
I am supposed to figure out which server is in trouble.
If you had already your hostname in your log, skip this option.
Host name is added at head of line. Please see the following example.

Configuration:

type tail
format /^(?[^ ]*) (?[^ ]*) (?[^ ]*) (?[^ ]*) \[(?[^\]]*)\] "(?\S+)(?: +(?[^ ]*) +\S*)?" (?[^ ]*) (?[^ ]*)(?: "(?[^\"]*)" "(?[^\"]*)" "(?[^\"]*)" (?[^ ]*))?$/
path /nginx/logs/access.log
pos_file /var/log/td-agent/access.log.pos
tag access
hostname_command hostname

Result:
2012-11-22T16:29:42+09:00 access {"hostname":"myhost","remot-address":"1.1.1.1","host":"-","user":"-","method":"GET","path":"/test/","status":"200","size":"9268","referer":"http://test","agent":"Linux; U; Android 2.2.1; ja-jp; IS03 Build/S9090) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 android/1.0.0","forward":"-","response_time":"0.103"}