如何让Apache错误日志能够让多个程序处理?(??)

如何让Apache错误日志能够让多个程序处理?(??)

系统是redhat AS 4 + apache1.3

服务器上跑了一堆虚拟主机,错误日志都是记录都是如下定义方式:
[root@cms101 conf]# more vhnews.conf
<VirtualHost *>
    DocumentRoot /opt/www/news
    DirectoryIndex index.html
    ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log"
    CustomLog   "|/usr/local/sbin/cronolog /op/logs/%Y/%m/%d/news_access_log" common
</VirtualHost>

由于服务器在调整的原因,一些文件还没有更新(或者这个一些文件不在需要了),所以在news_error_log里面看到了一堆这样的信息:
[Tue Sep 11 00:00:04 2007] [error] [client 10.0.251.204] File does not exist: /opt/www/news/2007-09-07/100626487_whosay.inc
[Tue Sep 11 00:00:04 2007] [error] [client 10.0.251.204] unable to include "/2007-09-07/100626487_whosay.inc" in parsed file /opt/www/news/2007-09-07/100626487.html
[Tue Sep 11 00:00:04 2007] [error] [client 10.0.251.204] File does not exist: /opt/www/news/commentcount/2007-09-07/100626487.inc
[Tue Sep 11 00:00:04 2007] [error] [client 10.0.251.204] unable to include "/commentcount/2007-09-07/100626487.inc" in parsed file /opt/www/news/2007-09-07/100626487.html

是否有什么办法不记录这些信息?

http://man.chinaunix.net/newsoft ... /core.html#loglevel
ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log"

现在ErrorLog已经用了cronlog处理了,如何再用一个自己的脚本处理再生成news_error_log文件??
还有人知道吗?

就是在生成这个错误文件之间在进行一次过滤!!!
ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log"
SetEnvIf Request_URI "(unable to include|File does not exist)" file_not_found
ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log"
env=!file_not_found
没测试过,大概是这样吧


QUOTE:
原帖由 ajinjin 于 2007-9-18 11:52 发表
SetEnvIf Request_URI "(unable to include|File does not exist)" file_not_found
ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log"
env=!file_not_found
没测试过,大概是这样吧

不行啊,env=!file_not_found加不到 ErrorLog语句里面
SetEnvIf Request_URI "(unable to include|File does not exist)" file_not_found
ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log" env=!file_not_found
语法应该没问题,有问题的只会是过滤的pattern,env=!file_not_found紧跟在ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log" 后面,注意有个空格


QUOTE:
原帖由 ajinjin 于 2007-9-19 11:01 发表
SetEnvIf Request_URI "(unable to include|File does not exist)" file_not_found
ErrorLog    "|/usr/local/sbin/cronolog /opt/logs/%Y/%m/%d/news_error_log" env=!file_not_found
语法应该没问题,有问题 ...

我是这么添加的,配置文件的检查都不成功:
#### add for deal with ErrorLog
SetEnv Request_URI "(unable to include|File does not exist)" file_not_found
#ErrorLog logs/error_log
ErrorLog    "|/usr/local/sbin/cronolog /hexun/apache/logs/%Y/%m/%d/error_log" env=!file_not_found
[root@rhel401 bin]# ./apachectl configtest
Syntax error on line 543 of /hexun/apache/conf/httpd.conf:
ErrorLog takes one argument, The filename of the error log
说:ErrorLog 只能有一个参数,然后我把env=!file_not_found放到引号里面也不行,说cronolog参数不对

我查了一个apache2.0的文档,
An HTTP request header field (see RFC2616 for more information about these); for example: Host, User-Agent, Referer, and Accept-Language. A regular expression may be used to specify a set of request headers.
SetEnvIf是定义请求的,那个error(file not found)好像不属于这个请求的范畴
还有人知道吗?