配置 rsyslog,使得可以通過 rsyslog 服務來在遠程主機間傳輸日誌

見 https://www.thegeekdiary.com/configuring-remote-logging-using-rsyslog-in-centos-rhel/

Once the central log host is configured to accept remote logging, the rsyslog service can be configured on remote systems to send logs to the central log host. To configure a machine to send logs to a remote rsyslog server, add a line to the rules section in the /etc/rsyslog.conf file. In place of the file name, use the IP address of the remote rsyslog server. To use UDP, prefix the IP address with a single @ sign. To use TCP, prefix it with two @ signs (@@).

For instance, to have all messages with info or higher priority sent to loghost.example.com via UDP, use the following line:

*.info @loghost.example.com

To have all messages sent to loghost.example.com via TCP, use the following line:

*.*     @@loghost.example.com

Optionally, the log hostname can be appended with :PORT, where PORT is the port that the remote rsyslog server is using. If no port is given, it assumes the default port 514.

After adding the rule(s), restart the rsyslog service and send a test message using the logger command:

[root@logclient ~]# logger "Test from logclient"

Check the logs on the remote server to ensure the message was received.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章