Sometimes I am at the point where there’s too much log output, but I don’t want to send everything to /dev/null because of some rare bug. The easiest way I know to retain some fixed amount of logs is to use rotatelogs from Apache HTTPD – e.g. in the following fashion:
some_command 2>&1 | rotatelogs -n 5 /var/log/some_command.log 100M
Hope to help somebody with this (perhaps the future me)…