LoginSignup
13
10

More than 5 years have passed since last update.

コンソールログレベルの確認

Posted at

参考
障害発生時の金科玉条:第2回 PD思考法の基礎と情報収集(その2) (1/3) - ITmedia エンタープライズ

cat /proc/sys/kernel/printk で表示される左端の値。

以下はSLES11SP1での例

linux:~ # cat /proc/sys/kernel/printk
1 4 1 7
linux:~ #

左から
console_loglevel 現在のコンソールログレベル
default_message_level ログレベルが指定されていないメッセージに付加するログレベル
minimum_console_loglevel コンソールログレベルに設定できる最小のログレベル
default_console_loglevel デフォルトのコンソールログレベル

以下で定義されている。

/usr/src/linux/include/kernel.h
#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                 */

デフォルトのログレベルは以下で定義されている。

/usr/src/linux/kernel/printk.c
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
/* We show everything that is MORE important than this.. */
#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */
#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */

デフォルトは 7 だけど、SLESだと起動時に 1 に設定されてる。
SLESで SysRq + m とかしてもコンソールに何も表示されないのはこのため。
dmesg -n 7echo 7 > /proc/sysrq-trigger 等で変更できる。
恒久的な変更はSLESなら /etc/sysconfig/syslog で KERNEL_LOGLEVEL=1 を変更。

RHELだとコンソールログレベルは6になっているみたい。
syslogdが起動すると6になるのかな?

13
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
10