All the log data in the specified directory transmission rsyslog

ready:

Two Linux computers

server(A):10.1.75.177

client (B): 10.1.75.229

purpose:

Transmitting all log data in the / usr / local on B / record directory to the file A in /var/log/mylog/xxx.log

 

operating:

A-end

1, install rsyslog

2, the configuration /etc/rsyslog.conf

[root@localhost ~]# cat /etc/rsyslog.conf |egrep -v "^(#|$)"
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
$ModLoad imudp
$UDPServerRun 514
$ModLoad imtcp
$InputTCPServerRun 10514
$WorkDirectory /var/lib/rsyslog
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
$OmitLocalLogging on
$IMJournalStateFile imjournal.state
*.info;mail.none;authpriv.none;cron.none                /var/log/messages
authPriv. * / var / log / secure
mail. * - / var / log / maillog
cron. * / var / log / cron
*.emerg                                                 :omusrmsg:*
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log
local0.*                                    /var/log/mylog/slave_history_all.log

  

 

B-side

1, install rsyslog

2, the configuration /etc/rsyslog.conf

[root@localhost /etc]# cat /etc/rsyslog.conf |egrep -v "^(#|$)"
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
$ModLoad imudp
$UDPServerRun 514
$ModLoad imtcp
$InputTCPServerRun 10514
$WorkDirectory /var/lib/rsyslog
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
$OmitLocalLogging on
$IMJournalStateFile imjournal.state
*.info;mail.none;authpriv.none;cron.none                /var/log/messages
authPriv. * / var / log / secure
mail. * - / var / log / maillog
cron. * / var / log / cron
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log
module(load="imfile" PollingInterval="10")
input(type="imfile" File="/usr/local/records/*/*" Tag="CalculationUnit" Severity="info" Facility="local0" freshStartTail="on" deleteStateOnFileDelete="on")
local0.*                             @@10.1.75.177:10514

  

Guess you like

Origin www.cnblogs.com/andy9468/p/11804300.html