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

James Sumners james.sumners at gmail.com
Wed Jul 15 11:43:41 EDT 2009


How about this?

sed '1000,`wc -l logfile | awk "{print $1}"`!d' logfile

On Wed, Jul 15, 2009 at 11:30 AM, Mills John
M-NPHW64<Jmills at motorola.com> 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?
>
> TIA.
>  - Mills


-- 
James Sumners
http://james.roomfullofmirrors.com/

"All governments suffer a recurring problem: Power attracts
pathological personalities. It is not that power corrupts but that it
is magnetic to the corruptible. Such people have a tendency to become
drunk on violence, a condition to which they are quickly addicted."

Missionaria Protectiva, Text QIV (decto)
CH:D 59



More information about the Ale mailing list