AWstats 定期更新日志数据

  | 转载时请务必以超链接形式标明文章原文链接和作者信息及本版权声明。
原文链接:http://www.liaojl.com/archives/2007/10/awstats-update-logs.html

在Linux下,通过Cron可以很方便的定期更新日志数据:

01 01 * * * /var/www/liaojl.com/awstats/cgi-bin/awstats.pl \
-update -config=liaojl> /dev/null 2>&1

为了防止logrotate时丢失日志,在执行logrotate前,添加更新日志数据的命令,编辑/etc/logrotate.d/httpd文件,在postrotate前添加:

sharedscripts
prerotate
     /var/www/liaojl.com/awstats/cgi-bin/awstats.pl \
       -update -config=liaojl> /dev/null 2>&1 || true
endscript

另外,也可以通过浏览器更性AWStats日志数据,修改配置文件中的选项 AllowToUpdateStatsFromBrowser=1,在AWStats主页上就多出来update now的链接。不过这种方式需要apache用户有读取日志文件和写入datadir目录的权限,因此不是很安全并且很难控制。

Leave a comment

Archives

Creative Commons License
This blog is licensed under a Creative Commons License.