1. 背景知识
linux内核日志分为8个级别,其宏定义如下:
#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */
#define KERN_ERR "<3>" /* error conditions */
#define KERN_WARNING "<4>" /* warning conditions */
#define KERN_NOTICE "<5>" /* normal but significant condition */
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
2. 修改/etc/rsyslog.conf配置文件
rsyslog.conf文件中一般会打印KERN_INFO信息到/var/log/dmesg文件中。
如果希望打印其他等级的信息,则在rsyslog.conf文件中添加配置&