限制 Apache日志文件大小的方法
2019年05月07日
| 萬仟网网络运营
| 我要评论
通常我们是在{$apache}/conf/httpd.conf中设置apache的参数,然而我们并没有发现可以设置日志文件大小的配置指令,通过参考http://httpd.
通常我们是在{$apache}/conf/httpd.conf中设置apache的参数,然而我们并没有发现可以设置日志文件大小的配置指令,通过参考http://httpd.apache.org/docs/2.0/programs/rotatelogs.html,可以用apache 自己的程序 rotatelogs.exe(位于 {$apache}/bin/目录下),来限制日志文件的大小。
usage: rotatelogs [-l] [offset minutes from utc] or
add this:
transferlog "|rotatelogs /some/where 86400"
or
transferlog "|rotatelogs /some/where 5m"
to httpd.conf. the generated name will be /some/where.nnnn where nnnn is the system time at which the log nominally starts (n.b. if using a rotation time, the time will always be a multiple of the rotation time, so you can synchronizecron scripts with it). at the end of each rotation time or when the file size is reached a new log is started.
在 windows 下的设置例子如下:
# 限制错误日志文件为 1m
errorlog "|bin/rotatelogs.exe -l logs/error-%y-%m-%d.log 1m"
# 每天生成一个错误日志文件
#errorlog "|bin/rotatelogs.exe -l logs/error-%y-%m-%d.log 86400"
# 限制访问日志文件为 1m
customlog "|bin/rotatelogs.exe -l logs/access-%y-%m-%d.log 1m" common
# 每天生成一个访问日志文件
#customlog "|bin/rotatelogs.exe -l logs/access-%y-%m-%d.log 86400" common
linux/unix下 应该类似。
版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。
相关文章:
以下以rvctools为例
具体操作如下:
1. 先将下载好的压缩包(robot-9.10.zip)解压,得到工具包rvctoo...
准备工作
先在vs2012上编译一个winform,代码如下:
using system;
using system....
对于现代嵌入式设备,特别是手机来说,摄像头是很重要的一个设备。很多同学买手机,一看颜值,第二就看摄像头拍照如何。所以,从某个角度来说...
我们经常会需要知道服务器的实时监测服务器的运行状况,比如哪些 url 的访问量最大,服务器每秒的请求数,哪个搜索引擎正在抓取我们网站...
idc里的一台服务器的/分区使用率爆满了!已达到100%!经查看发现有个文件过大(80g),于是在跟有关同事确认后rm -f果断删除该文件。但是发现删除该文件后...
准备篇
1、配置防火墙,开启80端口、3306端口vi /etc/sysconfig/iptables-a input -m st...
说下防止phpddos发包的方法 复制代码 代码如下: if (eregi("ddos-udp",$read)) { fputs($...
在系统遇到各种io瓶颈,内存使用率高,cpu使用率高等问题时,我们如何来定位错误?linux提供了很多命令来协助我们快速定位到错误,...
背景
前段时间,我们的项目组在帮客户解决一些操作系统安全领域的问题,涉及到windows,linux,macos三大操作系统平...
在php程序中运用fopen或者socket的时候,报一下错误: php_network_getaddresses: getaddr...
网友评论
验证码: