CentOS / RHEL 6,7 : How to increase system log message verbosity (rsyslogd)

The Linux system log daemon is responsible for logging system messages. Starting RHEL 6, The system log daemon/service and its configuration file is rsyslogd – /etc/rsyslog.conf. The post describes how to modify CentOS / RHEL 6,7 system log message verbosity.

 

Verbosity level for rsyslogd

Each line in the configuration file /etc/rsyslog.conf defines a rule consisting of two whitespace-separated fields i.e. a selector (or filter) field and an action field.

 

– The selector field specifies a pattern of facilities and priorities.

– The action field specifies the target for messages matched by the selector i.e. a file (log), named pipe (fifo), tty (terminal), network address, etc.

 

facilities

 

authpriv security/authorization messages (private)
cron clock daemon (crond and atd messages)
daemon messages from system daemons without separate facility
kern kernel messages
local[0-7] reserved for local system use (see below)
lpr printer messages (used by JetDirect cards)
mail messages from mail daemons
news USENET news subsystem messages
syslog messages generated internally by syslogd
user generic user-level messages
uucp UUCP subsystem messages

 

Priorities / Severities

 

0 emerg system is unusable
1 alert action must be taken immediately
2 crit critical conditions
3 err error conditions
4 warning warning conditions
5 notice normal, but significant, condition
6 info informational message
7 debug debug-level message

 

Following is a default sample of an RHEL 7 /etc/rsyslog.conf file. The first line instructs the syslog daemon (syslogd) to log everything of level info or higher (excluding mail, authpriv and cron facility message) to the /var/log/messages file.

cat /etc/rsyslog.conf
*.info;mail.none;authpriv.none;cron.none                /var/log/messages
authpriv.*                                              /var/log/secure
mail.*                                                  -/var/log/maillog
cron.*                                                  /var/log/cron
*.emerg                                                 *
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log

 

Increasing default syslog message verbosity

 

1. To increase the default syslog message verbosity e.g. from info to debug level, change the relevant syslog configuration file entry e.g.:

 

from:

*.info;mail.none;authpriv.none;cron.none           /var/log/messages

to:

*.debug;mail.none;authpriv.none;cron.none          /var/log/messages

 

2. To send debug level messages (but not messages of other levels) for all facilities to virtual console 9 (/dev/tty9), add the following syslog configuration file entry:

*.=debug                      /dev/tty9

 

3. When making changes to the system log configuration file, a restart of the rsyslogd service (or system reboot) is required for changes to take effect e.g.:

 

For RHEL 6 :

# service rsyslogd restart

 

For RHEL 7 :

# systemctl restart rsyslog

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)