Chinaunix首页 | 论坛 | 博客
  • 博客访问: 178354
  • 博文数量: 55
  • 博客积分: 1471
  • 博客等级: 上尉
  • 技术积分: 420
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-08 14:00
文章分类

全部博文(55)

文章存档

2012年(5)

2011年(50)

分类: LINUX

2011-03-21 18:29:37

=======================================================================================================================================
Configuration Directives :
    * $InputFileName /path/to/file
      监控文件路径,必须为绝对路径(不支持动态路径)。
    * $InputFileTag tag:
      对所监控文件产生的所有消息打上统一的标签(便于区分),如果想看到标签
    * $InputFileStateFile
      Rsyslog必须跟踪标记被监控文件的哪些部分是已经处理过的,然后保存在一个状态文件中,这个文件通常保存在rsyslog的工作目录(通过参数$WorkDirectory配置)。一定要确保name-of-state-file名称的唯一性(一个关键字只能对应一个唯一的文件),否则rsyslog将不能正常工作。Rsyslog目前并不能自动检查此名称是否被多次使用过。
    * $InputFileFacility facility
      The syslog facility to be assigned to lines read. Can be specified in textual form (e.g. "local0", "local1", ...) or as numbers(e.g. 128 for "local0"). Textual form is suggested. Default  is "local0".
    * $InputFileSeverity
      The syslog severity to be assigned to lines read. Can be specified in textual form (e.g. "info", "warning", ...) or as numbers(e.g. 4 for "info"). Textual form is suggested. Default is "notice".
    * $InputRunFileMonitor
      激活当前监控设置,此项没有参数。如果忘记指定,则文件的监控配置将不生效。
    * $InputFilePollInterval seconds
      这是一个全局设置,设定轮询文件的频率,多长时间检查文件的新数据,时间单位为秒,默认值为10秒执行一次轮询。
      如果指定多个$InputFilePollInterval设置,则只有最后一个设置生效。
      较短的轮询间隔提供了更快速的消息转发,但是需要消耗较多的系统资源。建议不要设置轮询间隔为0秒,这将会占用大量的cpu资源。如果需要及时获取消息,1秒的时间应该足够了。只要被监控文件有新的数据写入imfile模块就会一直读取下去,直到没有新的数据写入文件中才会停止读取。
    * $InputFilePersistStateInterval [lines]
      Available in 4.7.3+, 5.6.2+
      指定在监控文件时多长时间保存一次状态文件。默认值为0,表示只有在停止读取监控文件时才保存一个新的状态文件(rsyslog执行结束)。任何其他值n是指在每次处理n行的信息后才保存一次状态文件。
      此设置可用于防止发生错误后重复发送已经发送过的信息。
      此项设置会影响imfile性能,尤其是当设置的值比较低的时候,经常保存状态文件是非常耗时的。
    * $InputFileReadMode [mode] $
      Available in 5.7.5+
      Mode to be used when reading lines. 0 (the default) means that each line is forwarded as its own log message.
    * $InputFileBindRuleset
      Available in 5.7.5+, 6.1.5+ Binds the listener to a specific ruleset .
注意事项:
    到目前为止,只有100个文件可以被监控。如果需要监控更多的文件需要打补丁。
=======================================================================================================================================
Sample:
$ModLoad imfile #
needs to be done just once
# File 1
$InputFileName /path/to/file1
$InputFileTag tag1:
$InputFileStateFile stat-file1
$InputFileSeverity error
$InputFileFacility local7
$InputRunFileMonitor
# File 2
$InputFileName /path/to/file2
$InputFileTag tag2:
$InputFileStateFile stat-file2
$InputRunFileMonitor
# ... and so on ...
#
# check for new lines every 10 seconds
$InputFilePollingInterval 10
=======================================================================================================================================
阅读(4336) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

zhzghyd2012-11-23 11:17:27

那个“$InputFilePollingInterval 10”中的“$InputFilePollingInterval ” 好像多了ing,应该是#$InputFilePollInterval 10吧。