查找死链接

grep ‘(2: No such file or directory)’ error.log.20110311|sed ‘s/”//g’|awk ‘{if($7 ~ /(html|php)$/){if($0 !~ /guolu.xxxx.cn/){if ($0 ~ /refer/ ) print $7″ “$(NF);else print $7}}}’|sort|uniq > /tmp/err_result.log

日志内容如下:

2011/03/11 11:05:47 [error] 5487#0: *46064 open() “/data/www/gamebox/htdocs/game/sounds/frozen_explode.mp3″ failed (2: No such file or directory), client: 222.135.246.133, server: www.xxxx.cn, request: “GET /game/sounds/frozen_explode.mp3 HTTP/1.1″, host: “www.xxxx.cn“, referrer: “http://flash.xxxx.cn/flashcn/162/258/z697351283261850.swf

要求:

1.过滤guolu.xxxx.cn这个站点的错误信息

2.有referrer的话。记录referrer

3.只记录死链接为html和php的页面