pseudo-logrotate

Denys Vlasenko vda.linux at googlemail.com
Wed Jan 19 23:55:03 UTC 2011


On Wednesday 19 January 2011 18:01, David Collier wrote:
> I recently realised that the syslogd in busybox takes a path/filename and
> a file length and a number-of-files. Lovely
> 
> I am running an embedded system, and it does things at start-up like
> 
>    datalogging.sh &
>    modemcommunications.sh &
>    
> which dumps any/all debug information that the s/w MIGHT be able to give
> me into a black hole.
> 
> Or if I run it from the console, it interleaves it so I can't see what's
> what!!!
> 
> what I'd like to do is something like 
> 
>  datalogging.sh &         > /var/log/datalogging/log         200 3
>  modemcommunications.sh & > /var/log/modemcommunications/log 200 3
>    
> and log the output of each process into the RAMdisk in it's own
> limited-size log file(s).
> 
> I hear there's something called logrotate I can compile and install, but
> it is frustrating that all the code to do this seems to be in busybox for
> syslogd - can it be bent to my purpose in any way?

Use svlogd:

$ svlogd --help
BusyBox v1.18.0 (2010-11-23 00:11:12 CET) multi-call binary.

Usage: svlogd [-ttv] [-r C] [-R CHARS] [-l MATCHLEN] [-b BUFLEN] DIR...

Continuously read log data from stdin, optionally
filter log messages, and write the data to one or more automatically
rotated logs



Something like

{ datalogging.sh 2>&1 | svlogd -tt LOGDIR; } &

-- 
vda


More information about the busybox mailing list