English 中文(简体)
syslog: on ubuntu, how to configure rotation and gzip ing of syslog files?
原标题:

how do you configure rotation of syslog log files on ubuntu?

in my /etc/syslog.conf, i have this line:

local1.* /var/log/log.txt

over time, the following backup files have appeared:

/var/log/log.txt.0.gz /var/log/log.txt.1.gz

how do i configure how often these files get generated, and how to clean them out?

问题回答

Ubuntu uses two log rotation mechanisms.

System log files which are configured via /etc/syslog.conf are rotated through /etc/cron.*/sysklogd which in turn uses /usr/sbin/syslogd-listfiles to get the list of files which need to be rotated.

The other tool is logrotate which is configured through /etc/logrotate.conf and scripts in /etc/logrotate.d

The advantage of the sysklogd mechanism is that new syslog files added to syslog.conf are automatically rotated without writing an extra logrotate script. syslogd-listfiles is a bit complex and it rotates some logfiles on a daily bases which is not always useful on an inactive system. So I set $everything=0 ; to disable the daily rotation of . syslog entries thus making the default to rotate purely based on log file size.





相关问题
Best logging approach for composite app?

I am creating a Composite WPF (Prism) app with several different projects (Shell, modules, and so on). I am getting ready to implement logging, using Log4Net. It seems there are two ways to set up the ...

How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

How to validate Java logging properties files?

I have a basic facility for allowing users to remotely apply changes to the logging files in my application. Some logs are configured using java.util.logging properties files, and some are configured ...

Logging SAS scripts

I ve been developing a lot of Java, PHP and Python. All of which offer great logging packages (Log4J, Log or logging respectively). This is a great help when debugging applications. Especially if the ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

热门标签