码迷,mamicode.com
首页 > 其他好文 > 详细

rsyslog传输指定目录下的全部日志数据

时间:2019-11-06 13:09:05      阅读:542      评论:0      收藏:0      [点我收藏+]

标签:usr   rds   mail   egrep   roo   conf   grep   localhost   als   

准备:

两台Linux电脑

server(A):10.1.75.177

client(B):10.1.75.229

目的:

将B上的/usr/local/record目录下的所有日志数据传输到A的/var/log/mylog/xxx.log文件中

 

操作:

A端

1、安装rsyslog

2、配置/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端

1、安装rsyslog

2、配置/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

  

rsyslog传输指定目录下的全部日志数据

标签:usr   rds   mail   egrep   roo   conf   grep   localhost   als   

原文地址:https://www.cnblogs.com/andy9468/p/11804300.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!