Is there any way to adding a Tag to Logs which sent by rsyslog?
I send these logs to another server, and I can detect source IP as destination, but I need to adding tag in source.
Adding Tag (i.e. Source IP) to rsyslog for sending to rsyslog remote server
rsyslogsyslog
Best Answer
You should be able to match the hostname of the system emitting your log. Isn't that enough?
Rsyslog has an option
$PreserveFQDN on
, to replace that hostname with your FQDN, which is probably better with syslog concentrators, ...I suppose on the other end you have some logstash or elasticsearch? Either way, rsyslog also allows you to define templates such as:
Note that the sample logstash forwarder assumes your input definition includes
codec => json
. ThefoobarStaticTag
being whatever Tag you wanted to add.