0

Once in a while the root disk (16G) on my Apache 2.4.7/Ubuntu14.4/AWS server gets full.

Restarting Apache clears a few gigs.

I found that Apache leaves deleted log files locked so they aren't really deleted.

What is the best practice to avoid the disk fill-up besides restarting Apache weekly?

1
  • How exactly did you find that Apache leaves the log files locked? Jun 2 '16 at 7:17
1

You should be able to create a daily or weekly cron job to clean up these log files, however, it might be a good idea to figure out why the log files are getting so large to begin with ...

If your server is filling up multiple gigs of log files in a weeks worth of time it might be caused by a misconfiguration and the logs are merely a symptom of the root cause.

If your server is being attacked (even if attacks are unsuccessful) it could cause you to get a large number of logs. Installing fail2ban might be worth while.

If you really do not care about the logs and just need them to not fill up your harddrive, you could create a symlink to /dev/nul ... although this is NOT recommended.

0

Something like logrotate can help to keep your logs under control if properly configured.

Other than that you can launch apache with custom options defined in order to change its working folder to another partition or mount point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.