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