Cronolog 在 Windows + Apache 下的安装


日期: 2007-05-01 14:00 | 联系我
关注我: Telegram, Twitter

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

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 的文章很多,此文 (https://www.xiaohui.com/dev/server/20070401-apache-cronolog-windows-install.htm) 简单地说明一下 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 中, 修改以下代码:
    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>
  4. 重新启动 Apache.
  5. 其他设置说明,请见下载包中的 README 文件。

 文章评论

第 1 楼  发表于 2007-05-08 20:03 | 一直关注 的所有评论
看不懂,但一直支持小辉,沙发感觉不错,呵呵
回复于 2007-05-09 08:45:
谢谢. :)

第 2 楼  发表于 2007-05-13 16:19 | haha 的所有评论
控制DPS ,别OT了

第 3 楼  发表于 2011-05-17 22:44 | 心斋 的所有评论
感谢小辉。我安装apache的时候没有分割日志,过几天就达到1G了,现在按照你的方式来处理,方便多了。
回复于 2011-05-18 17:22:
客气。欢迎多交流。 :)

共有评论 3 条, 显示 3 条。

当前页面是本站的 百度 MIP 版本。
欲查看完整版本和发表评论请点击:完整版 »

 

程序员小辉 建站于 1997
Copyright © XiaoHui.com; 保留所有权利。