基本介紹
Rsyslog是一個syslogd的多線程增強版,rsyslog vs. syslog-ng
rsyslog提供三個遠端日志傳輸方式:
- UDP: 資料包傳輸可信度不高
- TCP: 資料包傳輸可信度比較高
- RELP: 資料包傳輸可信度最高,避免資料丢失,比較新的協定,目前應用較少
以下為man手冊對RELP協定的一個介紹:
RELP can be used instead of UDP or plain TCP syslog to provide reliable delivery of syslog messages. Please note that plain TCP syslog does NOT provide truly reliable delivery, with it messages may be lost when there is a connection problem or the server shuts down. RELP prevents message loss in hose cases.
關于RELP的更進一步了解可以參考 Using TLS with RELP RELP Input Module RELP Output Module (omrelp)
相關配置
To forward messages to another host via UDP, prepend the hostname with the at sign (“@”). To forward it via plain tcp, prepend two at signs (“@@”). To forward via RELP, prepend the string “:omrelp:” in front of the hostname.
UDP傳輸
Server端配置
/etc/rsyslog.conf
|
或者把以上配置單獨存放在
/etc/rsyslog.d/
中的xxx.conf配置檔案中,盡量避免修改主配置檔案,當然如果要獨立檔案主配置檔案中必須含有以下配置
|
Client端配置
/etc/rsyslog.conf
|
以上配置完成之後
/etc/init.d/rsyslog restart
TCP傳輸
TCP配置和UDP類似,如下
Server端配置
/etc/rsyslog.conf
|
Client端配置
/etc/rsyslog.conf
|
用戶端和服務端重新開機相關服務即可
關于TCP和UDP的傳輸方式,rsyslog官方推薦使用TCP傳輸方式
In general, we suggest to use TCP syslog. It is way more reliable than UDP syslog and still pretty fast. The main reason is, that UDP might suffer of message loss. This happens when the syslog server must receive large bursts of messages. If the system buffer for UDP is full, all other messages will be dropped. With TCP, this will not happen. But sometimes it might be good to have a UDP server configured as well. That is, because some devices (like routers) are not able to send TCP syslog by design. In that case, you would need both syslog server types to have everything covered. If you need both syslog server types configured, please make sure they run on proper ports. By default UDP syslog is received on port 514. TCP syslog needs a different port because often the RPC service is using this port as well.
RELP傳輸
RELP需要安裝
rsyslog-relp
相應子產品
|
Server端配置
/etc/rsyslog.conf
|
Client端配置
|
參考和拓展資料
- Using TLS with RELP
- RELP Input Module
- RELP Output Module (omrelp)
- Rsyslog remote logging using RELP
- UDP Rsyslog
- TCP Rsyslog