TransWikia.com

How do I configure rsyslog to write to /var/log/{hostname of sender} when receiving remote logs?

Super User Asked by x-x on February 13, 2021

My ADSL modem supports remote logging via syslog. I have set up my server, running rsyslog, to accept the log messages from the modem and they are being show in /var/log/syslog along with the messages generated on the server. The log looks like this:

(timestamp) (hostname) (program): (message)

Where hostname is either server or modem.

I’ve look over the (terrible, IMO) documentation, and found this example that looks like what I need, but I can’t make it work in my situation.

How do I configure rsyslog to write the logs received from the modem to /var/log/modem instead of /var/log/syslog?

The modem IP is static, if that helps to simplify the answer.

Moderators: This post should probably have a rsyslog tag instead of syslog, but my reputation isn’t high enough to create it.

One Answer

Using a simple template to create one file for each host:

$template DynaFile,"/var/log/%HOSTNAME%"
*.* -?DynaFile

Source: How to separate log files by host name of sending device?

I'm not sure if the right property to use in this case is 'hostname', 'source' or 'fromhost', but from my understanding of the properties documentation any of them will work in your case.

Answered by MOzSalles on February 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP