-   Linux - Server (
-   -   /var Filesystem reached 100 % (

LittleMaster 02-04-2013 01:55 PM

/var Filesystem reached 100 %
Hi All,
Lots more time /var filesystem reached 100 %. To resolve i had Mistaking deleted messsages log .Which caused the message log not getting reflected after message log getting deleted.I have already enable log rotate for everyday .Before log are getting rotated /var filesystem getting filled up .Please advise how to clear logs without affecting running Application.

cp -p /var/log/messages /opt/log/backup/messages_05022013

whether nullifing the log cause harm to running Application.

cat /dev/null /var/log/messages

Kustom42 02-04-2013 02:07 PM

Emptying the messages file wont harm your apps, it could cause an error if you have a lock on the file, say you have it open in vim, while an app tries to write to it. Depending upon the app it may just sit in a "FUTEX_WAIT" status until its available or error out completely.

How big is your /var/ filesystem? This seems very odd to me that your log files are filling up this quickly. Do you have any of your apps set in a more verbose logging, for instance, is Apache or MySQL in the "debug" log mode?

unSpawn 02-04-2013 02:44 PM

Even worse, with a file open for writing on the file descriptor space won't be reclaimed even if a file is deleted. Making a daemon close and re-open its open files by sending the process a -HUP is then often the preferred method as you can see in /etc/logrotate.d/ scripts. While on the subject of rotating log files, if there's space or other constraints, it's also perfectly possible to rotate specific logs multiple times a day or let rotation be triggered by say a max size threshold.

All times are GMT -5. The time now is 10:24 PM.