Can't logrotate be run manually?

Discuss Applications
Post Reply
User avatar
Basher52
guru
guru
Posts: 928
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Can't logrotate be run manually?

Post by Basher52 »

This server I'm trying fix up right now isn't on during night so all logs are just accumulating thus making it harder and harder to read the end.
I tried to run /etc/logrotate although the job didn't create an error, no logs were rotated. messages is still since mid December.

or what am I doing wrong

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Even if your server is shut down at night logrotate should run when the server comes back up and it probably is on your system. Look for a symlink in /etc/cron.daily, if it's there it should get executed. Now, just because logrotate is being run doesn't mean all logs should get rotated. There are configuration files for every log you want to rotate and each one can be rotated based on a different set of conditions. The logrotate config files are in /etc/logrotate.d. Which log file is not rotating that you think should be?

User avatar
Basher52
guru
guru
Posts: 928
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 »

Well first I wrote the logrotate thing wrong, I ran the /etc/cron.daily/logrotate and nothing else :oops:

As I can see there is not logrotate config for the /var/log/messages and it was this one that I wanted to watch, as you asked to in another thread.
It starts at Dec 17th and starts to be quite long and it take forever to scroll down to the bottom(since I still haven't found a way to go to the bottom straight away with VI, like the winblows CTRL-END)

oh... btw... this means that I don't have to make my own cron.daily/weekly job for logrotating? I done that for some other apps that I need to rotate at least once a week. I always thought that the /etc/cron.daily/logrotate was a rotation thing just for the files already in the system and not for "personal" use.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

You can use logrotate to rotate anything you want, even for personal stuff (see the man page). The /var/log/messages rotation configuration is in the /etc/logrotate.d/syslog config file. It doesn't override the default rotation periods defined in /etc/logrotate.conf which on my system is defined to rotate logs on a weekly basis and to keep 4 revisions.

Post Reply