Just for background info, I compiled syslog-ng v1.5.9 under Solaris 8. I would like to make a statement similar to this: log { file("/var/log/$host/$year/$month"); }; to write the log to "/var/log/ns01/2001/10". I know this is possible by several filters, but that would be a ton of filters (especially since this will be breaking up at least 20 hosts). I've read over the online documentation and the man page for syslog-ng.conf and the closest I've seen to what I'm looking for is the file( ) macros. Can someone provide examples of using the macros or point me to online documentation outlining this? _________________________________________________________________ Nicholas Berry RagingWire Telecommunications, Inc. Systems Engineer 2710 Gateway Oaks-South, Suite 300 nberry@ragingwire.com Sacramento, CA 95833 http://www.ragingwire.com Tel: 916.286.4048 Fax: 916.921.4048
On Mon, 1 Oct 2001, Nicholas Berry wrote:
Just for background info, I compiled syslog-ng v1.5.9 under Solaris 8.
I would like to make a statement similar to this: log { file("/var/log/$host/$year/$month"); }; to write the log to "/var/log/ns01/2001/10". I know this is possible by several filters, but that would be a ton of filters (especially since this will be breaking up at least 20 hosts).
I guess you have to use _uppercase_ characters for macros. Here's how I accomplished this: [1] Add create_dirs(yes) to global options Without creat_dirs set to yes syslog-ng will not be able to do what you want ! [2] Define sources source local { sun-streams("/dev/log" door("/etc/.syslog_door")); internal(); }; [3] define _one_ destination using macros: Example from my current syslog-ng.conf: destination local_default { file("/var/log/$YEAR/$MONTH/$DAY/$PROGRAM") owner(root) group(ics) perm(0640) dir_perm(0755)); }; ... in your case file("/var/log/$HOST/$YEAR/$MONTH") should do the job [4] log to this destination log { source(local); destination(local_default); }; use filters here if required regards -- Christian Korschan Systems Specialist CTBTO/IDC Vienna International Centre Email: Christian.Korschan@CTBTO.ORG P.O. BOX 1200 Phone: +43(1)26030 6184 A-1400 Vienna, Austria FAX: +43(1)26030 5932
participants (2)
-
Christian Korschan
-
Nicholas Berry