[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: logrotate question



Andras Lorincz wrote:
Hi,

Not so far I had a problem with disc space and it turned out that syslog and
one more log file occupied together multiple gigabytes so I found out that
logrotate could help me. The thing is that I don't know what they mean by
rotating files, could you tell me?

It means taking the current log, saving it under a different name (and
often in a compressed format to save disk space) and starting a new
empty log file. Then you keep the older log files around for a certain
amount of time (typically one week) and after that you either delete
them or back them up on an archiving medium (tape etc.) for really
critical servers. This is normally set up as an automated process.

To illustrate it with an example, this is part of my /var/log/ directory:

syslog
syslog.0
syslog.1.gz
syslog.2.gz
syslog.3.gz
syslog.4.gz
syslog.5.gz
syslog.6.gz

"syslog" is the current log file, the rest are from 1, 2, etc. days ago.
Tonight my logs will be rotated again, which means that syslog.6.gz
(from 7 days ago) will be deleted, the names of all the other ones will
be incremented and a new "syslog" will be started.

On Debian everything about this is very well configured by default, you
just need to install the packages "logrotate" and "cron". Rotating the
logs is normally done by a cron-job during the night. If you do not
leave on your PC overnight then you need the package "anacron" which
makes sure that the cron jobs are run during the day (5 minutes after
boot by default) if they were "missed" at the night.

Regards,
           Florian



Reply to: