[BusyBox] Keeping only most recent log messages...?
Gyepi SAM
gyepi at praxis-sw.com
Sat Dec 2 04:52:45 UTC 2000
On Wed, Nov 29, 2000 at 09:24:21PM -0800, Alec Smecher wrote:
>Anyway, on my embedded system I'd like to keep a page or so of the most recent
>syslog'd messages, but in the interests of preserving extremely limited memory/disk
>space I'd like to be able to limit it to just the last page or so.
>Without running another daemon, how would I best approach this?
>I think it might be a really useful addition to syslog - correct me if I'm wrong -
>and although such things as "emlog" seem to fit the bill, I'd prefer an integrated solution.
>
> Any thoughts?
It would be difficult to maintain just the last n bytes of syslog data in a
file w/o doing a lot of I/O processing.
One solution is to avoid using a
single file as a circular buffer and instead open a new file when the
current one gets to a certain size. I think Erik alluded to this in a
another email. This solution will conserve disk space if you keep each file
small an maintain only a limited number of log files. D.J. Bernstein's
multilog package does this.
The other possible solution is the emlog way: use a memory buffer instead of
writing log data to disk. While this solves the disk space issue, it, too
has issues: Memory use, data persistence or lack thereof, and the question
of how to read the data (tail /var/log/messages does not work anymore.
That's why emlog uses a character device for output).
mmap (2) may solve most of these issues, but may not be supported on all
platforms.
I would be loathe to make syslogd behave so differently from the GNU version
(though there is precedence and these changes could simply be extensions...)
Responses?
-Gyepi
More information about the busybox
mailing list