[英]How to collect spring batch remote partitioned application logs from all servers to one server using Rsyslog?
[英]how to send only specific files to remote server using rsyslog
我是 rsyslog 的新手。 我有多個服務器(rsyslog 服務器)將 syslog 消息發送到遠程服務器(syslog-ng 服務器)。 現在,我正在將所有內容發送到遠程服務器。 我想過濾掉特定文件的日志並將其發送到遠程服務器。
10-custom.conf - 這是我正在使用的自定義配置文件
#Forward specific logs to remote server
module(load="imfile")
input(type="imfile"
file="/var/log/tomcat8/bar.log"
Tag="bar:")
input(type="imfile"
file="/var/log/tomcat8/foo.log"
Tag="foo:")
input(type="imfile"
file="/var/log/dpkg.log"
Tag="dpkg:")
input(type="imfile"
file="/var/log/syslog"
Tag="syslog:")
input(type="imfile"
file="/var/log/auth.log"
Tag="auth:")
input(type="imfile"
file="/var/log/kern.log"
Tag="kern:")
#if $Tag == "catalina:" then @@remoteserver:port
:syslogtag, isequal, "catalina:" @@remoteserver:port
& stop
我正在嘗試根據標簽過濾掉並將其發送到遠程服務器。 我無法正常工作。
設置此設置的最佳方法是什么?
提前致謝!
您可以將語句放在 rsyslog.conf 之上,如此處所述:
https://www.rsyslog.com/discarding-unwanted-messages/
例如,假設您只想將特定設施消息發送到遠程日志服務器,例如所有相關郵件消息而不管優先級,請將以下行添加到 rsyslog 配置文件:
mail.* @192.168.10.254:514
以下示例監視兩個文件。 如果您只需要一個,請移除第二個。 如果您需要更多,請根據示例添加它們;)。 此代碼必須放在 /etc/rsyslog.conf 中(或您的發行版放置 rsyslog 的配置文件的任何位置)。 請注意,只需要指定實際需要的命令。 第二個文件使用較少的命令,而是使用默認值。
module(load="imfile" PollingInterval="10") #needs to be done just once
# File 1
input(type="imfile"
File="/path/to/file1"
Tag="tag1"
Severity="error"
Facility="local7")
# File 2
input(type="imfile"
File="/path/to/file2"
Tag="tag2")
# ... and so on ... #
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.