I use a central fluentd to receive logs from several servers using syslog and then route those logs to other systems such as papertrail via the plugin: fluent-plugin-remote_syslog.
However, when the logs reaches its destination (papertrail) they all have the same tag. The tag is set by the plugin, eg:
<match syslog.**>
type remote_syslog
tag fluentd
host XXXX
port XXXX
</match>
Is it possible to set the tag to the "host" value I get from the syslog? Eg: The tag changes depending on the source server - if I send syslog message from the server logtest01 the tag should be logtest01, if I send from logtest02, the tag should be logtest02.
The syslog looks like this: {"host":"SERVERHOSTNAME","ident":"USER","pid":"9999","message":"MESSAGE_123"}
I did try the rewrite_tag_filter plugin, but I think I fail with the regexp.... This is how my config looks at the moment:
###Syslog input - this tags all with "syslog"
###Rewrite the tag to: syslog."SourceHostname" depending on the HOST value in the logentry.
rewriterule1 host ^(\w+) syslog.$1
###Sends all syslog-tagged logs to papertrail