[syslog-ng] clearing log files
Gergely Nagy
algernon at madhouse-project.org
Wed Nov 10 18:14:42 CET 2010
> Theres a product called 'logrotate' that performs this task. Though not
> related to syslog-ng in any way.
It is also possible to do it with syslog-ng, to some extent: using
macros one can set up a destination that delivers messages, to say,
/var/log/messages-$MONTH.log (and thus, logs will start accumulating
in a new file every month, and rotating each year), or if more
frequent "clearing" is required, /var/log/messages-$DAY.log works too.
For example, this destination would accomplish something like this:
destination d_monthly {
file("/var/log/messages-$MONTH.log");
};
The downside of this is that logs aren't archived, and are
overwritten. logrotate and similar tools can save the old logs and
archive them, if so need be.
The administrator guide has an extensive list of available macros:
http://www.balabit.com/sites/default/files/documents/syslog-ng-ose-v3.1-guide-admin-en.html/index.html-single.html#reference_macros
More information about the syslog-ng
mailing list