阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Apache访问日志access.log按天归档

151次阅读
没有评论

共计 1490 个字符,预计需要花费 4 分钟才能阅读完成。

问题:
Apache 访问日志 access.log 文件记录数会一直递增,文件大小一直变大;当达到一定大小后,会导致效率问题;

解决方案:
Apache 访问日志 access.log 按天归档,每天自动生成一个新的 access.log 日志,避免单个文件过大导致效率问题;

具体步骤如下:
OS:Windows Server 2008
一:更改 Apache 配置文件 G:\IBM\HTTPServer\conf\http.conf:
将 httpd.conf 文件中
CustomLog logs/access.log common 前面加上 #号 (注释)
#CustomLog logs/access.log common

二:
增加语句如下:
CustomLog “|G:\IBM\HTTPServer\bin\rotatelogs.exe logs\access_%Y_%m_%d.log 86400 480” common

三:
重启 Apache
G:\IBM\HTTPServer\bin\Apache.exe -k stop
G:\IBM\HTTPServer\bin\Apache.exe -k start

如果 Apache 启动失败,查看 error.log 日志,可以将语句中 rotatelogs.exe 或 access.log 文件路径更改成绝对路径或相对路径。

Ubuntu Server 14.04 安装 Web 服务器 (Linux+Apache+MySQL+PHP)  http://www.linuxidc.com/Linux/2015-06/119061.htm

Linux 下安装配置 PHP 环境 (Apache2)  http://www.linuxidc.com/Linux/2015-05/118062.htm

Linux 下 Apache 服务器配置  http://www.linuxidc.com/Linux/2016-06/132025.htm

Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置 http://www.linuxidc.com/Linux/2013-06/86250.htm

CentOS6.8 编译安装 Apache2.4.25、MySQL5.7.16、PHP5.6.29  http://www.linuxidc.com/Linux/2016-12/138993.htm

Linux 下 Apache 服务器配置 http://www.linuxidc.com/Linux/2016-10/136517.htm

Linux 下 Apache 虚拟主机的配置  http://www.linuxidc.com/Linux/2016-04/130381.htm

Ubuntu 下 Apache 的安装与配置 http://www.linuxidc.com/Linux/2016-11/136841.htm

CentOS 6.5 安装 Apache-2.4.10 及安全配置  http://www.linuxidc.com/Linux/2016-12/137985.htm

基于 Debian 系统的 Apache 服务器多站点配置 http://www.linuxidc.com/Linux/2016-12/138943.htm

Ubuntu 16.04 Apache 开启 Rewrite 功能  http://www.linuxidc.com/Linux/2017-01/139105.htm

Apache 的详细介绍 :请点这里
Apache 的下载地址 :请点这里

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-01/139238.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计1490字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中