freshStartTail 第一次启动时 抛弃旧的日志

本文介绍了rsyslog的配置方法,特别是如何通过设置freshStartTail参数来忽略旧日志,仅处理新产生的日志消息。这对于大规模部署rsyslog到众多服务器时非常有用,可以避免大量旧日志对中央日志接收器造成不必要的负担。
freshStartTail [on/off] (requires v8.18.0+)
Default: off

This is used to tell rsyslog to seek to the end/tail of input files (discard old logs)**at its first start(freshStart)** and process only new log messages.

When deploy rsyslog to a large number of servers, we may only care about new log messages generated after the deployment. set freshstartTail to on will discard old logs. Otherwise, there may be vast useless message burst on the remote central log receiver


这是告诉 rsyslog来寻求 输入日志的尾部,抛弃旧的日志 在第一次启动的时候,只处理最新的日志

当部署rsyslog 到一大量的服务器的时候,我们只关心新的日志,

设置 freshstartTail 为on 会忽略老的日志。

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog   # provides kernel logging support (previously done by rklogd)
module(load="imfile" PollingInterval="5")
$ModLoad imtcp
$InputTCPServerRun 514
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
*.info;mail.none;authpriv.none;cron.none;local5.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
$InputFilePersistStateInterval 1
input(type="imfile"
File="/var/log/nginx/access.log"
Tag="zjzc-frontend01-access"
PersistStateInterval="1"
reopenOnTruncate="on"
freshStartTail="on"
Severity="info"
Facility="local5")


input(type="imfile"
File="/var/log/nginx/error.log"
Tag="zjzc-frontend01-error"
Severity="info"
PersistStateInterval="1"
reopenOnTruncate="on"
freshStartTail="on"
Facility="local5")
local5.* @@115.236.160.82:9514

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6198931.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值