Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1810736
  • 博文数量: 241
  • 博客积分: 9862
  • 博客等级: 中将
  • 技术积分: 5206
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-18 23:23
文章分类
文章存档

2011年(14)

2010年(61)

2009年(48)

2008年(118)

我的朋友

分类: LINUX

2008-10-07 18:07:24

You could get your syslog.conf to point to a pipe instead of the messages file and then have a job running that reads from the pipe greps out any messages you dont want and then writes any other messages to the messages file! eg :

  1. Create a named pipe using mkfifo: mkfifo -p /var/adm/syslog.pipe
     
  2. Make syslog.conf to points to this file (for example  /var/adm/syslog.pipe)

      *.info            |/var/adm/syslog.pipe
     

  3. Relaunch syslogd:
      kill -HUP `cat /var/run/syslogd.pid`
     
  4. Create processing script that read the pipe. It should run constantly and be launched from RC scripts

    #!/bin/ksh
     
    cat /var/adm/syslog.pipe | grep -v "denied update from" | while read LINE
    do
      echo $LINE >>/var/adm/denied_update.log
    done


syslog-ng has slightly different sysntax but similar capabilities
阅读(993) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~