Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

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

$
0
0

问题:

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


Viewing all articles
Browse latest Browse all 11063

Trending Articles