Linux sends logs to the log server

Source: Internet
Author: User
Tags syslog rsyslog


In the previous article we introduced the Rsyslog configuration file. In the current environment, whether it is to store the log for a longer period of time or to analyze the convenience of the log, we usually send logs to the log server or log collection analysis system. Let's look at how to configure this.


experimental Environment : RHEL 7

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/86/AA/wKioL1fG8IfjQk4YAAAq4rAw4DI478.png "title=" Rsyslog.png "alt=" Wkiol1fg8ifjqk4yaaaq4raw4di478.png "/>

Experimental Purpose : We send all logs above the info level on the client to the log server 192.168.202.130.


Client:

Define an info-level log and send it to the log server, inserting a row at the following location

vim/etc/rsyslog# Save boot messages also to boot.loglocal7.*/var/log/boot.log*.info @192.168.202.130 #此行为添加行

Save exit and restart Rsyslog service

Systemctl Restart Rsyslog.service

log server:

The log server does not receive the remote log by default, we first let the log server receive the log from the remote, and then define the storage location.

1, cancel 14 15 19 20 lines of comments, receive remote logs.

Vim/etc/rsyslog # provides UDP syslog reception $ModLoad imudp $UDPServerRun 514 + # provides TCP syslog re Ception $ModLoad imtcp $InputTCPServerRun 514

2, the received log exists under the/var/log/test

# Save Boot messages also to Boot.log local7.*/var/log/boot.log /var/log/test #此行为添加行

Save exit and restart Rsyslog service

Systemctl Restart Rsyslog.service


Test:

We simulate the log on the client

[Email protected] ~]# logger-p local5.info ' test test '

Check on the log server

[Email protected] ~]# cat/var/log/test 23:21:50 bogon root:test test


This article is from the "Always Ready" blog, please be sure to keep this source http://836459598.blog.51cto.com/6240426/1844990

Linux sends logs to the log server

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.