[ale] One-liner needed: log-rolling with a different spin

Brian Pitts brian at polibyte.com
Wed Jul 15 12:41:12 EDT 2009


Mills John M-NPHW64 wrote:
> ALErs -
> 
> I am accumulating a log file a bit faster than I would like, and only
> need to keep the most recent N lines (say, N = 100000) to examine in
> case of a crash. I want the log traffic to continue undisturbed while
> early lines are truncated.
> 
> I want to script this and run it as a 'cron' job to keep the file size
> manageable. I would prefer not to restart 'syslogd', mainly because it
> seems to me that should not be necessary.
> 
> Suggestions?
> 

Use logrotate.

http://linuxcommand.org/man_pages/logrotate8.html

-- 
All the best,
Brian Pitts


More information about the Ale mailing list