2001-11-08 15:36:40

by william fitzgerald

[permalink] [raw]
Subject: printk kernel logging for router

hi all,
linux newbie here.

i need to know some information in regard to
logging with printk statements.

my plan is to monitor the performance of a linux
router.i'm adding printk statements to the
kernel to every function that is called by
forwarding packets and in that way find precisely
where a packet or packets get lost.

this is still in progress.

when i finally get all my printk statements in, i
want to be able to flood my router on my own mini
network.(router running on a p133 using
redhat7.1)

my understanding of printk is that each time it
is encountered it is written to disk.so for a lot
of packets there will be alot of writes,
therefore slowing the system and producing false
results.

so how to i buffer or record the printk
statements and print them to disk after my
packets have gone through the router?

do i edit the printk.c file and change the
line:

static char buf[1024];

and increase the size of the array?
or do i edit the klogd.c program and change
something in there?

many thanks in advance and all comments no
matter how trivial are welcome in order for me
to learn more.

regards william.

Beer Mail, brought to you by your friends at beer.com.


2001-11-08 16:26:13

by Erik Mouw

[permalink] [raw]
Subject: Re: printk kernel logging for router

On Fri, Nov 09, 2001 at 03:41:17PM +2400, william fitzgerald wrote:
> hi all,
> linux newbie here.

You might be interested in the kernelnewbies.org website, mailinglist,
and IRC channel.

> i need to know some information in regard to
> logging with printk statements.
>
> my plan is to monitor the performance of a linux
> router.i'm adding printk statements to the
> kernel to every function that is called by
> forwarding packets and in that way find precisely
> where a packet or packets get lost.
>
> this is still in progress.

Don't be surprised if all that printing will degrade the performance of
your router.

> when i finally get all my printk statements in, i
> want to be able to flood my router on my own mini
> network.(router running on a p133 using
> redhat7.1)
>
> my understanding of printk is that each time it
> is encountered it is written to disk.so for a lot
> of packets there will be alot of writes,
> therefore slowing the system and producing false
> results.

Printk doesn't write to disk, syslogd does.

> so how to i buffer or record the printk
> statements and print them to disk after my
> packets have gone through the router?
>
> do i edit the printk.c file and change the
> line:
>
> static char buf[1024];
>
> and increase the size of the array?
> or do i edit the klogd.c program and change
> something in there?

Change /etc/syslogd.conf. Put all kernel messages into a separate
logging file and put a '-' before the log file name so syslogd will not
sync the file after each write. See man syslogd, klogd, syslog.conf


Erik

--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty
of Information Technology and Systems, Delft University of Technology,
PO BOX 5031, 2600 GA Delft, The Netherlands Phone: +31-15-2783635
Fax: +31-15-2781843 Email: [email protected]
WWW: http://www-ict.its.tudelft.nl/~erik/