[syslog-ng] using a logfile per host, with it's own name

Jacco Rens readlists at jaccorens.com
Tue Jun 27 12:51:40 CEST 2006


Hi List-members,

I just started using syslog-ng, and I am still not confident with the  
technique to write the config files.

What I basically want, is every host that send the udp syslog, to log  
in it's own file. Hereunder is what I have now, but that seems not to  
do the trick. Maybe there's an better technique for this? And I don't  
want the program, where '/var/log/HOSTS/$HOST/' is used.


Best,
Jacco

options {
         use_dns(no);
         keep_hostname(yes);
         long_hostnames(off);
         sync(1);
         log_fifo_size(1024);
         create_dirs(yes);
};

source src { udp(); };

#
#	ADSL logfiles
#
destination d_adsluitgeest { file("/var/log/routers/ 
adsluitgeest.log"); };
destination d_adslhaarlem { file("/var/log/routers/adslhaarlem.log"); };
destination d_adslbijenkorf { file("/var/log/routers/ 
adslbijenkorf.log"); };
destination d_adslcs { file("/var/log/routers/adslcs.log"); };
destination d_adslalkmaar { file("/var/log/routers/adslalkmaar.log"); };

#
#	ADSL filters
#
filter f_adsluitgeest { host(192.168.1.2); };
filter f_adslhaarlem { host(192.168.4.2); };
filter f_adslbijenkorf { host(192.168.3.2); };
filter f_adslcs { host(192.168.2.2); };
filter f_adslalkmaar { host(192.168.5.2); };

#
#	ADSL programs
#
log { source(src); filter(f_adsluitgeest); destination 
(d_adsluitgeest); };
log { source(src); filter(f_adslhaarlem); destination(d_adslhaarlem); };
log { source(src); filter(f_adslbijenkorf); destination 
(d_adslbijenkorf); };
log { source(src); filter(f_adslcs); destination(d_adslcs); };
log { source(src); filter(f_adslalkmaar); destination(d_adslalkmaar); };


More information about the syslog-ng mailing list