Posts Tagged ‘rsylsog’

rsyslog, split file by hostname

June 10th, 2010 1 comment

Here a rsyslog snippet to create a file by day, by device. Indeed, the %now variable take a value like 2010-05-24. Note that HOSTNAME will be replace by the hostname send by the syslog client. If you want to use IP, you can use %fromhost-ip%, and if you want the DNS name resoved by the rsyslog server, use %fromhost%.

$template default,"/data/logs/%HOSTNAME%/%$now%.log"

*.* ?default

Categories: Sysadmin Tags: