请教:nginx日志记录
时间:2010-03-19
来源:互联网
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request_method $scheme://$host$request_uri $server_protocol" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
但是我发现日志中记录的很多内网访问的记录,就是$remote_addr都是192.168.xx.xx这样的记录,因为日志比较大,所以我不想要这部分的记录。
也就是说nginx能否做到根据来源IP来判断是否记录日志呢?像squid的那样?
谢谢!
作者: haoyu323 发布时间: 2010-03-19
to prevent your log file from being unlimitedly increased.you have to rotate your log file.
these log files are divided by one day or several hours.to do so.you search the Internet to get help.
作者: todayhero 发布时间: 2010-03-19
毕竟都有自己的需求在,这里的日志是需要每天上传并分析的,并且还要备份。
所以不太希望里面出现大量的无用数据,最笨的办法是在上传前先把不要的数据grep -v掉。
但是我还是希望能通过nginx自己的一些机制来处理。
毕竟grep很不效率。
谢谢!
作者: haoyu323 发布时间: 2010-03-19
your requirement is little particular.ordinary OS can not help you.you thoroughly depend on yourself.i don't find out any helps from the manual of nginx documents.if you have the time.you carefully read its manual.
Can you tell me whether the clients of LAN access the specific directory.if the clients of LAN acces the specific content you can separately log their access log.such as
location /foobar {
access_log /var/log/foobar.log;
}
this example indicted the access log of 'footbar' directory is written to foobar.log
if this feature is not built-in you only use third-party tools or program developed by yourself.
good luck.
作者: todayhero 发布时间: 2010-03-19
作者: scyzxp 发布时间: 2010-03-19
thanks for your praise.i am bored to be dead every day.have no alternate but learning english.
作者: todayhero 发布时间: 2010-03-19
access_log /var/log/foobar.log;
}
perfect !!!
OK!实现分离了,不需要的虽然没有禁止,但是他记录到了另外一个access.log中,这就是我的需要的!
非常感谢todayhero !!
感谢!
作者: haoyu323 发布时间: 2010-03-19
我想你应该去翻译一些技术手册这样学习更快。
作者: scyzxp 发布时间: 2010-03-19
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28