difference between dmesg and /var/log/kern.log


http://stackoverflow.com/questions/11412950/difference-between-dmesg-and-var-log-kern-log


I am modifying the kvm module and I have added printk statements in the kernel code.After running the virtual machine, printk gives me the faulting address and other information about the guest OS.

I need to generate the statistic from this info.When I use dmesg i can only see faulting address in the kernel space i.e their address are above 0XC0000000.(faulting address are needed when VMEXIT happens i.e we switch from guest to host mode)

When I see the same statistics in kern.log I also get faulting address from the user space(below 0XC0000000).So it seems to me like dmesg has limited capacity , and the info given is a subset from kern.log.
My kern.log file is too big is it ok to erase old data from kern.log because text processing commands like grep,join,awk are taking to too long to run on the file.

My question are:
What is the difference between dmesg and kern.log?
How to reduce the kern.log file size as cron job?(erase all data added in past 24 hours)
Is there any better way to get printf kindof functionality from kernel?

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Answer

/var/log/kern.log and his rotated logs (/var/log/kern.log.1 /var/log/kern.log.2....) contains the logs produced by the kernel and handled by syslog.

dmesg as explained by the man page is for :

dmesg is used to examine or control the kernel ring buffer.

In fact, it will display the last 16392 octets of /var/log/kern.log since last boot.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值