2

I have a web server which I have clearly not set up properly. One of the users (which webmin makes the owner of most of the sites) has 15G log files (even after the backup copies were removed).

I am aware that these log files should be rotated but not a clue as to how that should be done. If I knew I could just set up a weekly cron job.

They are supposed to end up summarised in //home/USER/public_HTML/stats/ but that is obviously not going right. If I recall the package that is meant to be doing all that is called awstats.

Although How to properly automatically/manually rotate log files for production Rails App was interesting it did not tell me enough to help me solve my own problem.

Short version: How do I set up the log and stats packages to do their job before I run out of disk space?

1 Answer 1

3

There's no mention of what OS + version you're using, so...

  1. Ensure logrotate is installed (which logrotate)
  2. First try logrotate -vf /etc/logrotate.d/apache2.conf

This does a verbose + forced log rotation.

Now the tricky part. If you're using Webmin, the apache log files may be in a slightly different place than /etc/logrotate.d/apache2.conf expects them to be.

Since you know your log file size (15G), you also know the log file path.

Ensure when you run logrotate -vf /etc/logrotate.d/apache2.conf - that the correct log file path used.

If not, then you'll have to determine whether it's best to modify your logrotate config file (probably best) or your apache config file, remembering to move all your old log files to new log file location.

Likely changing your logrotate config file for apache will be least work.

1
  • When you run a command like logrotate -vf /etc/logrotate.d/apache2.conf, then only that conf file is read and /etc/logrotate.conf is ignored (I use centos 7). This can lead to unexpected behavior. If you want to get consistent results with what the system would do, use logrotate -vf /etc/logrotate.conf instead. Commented Sep 19, 2019 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .