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'm newbie on UNIX/LINUX.

My postfix log file is at /var/log/maillog, yesterday i emptying the file using "1,$d" command and then ":wq!" from vi because the content to big for me to read, but then every postfix interactions does not logged into that file.

I try to remove that file and create it again with no luck.

Anyone can help me to solve this problem?

Thank you.

Best regards.

share|improve this question
    
Are you saying that your file is too big and you can't read it, then you deleted it and now nothing is being registered to it (if i got it wrong please explain what you want and what is happening better, it is too confusing) ? try: rm -rf /var/log/maillog; touch /var/log/maillog as root to recreate it empty or if u dont want to erase the current file: mv /var/log/maillog /var/log/maillog.1; touch /var/log/maillog –  Prix Sep 12 '10 at 3:16
    
Thank you for your solution, but suddenly the postfix log is not empty anymore, i try to make some wrong configuration on postfix ^_^, quite strange. –  user54015 Sep 12 '10 at 4:33
add comment

1 Answer

If you delete a file that some process has a file handle to (which is what it uses to write to a file) but don't restart the process that is doing the writing then it will continue writing to the old file.

This is a common mistake that new unix admins make-- they may try to reclaim disk space by deleting a very large log file, not realizing that the space isn't actually available until the file is no longer open.

What I suspect happened (overnight) is that your syslog process was HUP'd by a cronjob, causing it to close all files and reopen them.

In the future, a safer way to truncate a log file that you truly don't care about is to do this:

> /var/log/that_logfile

share|improve this answer
add comment

Your Answer

 
discard

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