您的位置:首页 > 运维架构 > Linux

服务器(9)--Linux之系统日志rsyslog转发

2018-02-28 18:18 716 查看
一、简介
RSYSLOG is the rocket-fast system for log processing.
It offers high-performance, great security features and a modular design. While it started as a regular syslogd, rsyslog has evolved into a kind of swiss army knife of logging, being able to accept inputs from a wide variety of sources, transform them, and output to the results to diverse destinations.
RSYSLOG can deliver over one million messages per second to local destinations when limited processing is applied (based on v7, December 2013). Even with remote destinations and more elaborate processing the performance is usually considered "stunning".



1、rsyslog 是一个快速处理收集系统日志的程序,提供了高性能、强大的安全特性和模块化设计
2、rsyslog 是syslog 的升级版,自centos6起,系统日志配置文件/etc/syslog.conf不再存在,取而代之的是/etc/rsyslog.conf
3、判断服务器上是否安装rsyslog,命令:rsyslogd -version



4、如果服务器上没有安装rsyslog,则安装,命令:yum install rsyslog -y

二、部署
1、环境图

2、rsyslog server上的部署操作
编辑rsyslog配置文件,路径/etc/rsyslog.conf,修改前最好先备份一份,修改后的文件内容如下:[root@opm log]# grep -v "^#" /etc/rsyslog.conf | grep -v "^$"
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
$ModLoad immark # provides --MARK-- message capability
$ModLoad imudp
$UDPServerRun 514
$ModLoad imtcp
$InputTCPServerRun 514
$WorkDirectory /var/lib/rsyslog
$AllowedSender tcp, 192.168.30.0/24
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$template Remote,"/data/log/%fromhost-ip%/%fromhost-ip%_%$YEAR%-%$MONTH%-%$DAY%.log"
:fromhost-ip, !isequal, "127.0.0.1" ?Remote
$IncludeConfig /etc/rsyslog.d/*.conf
$OmitLocalLogging on
$IMJournalStateFile imjournal.state
*.info;mail.none;authpriv.none;cron.none /data/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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: