商讯信箱
用户名: @
密  码:   注册|忘记密码
登录
个人用户经销商
您的位置:首页 > 服务器频道 > 正文

Cronolog在Windows + Apache下的安装

作者:xiaohui.com  2007-12-29

    【IT168 专稿】Apache 的日志默认是直接写入一个独立的 log 文件。如果网站流量大,日志文件很快就会变得很庞大;而 AWStats 等日志分析软件,要求日志文件以天的格式保存。cronolog 正好可以解决这个问题:它可以对 Apache 的日志按需要进行截断处理(cronolog 也是Apache推荐使用的日志工具之一),是使用 AWStats 进行日志分析的基础。这是cronolog 官方网站 http://www.cronolog.org/ 上的介绍:

    cronolog is a simple filter program that reads log file entries from standard input and writes each entry to the output file specified by a filename template and the current date and time. When the expanded filename changes, the current file is closed and a new one opened. cronolog is intended to be used in conjunction with a Web server, such as Apache, to split the access log into daily or monthly logs.

    如何在 Linux+Apache 环境下安装 cronolog 的文章很多,此文简单地说明一下 cronolog 在 Windows + Apache 下的安装:
    1. 首先到 cronolog 的网站 http://www.cronolog.org/下载。注意应该下载 Win 32 version (ZIP file) 的版本。目前最新的 win 32 version 是 1.6.1。

    2. 将 zip 文件下载之后,将 cronolog.exe 解压并复制到 Apache 的 bin 目录

    3. 在 apache 的配置文件 httpd.conf 中, 修改以下代码:

    4. CustomLog "|bin/cronolog.exe logs/access_%Y%m%d.log" combined
    ErrorLog "|bin/cronolog.exe logs/error_%Y%m%d.log"
    也可以在虚拟主机配置中使用,例如:
    <VirtualHost *:80>
    ServerName www.xiaohui.com
    CustomLog "|bin/cronolog.exe logs/xiaohui.com/access_%Y%m%d.log" combined
    ErrorLog "|bin/cronolog.exe logs/xiaohui.com/error_%Y%m%d.log"
    </VirtualHost>

    5. 重新启动 Apache.

    6. 其他设置说明,请见下载包中的 README 文件。 

    注:本文经作者xiaohui.com授权IT168服务器频道刊登,原文链接:www.xiaohui.com

1
【内容导航】
第1页: 第1页
©版权所有。未经许可,不得转载。
[责任编辑:杨晓勇]
[an error occurred while processing this directive]
本类最新产品
本类最热产品