[syslog-ng] Log rotation in Syslog-ng [WARNING - NOT VIRUS SCANNED]

PÁSZTOR György pasztor at linux.gyakg.u-szeged.hu
Mon Aug 10 22:57:38 CEST 2015


"Justin Kala" <justinkala at gmail.com> írta 2015-08-10 15:05-kor:
> Can we control the log retention/rotation in syslog-ng.conf .Syslog-ng
> server version is 3.4 OSE Solaris 10.
> If so, how do we do it ?? Highly appreciate if you can share the examples
> /links

Log rotation is usually independent from the logging system.
Regardless if it is a Solaris, Linux, other Un*x.

Log rotation is usually a cronjob.

However, using syslog-ng you can also use template macros in the filenames,
so if the size is the main point why you want log rotation, then you can
put the year, month, day, etc. into the logfile's name.
If you want to delete the old logfiles, then... You can use the "old style"
rotation tools, or find out your own style. Eg. delete files from log
directory which are older then ...
Eg. using this as a daily cronjob:
find /var/log -type f -mtime +30 | xargs rm

Back to your question: I would check my cronjobs to find out what logrotate
tools I have, and configre them to my needs. (Or inactivate some of their
rules, and extend them with the above-written ideas)
The main point why the exact system's knowledge is inevitable is, eg. if
you use apache/lighty/nginx/other software which does not use system's log
socket to their logging, but implement their own not specific logsystem,
then the rotation of their logs may needed in the "classical" way, unless
you channel their logs into the system's log too.


More information about the syslog-ng mailing list