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

    How to empty a logfile

    General pfSense Questions
    2
    4
    1.9k
    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.
    • Y
      yoogie
      last edited by

      Hi there.

      I have the following setup: Captiveportal, transparent squid and of course pfSense V.1.1.0

      I have a small perlscript running on that pfSense which is executed once a day through ssh2. What it does: It prints out the squid-log, the portalauthd.log and the dhcpd.log and should wipe the logfiles by simply doing the following:

      
      if (open (OUT, ">/var/log/dhcpd.log")) {
         close OUT;
      }
      
      

      This ensures a clean and blank logfile without a change in the inode or filehandles.

      This works very well for the squid-logfile, but the dhcpd.log and portalauthd.log files seem to be binary blasted until 65.535 Bytes. Doing the described procedure on those files ends up in a Segmentation fault.

      So, is there a command I can execute to empty those files or how can I achieve that those files get initialized?

      Other question. Is there a sort of logfile rotation? Is it possible to run out of disk space?

      Many thanks in advance.

      CHeers,
      Manuel

      1 Reply Last reply Reply Quote 0
      • Y
        yoogie
        last edited by

        Hi there, I have found the command.

        
        /usr/sbin/clog -i -s 262144 /var/log/dhcpd.log
        
        

        Am I right that the logfile is like a FILO buffer of a fixed size?
        How can I turn this off?

        Cheers,
        Manuel

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

          Yes its a fixed size (clog).  It cannot be turned off.

          1 Reply Last reply Reply Quote 0
          • Y
            yoogie
            last edited by

            Ok, thanks.

            Cheers,
            Manuel

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