8

Possible Duplicate:
How do i view / enable kernel logs on an ec2 instance (amazon linux)?

I've got a centos server that i'm playing around with TCP settings in the sysctl.conf to increase the number of concurrent TCP connections it can handle, and i want to be able to view the kernel log to see any errors in the TCP stack, to ensure i've configured everything correctly.

I've read somewhere that i need to enable the kernel log first somehow, and then view the kernel log in /var/log/somewhere. Can anyone point me in the right direction? Thanks.

1

3 Answers 3

12

You can see the most recent lines of output from the kernel with the dmesg command.

Otherwise, you need to ensure that

  1. klogd is running (it's normally started with syslog, at boot time), and that
  2. syslogd is configured to log kernel messages to a file, perhaps with the following line from /etc/syslog.conf:

    kern.*<TAB><TAB><TAB>/var/log/kernel

make sure the file /var/log/kernel exists, and restart syslogd.

3
  • Surely kern.* rather than kernel.* ?
    – symcbean
    Sep 7, 2011 at 12:45
  • You're right, my bad (fingers faster than brain). Fixed, and thank you!
    – MadHatter
    Sep 7, 2011 at 12:50
  • 2
    Turns out that on my distro it was rsyslog, might be worth mentioning.
    – Chris
    Sep 14, 2011 at 9:48
1

You're tuning a performance setting -- you really want to be looking at performance counters, not log messages. Presumably you're increasing the number of concurrent connections to improve the performance of some application; you should keep an eye on your app.

0

Unless you've switched it off, your system is already writing log files (the default config for both redhat and centos).

How you go about tinkering with the config depends on which distro of the OS is running - older ones use syslogd but more recently rsyslogd/syslog-ng are becoming more popular.

If it's a syslogd based config, then you should cat enable kernel logging in the conf file as described by MadHatter (but note that kernel messages are matched by 'kern' not 'kernel'!).

to see any errors in the TCP stack

Really? what exactly do you expect to see? Its a well written/well tuned bit of the kernel - it's unlikely to throw many errors even you specify a really bad config.

And is it a good idea to mess with the kernel options if you don't know how to do a relatively straightforward admin task?

Not the answer you're looking for? Browse other questions tagged .