我试图通过几个过滤器来关闭apache错误日志。CLI程序之间管道输出时的缓冲问题
这完美的作品:
tail -fn0 /var/log/apache2/error.log | egrep -v "PHP Notice|File does not exist"
但也有一些文字“\ n”,其中我想用实际的新的生产线,所以我管到Perl来代替输出:
tail -fn0 /var/log/apache2/error.log | egrep -v "PHP Notice|File does not exist" | perl -ne 's/\\n/\n/g; print"$_"'
这似乎有一些缓存问题(第一页命中什么都不产生,第二页命中和两个负载调试信息出来),它也似乎有点临时工。
于是,我就SED:
tail -fn0 /var/log/apache2/error.log | egrep -v "PHP Notice|File does not exist" | sed 's/\\n/\n/g'
这似乎遭遇了同样的问题。
完美!谢谢。 – aidan 2011-03-31 16:37:16