免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2760 | 回复: 4
打印 上一主题 下一主题

[Web] apache 的日志问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-10-25 19:07 |只看该作者 |倒序浏览
一台服务器提供web服务,apache 2。0。52 做了好几个虚拟主机,每个虚拟主机的配置文件都差不多,但是其他几个网站的日志都按照logrotate的配置,是当前日志和保留的四周日志,只是有一个网站的访问日志没有rotate,是一个大文件,现在已经1GB多了,而且这个网站的error日志倒是对的,就是access日志有问题

问题可能出在哪里?谢谢!

论坛徽章:
0
2 [报告]
发表于 2007-10-25 22:19 |只看该作者
http://man.chinaunix.net/newsoft ... nfig.html#customlog

還有 man rotatelogs

唉,你所了解的知识点,应该已经可以自己解决问题了,可是文档不是看报纸那种看法的啊,兄弟

论坛徽章:
0
3 [报告]
发表于 2007-10-26 09:02 |只看该作者
原帖由 alvis 于 2007-10-25 22:19 发表
http://man.chinaunix.net/newsoft ... nfig.html#customlog

還有 man rotatelogs

唉,你所了解的知识点,应该已经可以自己解决问题了,可是文档不是看报纸那种看法的啊 ...


非常感谢!惭愧惭愧!

apache除虚拟主机外的配置是
CustomLog logs/access_log combined


虚拟主机的配置是
<VirtualHost 192.168.x.x>
    ServerAdmin xx@xx.com
    DocumentRoot /var/www/html/xxx
    ServerName xx.xx.xx
    ErrorLog logs/xx-error_log
    CustomLog logs/xx-access_lg common
</VirtualHost>


是否要把虚拟主机里面的配置都改为:
CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common


可是虚拟主机的ErrorLog没有做什么修改,为什么自动rotate了呢?

论坛徽章:
0
4 [报告]
发表于 2007-10-26 11:37 |只看该作者
ErrorLog 的问题不知道,按理说不应该啊

不过,"CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common" 建议改为

"CustomLog "|bin/rotatelogs /var/logs/logfile.%Y%M%D 86400 4800" common"

因为我们是 GMT+8,

%Y%M%D 是举例,我不确定是不是这么写,具体的 timestr 还是看 manpage

论坛徽章:
0
5 [报告]
发表于 2008-01-21 16:26 |只看该作者
这是apache里面log部分的配置:
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog logs/access_log common

#
# If you would like to have agent and referer logfiles, uncomment the
# following directives.
#
#CustomLog logs/referer_log referer
#CustomLog logs/agent_log agent

#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
CustomLog logs/access_log combined


这是虚拟主机的配置:
<VirtualHost 192.168.x.x>
    ServerAdmin xx@xx.com
    DocumentRoot /var/www/html/xxx
    ServerName xx.xx.xx
    ErrorLog logs/xx-error_log
    CustomLog logs/xx-access_lg common
</VirtualHost>


我猜想可能是日志里面这个commoncombined的区别,这两个都是什么意思啊?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP