MYSYSAD.COM

Don't Remove Those Log Files! -- Zero Them Out.

· Files & disks · System & processes

Here's a technique I use periodically to empty the log files. I simply could remove the file but then I would have to recreate the file and then reset the attributes, i.e. permissions, ownership, ACLs, etc.

Here's the technique.

# cat /dev/null > logfile

This preserves the attributes of the logfile and resets the byte count to zero.