Clearing log file from the command line. [SOLVED]



  • Hi,

    After some searching, I haven't found a solution to clearing a log file and re-initializing it from the command line.  I've tried the usual favorites like:

    /var/log/log_file.log

    Indeed, this clears the file as expected however new logs are no longer written. The permission look the same, so I'm not certain what I'm missing. Ultimately I have to log in to the GUI and clear the clog manually, but it would be great if I could avoid this.

    Any insight is appreciated, and thanks…



  • I would like to do a lot to tell me what I need to do.


  • Rebel Alliance Developer Netgate

    The log files are binary circular logs, not plain text logs. If you truncate or otherwise alter the log files with utilities other than the GUI or the clog command, they will no longer be valid files that syslog will write.

    To reinitialize a log file at the default size, use this command:

    clog -i -s 511488 /var/log/name.log
    

    Replace name with the name of the log file to clear.



  • Thanks jimp, much appreciated!

    ;D


Log in to reply