免费注册 查看新帖 |

Chinaunix

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

[Web] 在httpd.conf的log_config_module模块中如何设定日志切割 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-12-28 19:58 |只看该作者 |倒序浏览
RT!

服务器的虚拟站点中都定义了日志切割。但是在主配置文件httpd.conf中还定义了

<IfModule log_config_module>
    #
    #
    #  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    #  LogFormat "%h %l %u %t \"%r\" %>s %b" common
       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
   # You need to enable mod_logio.c to use %I and %O
    #
    # 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
   CustomLog logs/access_log combined
    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "|/usr/local/apache2/bin/rotatelog logs/access_log.%Y-%m-%d 86400" combined
</IfModule>


这个好处是可以直接得到一个合并起来的日志。

但是这个日志没有设置日志切割。我试图将

CustomLog logs/access_log combined


改成
CustomLog "|/usr/local/apache/bin/rotatelogs logs/access_log.%Y-%m-%d 86400" combined

而后重启httpd:
/usr/local/apache/bin/apachectl -k graceful

结果httpd挂了。网页打不开。。。



打开错误日志一看,全是:
piped log program '/usr/local/apache/bin/rotatelogs logs/access_log.%Y-%m-%d 86400' failed unexpectedly
Could not open log file 'logs/access_log.2010-12-28' (No such file or directory)

即使手动建立一个access_log.2010-12-28也没用!!!

求问该咋办????
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP