We've setup a central log server using rsyslog. I was just wondering if it's possible to send the ip address along with the syslog message from the client.
I'm sending the message using a template and tried using %fromhost-ip%
. As expected it's showing up as 127.0.0.1
on the remote server.
So I was wondering is there any way we can embed a bash variable in the
rsyslog.conf.
The only other alternative I see is to hardcode the ip which doesn't look too nice.
I'm currently using the below template.
$template linux_err,"<%PRI%>%TIMESTAMP% %source% %syslogtag% %smg%"
Guess using the %fromhost-ip%
on the receiving server is the only option.
%hostname%
on the sender you should get something unique, if you have configured a hostname. Or use%fromhost-ip%
in a format template on the server receiving the messages to change the message.