Am Don, 2003-05-29 um 13.38 schrieb Moktar KONE:
Hi , I am testing syslog-ng and I want to know how can I rotate my logs file . To logs messages I have a directory for many hosts, for each host, logs are classified by facilities, I have a new log file each day for each facility. so the name of my logs files changes according to the date. how can rotate the old log files? the logs of 2days ago? 3days ago? thanks this is the section that logs my files : destination hosts {
file("/var/log/HOSTS/$HOST/$FACILITY/$FACILITY_$YEAR_$MONTH_$DAY" create_dirs(yes)); };
Hi, you probably want to compress the logs: I'm calling a very short shell script through cron, should be like this for your setup: #!/bin/bash # # compress old syslog-ng logs # # date from day before yesterday date2comp=`date -d "2 days ago" +%Y_%m_%d # use find to compress the logs find /var/log/HOSTS -name "*_$date2comp" -exec bzip2 {} \; HTH, Jens