If, like me, you do a lot of Perl / HTML / Apache development on you desktop OS X system, you'll have noticed the
error_log and
access_log files getting massive and out of control. I normally have mine open in a web browser, so I can reload it to see what errors my code is producing. But at upwards of 10MB in size, it can slow down event the best of browsers. So, here is a little command you can set up as a
cron job ever five mins or so to keep the
error_log in check:
cd /private/var/log/httpd; tail error_log > error_log2; \
tail error_log2 > error_log
Make sure it's run as root. Now your
error_log will be pruned every so often and won't slow you or your browser down.
[
robg adds: The above command will overwrite your
error_log file -- so make sure there's nothing in there you need to keep before you try this!]