# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html # If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
#### MODULES #### # 加载模块 # The imjournal module bellow is now used as a message source instead of imuxsock. # 加载 imuxsock 模块,为本地系统登陆提供支持(例如通过logger命令) $ModLoad imuxsock # provides support for local system logging (e.g. via logger command) # 提供对systemd日志的访问 $ModLoad imjournal # provides access to the systemd journal # 加载 imklog,为内核登陆提供支持 #$ModLoad imklog # reads kernel messages (the same are read from journald) # 提供标记信息功能 #$ModLoad immark # provides --MARK-- message capability
#### 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
# Turn off message reception via local log socket; # local messages are retrieved through imjournal now. # 通过本地消息日志套接字关闭消息接收,本地消息可以用imjournal检索 $OmitLocalLogging on
# File to store the position in the journal # 在日志中文件用于存储的位置 $IMJournalStateFile imjournal.state
# Save news errors of level crit and higher in a special file. # uucp 和 news 设备的 crit 级别的信息记录到这个文件 uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log # 将系统启动相关的信息记录在这个文件 local7.* /var/log/boot.log
# ### begin forwarding rule ### # 转发规则 # The statement between the begin ... end define a SINGLE forwarding # rule. They belong together, do NOT split them. If you create multiple # forwarding rules, duplicate the whole block! # 远程日志可以使用 TCP 保持可靠 # Remote Logging (we use TCP for reliable delivery) # # 创建一个磁盘上的队列,如果远程的主机是关闭的状态,消息会先存储在磁盘中并且在远程主机启动时发送过去(TCP) # An on-disk queue is created for this action. If the remote host is # down, messages are spooled to disk and sent when it is up again. # spool 文件 唯一的前缀 #$ActionQueueFileName fwdRule1 # unique name prefix for spool files # 1gb的空间限制(尽量使用) #$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible) # 在关机的时候把信息存储在磁盘中 #$ActionQueueSaveOnShutdown on # save messages to disk on shutdown # 异步运行 #$ActionQueueType LinkedList # run asynchronously # 如果远程主机宕机,将无限次重试 #$ActionResumeRetryCount -1 # infinite retries if host is down # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional # 远程的主机和端口,注意:若用UDP传输,则将@@改为@即可。 #*.* @@remote-host:514 # ### end of the forwarding rule ###