How to configure /var/log/messages in Ubuntu system log

How to configure /var/log/messages in Ubuntu system log

1. Problem Description

Today I need to check the system log file, but I can't find the file /var/log/messages. Searching for information online, it says that you need to configure /etc/syslog.conf. Syslog uses a configurable, unified system registration program to accept log requests from anywhere in the system at any time, and then writes the log information to the corresponding file, mails it to a specific user, or directly sends it to the console as a message according to the pre-set settings in /etc/syslog.conf.

Okay, here comes the problem again. There is still no /etc/syslog.conf in the system. After some searching, the conclusion is: the corresponding ones in Ubuntu should be /etc/rsyslog.conf and rsyslogd.

2. Solution

For an explanation of the functions of the syslog.conf file and the files under syslog.d, please refer to the following article:

https://www.jb51.net/article/164470.htm

By checking the rsyslog.conf file, we 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

Use vim to open the /etc/rsyslog.d/50-default.conf file and add a line as follows:

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

Restart the system and check the system log again, and you will find that everything is OK! ! ! ^_^

The above method of configuring /var/log/messages in Ubuntu system log is all I want to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Summary of logrotate log polling operation in Linux
  • View the sed command of the system log from a certain period of time to the present

<<:  Teach you how to install mysql database on Mac

>>:  How to test network speed with JavaScript

Recommend

Detailed Introduction to the MySQL Keyword Distinct

Introduction to the usage of MySQL keyword Distin...

One line of code solves various IE compatibility issues (IE6-IE10)

x-ua-compatible is used to specify the model for ...

Linux C log output code template sample code

Preface This article mainly introduces the releva...

The difference and execution method of select count() and select count(1)

Count(*) or Count(1) or Count([column]) are perha...

About the processing of adaptive layout (using float and margin negative margin)

Adaptive layout is becoming more and more common i...

How to use ECharts in WeChat Mini Programs using uniapp

Today, we use uniapp to integrate Echarts to disp...

TypeScript learning notes: type narrowing

Table of contents Preface Type Inference Truth va...

Detailed explanation of the use of Teleport in Vue3

Table of contents Purpose of Teleport How Telepor...

Analysis of centos6 method of deploying kafka project using docker

This article describes how to use docker to deplo...

Example of how to optimize MySQL insert performance

MySQL Performance Optimization MySQL performance ...

MySQL 5.5.56 installation-free version configuration method

The configuration method of MySQL 5.5.56 free ins...

How to install Docker using scripts under Linux Centos

What is the main function of Docker? At present, ...