On Tue, 2009-08-18 at 09:28 +0530, Jain, Vaibhav (GE Healthcare) wrote:
Hi
I am using syslog-ng to collect the logs from different machines. I want to configure the log rotation policy. I want to know How to configure the log rotation policy? Does syslog-ng supports it? is there any relation between syslog-ng and log rotation ?
I was searching it on google and I found one example ( given below ). i want to know what is the role of syslog-ng in log rotation ? I think log rotataion is not part of syslog-ng features. Can you please suggest me the best way for log rotation?
content of /etc/logrotate.d/directadmin:
/var/log/directadmin/*.log { weekly size=1M rotate=0 create 0644 diradmin diradmin sharedscripts postrotate find /var/log/directadmin -name "20*log*" -mtime +7 -exec /bin/rm -f {} \; find /var/log/directadmin -name "20*log.?" -exec /bin/rm -f {} \; endscript }
you have multiple choices: 1) you can use date/time macros in the destination filename, in which case syslog-ng automatically opens a new logfile whenever a given interval passes. in this case you still need a cleanup mechanism, that removes old logs. 2) you can write a single file from within syslog-ng and have logrotate rotate it for you -- Bazsi