Rsyslog Queue调优

Rsyslog 是很多linux发行版中默认的日志管理工具,用于替换陈旧的syslog. 个人觉得它的设计很简单可靠.以下是rsyslog的一个处理流程,摘抄自RHEL:


在rsyslog中的queue有一种 Disk-Assisted In-memory 工作模式,可用于转发时中心服务器宕机导致日志丢失的情况。
只需在配置中添加 $objectQueueFileName 选项即可激活此模式.
而另外3个参数则可控制对列具体工作情况,
$objectQueueSize number		 # In-memory 对列大小
$objectQueueHighWatermark number #触发写文件当前 In-memory 对列阀值 
$objectQueueLowWatermark  humber #触发停止写文件当前 In-memory 对列阀值 

配置示例:
# 使用老版语法必须在每个action前都定义一次配置


$ActionQueueType LinkedList
$ActionQueueFileName example_fwd1
$ActionResumeRetryCount -1
$ActionQueueSaveOnShutdown on
*.*       @@example1.com


$ActionQueueType LinkedList
$ActionQueueFileName example_fwd2 
$ActionResumeRetryCount -1
$ActionQueueSaveOnShutdown on
*.*       @@example2.com


新版语法
*.* action(type="omfwd"
      queue.type="linkedlist"
      queue.filename="example_fwd"
      action.resumeRetryCount="-1"
      queue.saveOnShutdown="on"
      queue.maxDiskSpace="5g"
      target="example.com" port="514" protocol="tcp"
     )


注:
1> rsyslog 官网的文档实在是太乱了,尤其是配置文件部分,每个版本都有改动,但是官网只有最新版本的参数介绍,好几次我按照文档的参数写配置文件,或者报错,或者参数不起作用, 如果使用 RHEL/CentOS,强烈建议查看RHEL官方手册中的 rsyslog 章节.
2> Disk-Assisted In-memory 在 omelasticsearch, omhdfs, omkafka, ommongodb, ommysql 这些模块使用中强烈建议使用;


参考:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/s1-working_with_queues_in_rsyslog.html#sec-Using_the_New_Syntax_for_rsyslog_queues
http://www.rsyslog.com/doc/master/rainerscript/queue_parameters.html
http://www.rsyslog.com/doc/v7-stable/concepts/queues.html

http://www.rsyslog.com/doc/master/configuration/modules/idx_output.html

syslog syslog-ng rsyslog flume scribe 各种尝试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值