why postfix logs always empty?

6,301

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:
6,301

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin almost 2 years

    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.

    • Prix
      Prix almost 14 years
      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
    • Admin
      Admin almost 14 years
      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.