nginx 日志过滤网络爬虫访问日志
nginx里面有很多的爬虫日志,会影响到后期的数据分析,所以一般会去掉。
nginx排除配置:
location / {
#去掉爬虫 Start
if ($http_user_agent ~* "bot|spider") {
access_log off;
}
#去掉爬虫 end
proxy_pass http://cdel_jxjy;
......
}如果特别想要爬虫日志,也可以讲爬虫日志放到指定的文件中
location / {
if ($http_user_agent ~* "bot|spider") {
access_log /var/log/nginx/spider.access.log;
}
......
}本文出自 “屌丝程序员的逆袭” 博客,请务必保留此出处http://cdelliqi.blog.51cto.com/9028667/1540300
文章来自:http://cdelliqi.blog.51cto.com/9028667/1540300