Misc: Truncating a log doesn’t work

Title:

Misc: Truncating a log doesn’t work

Author:

Douglas O’Leary <dkoleary@olearycomputers.com>

Description:

Truncate a log and the file is the exact same size… why?

Date created:

12/2014

Date updated:

12/2014

Disclaimer:

Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me…

Been doing this job for the better part of 25 years. Someone showed me a case where > ${log} results in ${log} being the exact same size it was before. ??? (Along with other less PC phrases)

Turns out the answer is that the application writing to the log is using an offset rather than simply appending to the file. So, the log does get truncated; but the bytes before the offset are now filled with null bytes which, by the way, will really play havoc with less, more, and vi…

Thank you, Kjetil Joergensen for the very clear answer to somone else’s question on this