rsyslog 8 通配符停止发送

rsyslog 8 通配符停止发送

我们在 rsyslog8 通配符功能和默认生成的带有日期的日志方面遇到了问题。当我第一次添加配置时,Rsyslog 会发送日志消息,但在最初处理文件后会停止发送。以前我们使用过 nxlog,而且效果不错,但我们希望将 rsyslog 上的所有内容标准化,因为它是 CentOS 的默认设置。有什么想法吗?

示例文件名: server.2016-07-12.log

#### 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 omrelp

module(load="imfile"
     mode="inotify"
)


#### GLOBAL DIRECTIVES ####

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$PreserveFQDN on

# 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

#### Filter ####

if $programname == 'dhclient' and $syslogseverity == '6' then stop
if $programname == 'snmpd' and ( $msg contains 'Connection from UDP' or $msg contains 'Received SNMP packet(s) from UDP' ) then stop

#### 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 or app logs!
*.info;mail.none;authpriv.none;cron.none;local4.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.*                                                  /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 also to boot.log
local7.*                                                /var/log/boot.log

#Queuing setup
$WorkDirectory /var/spool/rsyslog # where to place spool files
$ActionResumeInterval 10
$ActionQueueSize 100000
$ActionQueueDiscardMark 97500
$ActionQueueHighWaterMark 80000
$ActionQueueType LinkedList
$ActionQueueFileName queue
$ActionQueueCheckpointInterval 100
$ActionQueueMaxDiskSpace 2g
$ActionResumeRetryCount -1
$ActionQueueSaveOnShutdown on
$ActionQueueTimeoutEnqueue 10
$ActionQueueDiscardSeverity 0

#SSL Configuration
$DefaultNetstreamDriverCAFile /etc/ssl/certs/cert.pem
$ActionSendStreamDriver gtls
$ActionSendStreamDriverMode 1
$ActionSendStreamDriverAuthMode x509/name
$ActionSendStreamDriverPermittedPeer log.domain.com

*.info;mail.none;authpriv.none;cron.none;local4.*   @@log.domain.com:5514

#Server Log File
input(type="imfile"
      File="/var/log/server/*.log"
      Tag="server_log"
      Severity="error"
      Facility="local4")

答案1

我发现 /var/spool/rsyslog 中有旧状态文件。删除后,一切正常。

相关内容