Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Clearing log file from the command line. [SOLVED]

    Scheduled Pinned Locked Moved General pfSense Questions
    4 Posts 3 Posters 3.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ShMwS
      ShMw
      last edited by

      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…

      1 Reply Last reply Reply Quote 0
      • S
        somsrina9
        last edited by

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

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          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.

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • ShMwS
            ShMw
            last edited by

            Thanks jimp, much appreciated!

            ;D

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.