1. Rather than just truncating the log file, should you be "rotating" it (saving some amount of recent log history)? There are perl modules for log file rotation, but basically, it's just a matter of renaming the "current" log file at, say, the end of each day and creating a new empty log file (e.g. "foo.log" is renamed to "20060821.foo.log", and a new "foo.log" is created; you retain some number of daily logs, and each day you just delete the oldest one).
2. Is the log file being written to by a process that runs continuously and keeps the log file open for output at all times? If so, could this interfere with a separate cron job that tries to open/truncate the log file? (I'm not a windows user, so I don't know from personal experience, but I've seen some discussions about how output file locking works on windows.)
If the answer to 2 is "yes", you presumably have to end the process in question, do whatever needs to be done to the log file, and restart the process. Or else you have to reconfigure the process, if possible, so it opens and closes the log file appropriately, or handles daily log rotation as part of its normal behavior.
In reply to Re: Cleaning file
by graff
in thread Cleaning file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |