Discussion:
[BusyBox] /var/log/messages generation
rasta rasta
2005-01-12 00:59:15 UTC
Permalink
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.



__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
Glenn McGrath
2005-01-12 01:20:46 UTC
Permalink
On Wed, 12 Jan 2005 01:52:13 +0000 (GMT)
Post by rasta rasta
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
Sounds like you need debians logrotate command, im not sure what
language its written in, so it mag not be suitable.

Not sure of any alternatives. you could consider using a circular buffer
(i havent used it myself), but then the old messages will be lost.



Glenn
Brenda Butler
2005-01-12 02:12:48 UTC
Permalink
Post by Glenn McGrath
On Wed, 12 Jan 2005 01:52:13 +0000 (GMT)
Post by rasta rasta
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
Sounds like you need debians logrotate command, im not sure what
language its written in, so it mag not be suitable.
montavista supplies a binary logrotate along with all the other
potential target binaries (at least they do for our architecture,
arm).

cheerio,
bjb
Brenda Butler
2005-01-12 03:12:35 UTC
Permalink
Post by Glenn McGrath
On Wed, 12 Jan 2005 01:52:13 +0000 (GMT)
Post by rasta rasta
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
Sounds like you need debians logrotate command, im not sure what
language its written in, so it mag not be suitable.
montavista supplies a binary logrotate along with all the other
potential target binaries (at least they do for our architecture,
arm).

cheerio,
bjb
Larry Doolittle
2005-01-12 05:02:52 UTC
Permalink
Post by rasta rasta
we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
That sounds so precise as to either be homework or
the mandate of a manager who thinks he/she isn't
clueless.

The traditional unixoid daemon/logging system is rotten
at the core: any attempts to do something sensible with
it get bloated and unreliable.

Take a look at svlogd, part of the runit package at
http://smarden.org/runit/, for a better alternative.
One paragraph from its man page reads:

LOG FILE ROTATION
svlogd appends selected log messages to the current log file.
If current has size bytes or more (or there is a newline
within the last len of size bytes) current is rotated.


- Larry
Doug Kehn
2005-01-12 11:35:39 UTC
Permalink
On Wed, Jan 12, 2005 at 01:52:13AM +0000, rasta
Post by rasta rasta
we're
trying to limit the size of the
/var/log/messages.X
Post by rasta rasta
file to about 8kb. if the file size reaches 8kb
the
Post by rasta rasta
system would then create another messages.X file.
Everytime the system creates the messages file,
the
Post by rasta rasta
system would increment X by 1. the sysetm will do
this
Post by rasta rasta
until there are 5 messages files. the system will
then
Post by rasta rasta
delete all messages.X files and start a new
messages.X
Post by rasta rasta
file. We're using BusyBox v1.00-pre8 on a
montavista
Post by rasta rasta
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2
processor.
That sounds so precise as to either be homework or
the mandate of a manager who thinks he/she isn't
clueless.
The traditional unixoid daemon/logging system is
rotten
at the core: any attempts to do something sensible
with
it get bloated and unreliable.
Take a look at svlogd, part of the runit package at
http://smarden.org/runit/, for a better alternative.
LOG FILE ROTATION
svlogd appends selected log messages to the
current log file.
If current has size bytes or more (or there
is a newline
within the last len of size bytes) current is
rotated.
BusyBox's syslogd can do this (at least in v1.0.0 so
pre8 might also support). Look in BusyBox help for
syslogd and read about the
-s and -n options. The -s option states that the
default size is 200KB but it's really 16KB. You'll
also need to enable CONFIG_USER_BUSYBOX_ROTATE_LOGFILE
when building BusyBox. For additional details look at
the code (busybox/sysklogd/syslogd.c).

Regards,
...doug

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Paul Fox
2005-01-12 13:06:33 UTC
Permalink
we're trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb
lots of good suggestions so far. so many ways to skin a cat.
here's one more. undoubtedly not as robust as other methods
people have mentioned...

#!/bin/sh

# simple log rotator

# get the set of logfiles from syslog.conf:
# - eliminate comments
# - eliminate blank lines
# - get the second field
# - keep the ones that contain "/var/log"
files=$(sed -n -e '/^#.*/d' \
-e '/^[[:space:]]*$/d' \
-e 's/.*[[:space:]]\+//' \
-e '/\/var\/log\//p' /etc/syslog.conf )

how_often=900 # 15 minutes
how_big=$((50 * 1024 ))

toobig()
{
file=$1
if [ -f $1 ]
then
set -- $(ls -l $file) # size
if [ $5 -gt $how_big ]
then
return 0
fi
fi

return 1
}

# this won't pick up new files automatically
while : forever
do
unset moved
for f in $files
do
if toobig $f
then
rm -f $f.1
mv $f $f.1
moved=true
fi
done

if [ "$moved" ]
then
# syslog might not be running. that's okay.
killall -HUP syslogd 2>/dev/null
fi

sleep $how_often
done


=---------------------
paul fox, ***@brightstareng.com
Ignacio García Pérez
2005-01-12 21:26:23 UTC
Permalink
The syslogd applet will do more or less that for you:

syslogd -b 5 -s 8

As far as I know, this feature has been added to busybos very recently, so
you should probably update to version 1.00 (because I assume you have at
least tried "syslogd --help", right?).

By the way, I said "more or less" because busybox syslogd actually rotates
the 5 files, while according to your description what you do is delete all
the files when you reach 5.

If something of your interest happens to your system just after the
deletion, you will have very little time worth of logs to investigate, while
with current busybox approach, you will always have at least 4 complete 8KB
files for review.

I just can't find a good reason to do it your way...

Regards.
-----Original Message-----
Sent: miércoles, 12 de enero de 2005 2:52
To: busybox
Subject: [BusyBox] /var/log/messages generation
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
_______________________________________________
busybox mailing list
http://busybox.net/mailman/listinfo/busybox
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005
rasta rasta
2005-01-12 01:52:13 UTC
Permalink
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.



__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
Glenn McGrath
2005-01-12 02:20:23 UTC
Permalink
On Wed, 12 Jan 2005 01:52:13 +0000 (GMT)
Post by rasta rasta
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
Sounds like you need debians logrotate command, im not sure what
language its written in, so it mag not be suitable.

Not sure of any alternatives. you could consider using a circular buffer
(i havent used it myself), but then the old messages will be lost.



Glenn
Larry Doolittle
2005-01-12 06:01:52 UTC
Permalink
Post by rasta rasta
we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
That sounds so precise as to either be homework or
the mandate of a manager who thinks he/she isn't
clueless.

The traditional unixoid daemon/logging system is rotten
at the core: any attempts to do something sensible with
it get bloated and unreliable.

Take a look at svlogd, part of the runit package at
http://smarden.org/runit/, for a better alternative.
One paragraph from its man page reads:

LOG FILE ROTATION
svlogd appends selected log messages to the current log file.
If current has size bytes or more (or there is a newline
within the last len of size bytes) current is rotated.


- Larry
Doug Kehn
2005-01-12 12:35:25 UTC
Permalink
On Wed, Jan 12, 2005 at 01:52:13AM +0000, rasta
Post by rasta rasta
we're
trying to limit the size of the
/var/log/messages.X
Post by rasta rasta
file to about 8kb. if the file size reaches 8kb
the
Post by rasta rasta
system would then create another messages.X file.
Everytime the system creates the messages file,
the
Post by rasta rasta
system would increment X by 1. the sysetm will do
this
Post by rasta rasta
until there are 5 messages files. the system will
then
Post by rasta rasta
delete all messages.X files and start a new
messages.X
Post by rasta rasta
file. We're using BusyBox v1.00-pre8 on a
montavista
Post by rasta rasta
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2
processor.
That sounds so precise as to either be homework or
the mandate of a manager who thinks he/she isn't
clueless.
The traditional unixoid daemon/logging system is
rotten
at the core: any attempts to do something sensible
with
it get bloated and unreliable.
Take a look at svlogd, part of the runit package at
http://smarden.org/runit/, for a better alternative.
LOG FILE ROTATION
svlogd appends selected log messages to the
current log file.
If current has size bytes or more (or there
is a newline
within the last len of size bytes) current is
rotated.
BusyBox's syslogd can do this (at least in v1.0.0 so
pre8 might also support). Look in BusyBox help for
syslogd and read about the
-s and -n options. The -s option states that the
default size is 200KB but it's really 16KB. You'll
also need to enable CONFIG_USER_BUSYBOX_ROTATE_LOGFILE
when building BusyBox. For additional details look at
the code (busybox/sysklogd/syslogd.c).

Regards,
...doug

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Paul Fox
2005-01-12 14:06:03 UTC
Permalink
we're trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb
lots of good suggestions so far. so many ways to skin a cat.
here's one more. undoubtedly not as robust as other methods
people have mentioned...

#!/bin/sh

# simple log rotator

# get the set of logfiles from syslog.conf:
# - eliminate comments
# - eliminate blank lines
# - get the second field
# - keep the ones that contain "/var/log"
files=$(sed -n -e '/^#.*/d' \
-e '/^[[:space:]]*$/d' \
-e 's/.*[[:space:]]\+//' \
-e '/\/var\/log\//p' /etc/syslog.conf )

how_often=900 # 15 minutes
how_big=$((50 * 1024 ))

toobig()
{
file=$1
if [ -f $1 ]
then
set -- $(ls -l $file) # size
if [ $5 -gt $how_big ]
then
return 0
fi
fi

return 1
}

# this won't pick up new files automatically
while : forever
do
unset moved
for f in $files
do
if toobig $f
then
rm -f $f.1
mv $f $f.1
moved=true
fi
done

if [ "$moved" ]
then
# syslog might not be running. that's okay.
killall -HUP syslogd 2>/dev/null
fi

sleep $how_often
done


=---------------------
paul fox, pgf at brightstareng.com
Ignacio García Pérez
2005-01-12 18:28:08 UTC
Permalink
The syslogd applet will do more or less that for you:

syslogd -b 5 -s 8

As far as I know, this feature has been added to busybos very recently, so
you should probably update to version 1.00 (because I assume you have at
least tried "syslogd --help", right?).

By the way, I said "more or less" because busybox syslogd actually rotates
the 5 files, while according to your description what you do is delete all
the files when you reach 5.

If something of your interest happens to your system just after the
deletion, you will have very little time worth of logs to investigate, while
with current busybox approach, you will always have at least 4 complete 8KB
files for review.

I just can't find a good reason to do it your way...

Regards.
-----Original Message-----
From: busybox-bounces at mail.busybox.net
[mailto:busybox-bounces at mail.busybox.net]On Behalf Of rasta rasta
Sent: mi?rcoles, 12 de enero de 2005 2:52
To: busybox
Subject: [BusyBox] /var/log/messages generation
hi guys! we need help with our small task. we're
trying to limit the size of the /var/log/messages.X
file to about 8kb. if the file size reaches 8kb the
system would then create another messages.X file.
Everytime the system creates the messages file, the
system would increment X by 1. the sysetm will do this
until there are 5 messages files. the system will then
delete all messages.X files and start a new messages.X
file. We're using BusyBox v1.00-pre8 on a montavista
linux 2.4.18_mvl30-pc_target #29, AMD geode gx2 processor.
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
_______________________________________________
busybox mailing list
busybox at mail.busybox.net
http://busybox.net/mailman/listinfo/busybox
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005
Loading...