centos7,客户端和服务端使用rsyslog进行日志传输

本文介绍了如何在CentOS7系统中,利用rsyslog作为客户端和服务端进行日志传输,并在日志传输正常后,如何平滑地将服务端替换为logstash进行日志收集。在转换过程中,提到了可能遇到的514端口冲突问题及解决办法。
摘要由CSDN通过智能技术生成

客户端配置rsyslog(centos自带rsyslog,不需要另外下载)

vim /etc/rsyslog.conf
#### MODULES ####

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog   # provides kernel logging support (previously done by rklogd)
#$ModLoad immark  # provides --MARK-- message capability
$ModLoad imfile #load the dimfile module
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514


#### GLOBAL DIRECTIVES ####

# Where to place auxiliary files
$WorkDirectory /var/lib/rsyslog

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

$OmitLocalLogging on

#### RULES ####

# Log all kernel messages to the console.
# Logging much else clutters up the screen.(内核)
kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!(记录的内核消息、各种服务的公共消息,报错信息等)
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.(包含验证和授权方面信息)
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.(包含来着系统运行电子邮件服务器的日志信息)
mail.*                                                  -/var/log/maillog


# Log cron stuff(每当cron进程开始一个工作时,就会将相关信息记录在这个文件中)
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*

# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值