Skip to content

Could you add hostname option to in_tail.rb ? #82

Closed
wants to merge 2 commits into from

3 participants

@baepiff
baepiff commented Nov 26, 2012

Configuration :

type tail
format /^(?[^ ]) (?[^ ]) (?[^ ]) [(?[^]])] "(?\S+)(?: +(?[^ ]) +\S)?" (?[^ ]) (?[^ ])(?: "(?[^\"])" "(?[^\"])" "(?[^\"])" (?[^ ]))?$/
path /usr/local/nginx/logs/access.log
pos_file /var/log/td-agent/access.log.pos
time_format %d/%b/%Y:%H:%M:%S %z
tag hostname.in.tail
hostname_command hostname

Result :

2012-11-27T00:00:43+09:00 hostname.in.tail {"hostname":"myhost","remote":"172.28.32.249","host":"-","user":"-","method":"GET","path":"/monitor","code":"200","size":"15","referer":"-","agent":"-","forward":"-","response_time":"0.003"}

@repeatedly repeatedly was assigned Nov 29, 2012
@repeatedly
Fluentd: Unified Logging Layer member

Thanks for the pull request again.
But this feature seems to be general problem.
I am thinking about adding field to input record in Input plugin side.
Please wait.

@baepiff
baepiff commented Nov 30, 2012

Thank you for your review. Oops Sorry for format thing. It was broke.

This hostname_command option was inspired by dstat plugin.
Users can customize hostname_command like "hostname" or "hostname -s" in different OS environments.
I believe that this option helps people who runs many servers.

May I ask what "general problem" does mean?

@repeatedly
Fluentd: Unified Logging Layer member

This problem is the one of 'Adding custom field to input record before tag routing'.
So I said 'general problem'.

@zackangelo

@repeatedly have you given any more thought to the 'adding custom input field' problem? I'd also like my log records to contain a hostname field (in addition to other things, like the tag itself).

@repeatedly
Fluentd: Unified Logging Layer member

@baepiff @zackangelo

Changing Engine.emit APIs breaks backward compatibility.
So I released new filter plugin to resolve this issue.

https://github.com/repeatedly/fluent-plugin-record-modifier

What do you think about this plugin?
Do you see any problems?

@repeatedly repeatedly closed this Apr 30, 2013
@repeatedly
Fluentd: Unified Logging Layer member

Some users use above plugin to add hostname. So close this pull request.

FYI, v11 has filter layer so v11 has already fixed this pull request in an efficient way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.