Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 11 Debian servers running on rackspace cloud hosting. All running VHCS2 for hosting management. 1 server is used for application and 10 are used for only smtp. My question is regarding smtp servers. Each server hosted 1 domain. My problem is when my client use smtp there's a log created in this directory

/var/log/

but within 24 hours drives are full and server refuse all smtp connections. Then I deleted the logs and ran following command to check the disk space.

df -h

but it shows hdd still full and server is still refusing the smtp connections. Then I ran following command to see the truth

du --max-depth=1 -h

It shows the truth. The real disk space used. Then I rebooted the server and now server working fine. But after few hours same situation happened. Then I created the following script.

#!/bin/sh

rm -fr /var/log/*
rm -fr /var/log/apache2/*.log
rm -fr /var/log/apache2/*.log.*
rm -fr /var/log/apache2/users/*
rm -fr /var/log/apache2/backup/*

reboot

It worked for days but after that logs are again filling the hdd.

Now I want the following solutions. If anybody can help me.

  1. When I delete files from server hdd will free up without rebooting
  2. Log should be in specific range. Like a specific size of file where old data overwrite with new data
share|improve this question

2 Answers 2

You really need to work out which log(s) are filling the disk. Once you know which logs are the problem take a look at them and see why they are growing so quickly.

Is there too much information being logged ? Reduce the logging level of the application.
Are lots of errors being logged ? Investigate and fix.
...

Once you have control of the logs you can then use logrotate to help manage them.

share|improve this answer
  1. Deleting the log files alone won't help. You need to tell the daemon to close the log file, usually by sending it a SIGHUP.
  2. logrotate should be handling the logs, and it can use various criteria to determine when the log should be rotated.
  3. Your logs are filling up awful fast. Either figure out what's flooding your logs, send your logs to another machine for handling and storage, or mount a separate volume at /var/log so that it will be the only volume affected.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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