How to empty a logfile

  • 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.


  • 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?


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

  • Ok, thanks.


Log in to reply