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

I've got a amazon ec2 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. Can anyone point me in the right direction? Thanks.

The AMI i'm using is: amzn-ami-2011.02.1.x86_64


Solution 1:

dmesg give you the kernel logs but it doesn't include the timestamp by default (it can be enable by recompiling kernel with CONFIG_PRINTK_TIME=y)

With [r]syslog, you can log all kernel messages to a file (with timestamp) by inserting a below line into /etc/[r]syslog.conf:

kern.*          /var/log/kern.log

Don't forget to restart [r]syslog daemon.