1. Problem Description
Today I need to check the system log file, but the file /var/log/messages was not found. Searching for information on the Internet, it is said to configure /etc/syslog.conf. syslog adopts a configurable and unified system registration procedure, accepts log requests from all parts of the system at any time, and then writes the log information into the corresponding file according to the preset in /etc/syslog.conf, mails it to a specific user or directly The message is sent to the console.
Okay, here comes the problem again. There is still no /etc/syslog.conf in the system. After some searching, the final conclusion is that the corresponding ones under Ubuntu should be /etc/rsyslog.conf and rsyslogd.
2. solution
For syslog.conf file and file function explanation under syslog.d, please refer to the following article:
https://www.zalou.cn/article/164470.htm
By looking at the rsyslog.conf file, it is found that all configuration files are in the /etc/rsyslog.d/ folder.
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#
# Default logging rules can be found in/etc/rsyslog.d/50-default.conf
… …
#
# Include all config files in/etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
Open the /etc/rsyslog.d/50-default.conf file with vim and add a line as follows:
*. info;mail.none;authpriv.none;cron.none /var/log/messages
Restart the system, check the system log again, and find that it is okay! ! ! ^_^
The above Ubuntu system log configuration method /var/log/messages is all the content shared by the editor, I hope to give you a reference.
Recommended Posts