I use a similar directory hierarchy for my logs, and use the attached script to make a monthly archive of old logs. I run this once a month on the first, and it tars all log files over 3 months old to /var/log/archive/ . It removes any log files that it archives, cleans up any .offset files left by logtail, and prunes any empty directories out of the hierarchy. I hope you find it useful. Russell On Mon, Jun 02, 2003 at 11:58:20AM +0200, Jens Grigel wrote:
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
_______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng Frequently asked questions at http://www.campin.net/syslog-ng/faq.html