Linux Beginner-System log (i)

Source: Internet
Author: User

Linux Beginner-System log (i)

The system log can record the operating state of the system, and if it fails, it will indicate the wrong location. Therefore, it is necessary to understand and learn the system log.

1. Default classification of system logs

The system log is recorded by default in the following address, with different logs in different files.

/var/log/messages system services and logs, including service information, error, etc.

/var/log/secure System Certification Information log

/var/log/maillog System Mail Service information

/var/log/cron System Timing Task Information

/var/log/boot.log System Boot Information

2. Rsyslog Service

The Rsyslog service is responsible for collecting and classifying logs, and does not process the logs. Change the Rsyslog configuration file can change the log storage and classification standards, command for "vim/etc/rsyslog.conf". As shown, enter "*./var/log/test" to indicate that all types and levels of logs are stored under the directory "/var/log/test".

3, the synchronization of the log

Sometimes you need to enter a host's log into another host, which requires the synchronization of the log function.

The log sender is configured by entering the command "vim/etc/rsyslog.conf", in which "*. * @172.25.254.102" is added, indicating that all logs are sent to the UDP protocol on this host with IP 172.25.254.102.

After saving, enter "Systemctl restart Rsyslog" to restart the Rsyslog service.

The log receiver is configured by entering the command "vim/etc/rsyslog.conf" and deleting # on lines 15th and 16th so that the log receive plug-in "$ModLoad imudp" and the log receive plug-in use the port "$UDPServerRun 514" to lighten.

Restart the Rsyslog service after exiting the save.

Enter "Systemctl stop Firewalld" To turn off the firewall.

The systemctl restart Sshd.server command is executed on the log sender during the test, and the log that restarts the SSH service appears under the "/var/log/messages" file of the log receiver.

Linux Beginner-System log (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.