What do the values in printk kernel parameter mean in linux?



  • $ sysctl kernel.printk
    kernel.printk = 7       4       1       7
    

    The text below says syslog but, most Linux systems now use rsyslog. The man page for syslog may not exist.

    printk:
    
    The four values in printk denote: console_loglevel,
    default_message_loglevel, minimum_console_loglevel and
    default_console_loglevel respectively.
    
    These values influence printk() behavior when printing or
    logging error messages. See 'man 2 syslog' for more info on
    the different loglevels.
    
    - console_loglevel: messages with a higher priority than
      this will be printed to the console
    
    - default_message_loglevel: messages without an explicit priority
      will be printed with this priority
    
    - minimum_console_loglevel: minimum (highest) value to which
      console_loglevel can be set
    
    - default_console_loglevel: default value for console_loglevel
    

    In the example this equates to the following, which is the default setting on redhat.

    console_loglevel = 7
    default_message_loglevel = 4
    minimum_console_loglevel = 1
    default_console_loglevel = 7

    The numbers relate to the following:

    Supported log levels (priorities):
    0   emerg - system is unusable
    1   alert - action must be taken immediately
    2    crit - critical conditions
    3     err - error conditions
    4    warn - warning conditions
    5  notice - normal but significant condition
    6    info - informational
    7   debug - debug-level messages
    

    Redhat descriptions of the log levels.

    The log-level values break down in this order:
    
    0 — Kernel emergency. The system is unusable.
    1 — Kernel alert. Action must be taken immediately.
    2 — Condition of the kernel is considered critical.
    3 — General kernel error condition.
    4 — General kernel warning condition.
    5 — Kernel notice of a normal but significant condition.
    6 — Kernel informational message.
    7 — Kernel debug-level messages.
    


© Lightnetics 2024