Saturday, October 07, 2006

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

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.

1 comment:

Unknown said...

Since cat doesn't support sudo you get a Permission denied trying to use this technique to clear the system logs.