Apache日志精准的记录了Web访问的记录,但对于访问量很大的站来说,日志文件过大对于分析和保存很不方便。可以在http.conf(或虚拟主机设置文件httpd-vhosts.conf)中进行设置,限制日志不记录指定文件类型,减少日志文件空间占用。

〈FilesMatch “\.(ico|gif|jpg|swf)”〉
SetEnv IMAG 1
〈/FilesMatch〉
CustomLog logs/access_log combined env=!IMAG

第一行中:蓝色部分为指定文件类型,设置后将不记录这些文件的访问;

第四行中:绿色部分为日志路径,根据实际情况设置;蓝色部分为apache日志4种记录方式(common、combined、referer、agent)之一,根据实际需要选择;env=!IMAG一定要加在最后,指令不记录上面设定的文件类型。

注:红色的括号为全角,使用时转换成半角。

一、配置apache的日志轮循

1,在http://cronolog.org/上选择最新的1.6.2版本下载
   2,安装:
         tar -zxvf cronolog-1.6.2.tar.gz
         cd cronolog-1.6.2
         ./configure
         make
         make check
         make install
     安装完毕后,检查/usr/local/sbin/目录下多了cronolog和cronosplit两个程序
   3,配置:
         修改httpd-vhosts.conf中如下:
       CustomLog "|/usr/local/sbin/cronolog /usr/local/apache2/logs/%Y/%m/%d/www.yourdomain.com-access_log" common

Apache 日志设置不记录指定文件类型的方法和日志轮的更多相关文章

  1. nginx不记录指定文件类型的日志

    1.指定记录文件日志记录的内容. vim /usr/local/nginx/conf/nginx.conf如下部分: log_format dd '$remote_addr $http_x_forwa ...

  2. nginx不记录指定文件类型日志

    1.指定记录文件日志记录的内容. vim /usr/local/nginx/conf/nginx.conf如下部分: log_format dd '$remote_addr $http_x_forwa ...

  3. LAMP 2.1Apache不记录指定文件类型日志

    访问日志只需要记地址,不用记录图片. 对无用的图片日志做标记,针对标记做限制.打开 vim /usr/local/apache2/conf/extra/httpd-vhosts.conf 把 Erro ...

  4. logback 设置按天,文件切割大小,总共日志文件大小。

    设置按天,文件切割大小,总共日志文件大小. <?xml version="1.0" encoding="UTF-8"?> <configura ...

  5. HTML input="file" 浏览时只显示指定文件类型 xls、xlsx、csv

    html input="file" 浏览时只显示指定文件类型 xls.xlsx.csv <input id="fileSelect" type=" ...

  6. <input type="file" />浏览时只显示指定文件类型

    <input type="file" />浏览时只显示指定文件类型 <input type="file" accept="appli ...

  7. findstr 只搜寻指定文件类型

    Title:findstr 只搜寻指定文件类型 --2012-05-04 09:27 findstr /i /m /S /C:"关键字"  *.php *.asp *.jsp

  8. C# 获得目录下所有文件或指定文件类型文件(包含所有子文件夹)

    public partial class FileGet { /// <summary> /// 私有变量 /// </summary> private static List ...

  9. Python,针对指定文件类型,过滤空行和注释,统计行数

    参考网络上代码编辑而成,无技术含量,可自行定制: 目前亲测有效,若有待完善之处,还望指出! 强调:将此统计py脚本放置项目的根目录下执行即可. 1.遍历文件,递归遍历文件夹中的所有 def getFi ...

随机推荐

  1. CRF++地名实体识别(特征为词性和词)

    http://x-algo.cn/index.php/2016/02/29/crf-name-entity-recognition/ 类似使用CRF实现分词和词性标注,地域识别也是需要生成相应的tag ...

  2. SQL-order by两个字段同时排序

    ORDER BY 后可加2个字段,用英文逗号隔开. --f1用升序, f2降序,sql该这样写 ORDER BY f1, f2 DESC --也可以这样写,更清楚: ORDER BY f1 ASC, ...

  3. php获取网址

    #测试网址: http://localhost/blog/testurl.php?id=5 //获取域名或主机地址 echo $_SERVER['HTTP_HOST']."<br> ...

  4. [Algorithm] Check for balanced parentheses using stack

    Algorithm or program to check for balanced parentheses in an expression using stack data structure. ...

  5. [Algorithm] Count occurrences of a number in a sorted array with duplicates using Binary Search

    Let's say we are going to find out number of occurrences of a number in a sorted array using binary ...

  6. 【Python】使用torrentParser1.02对单文件torrent的分析结果

    C:\Users\horn1\Desktop\python\41-torrentParser>python torrentParser.py 文件名=./5.torrent 文件结构: anno ...

  7. 通过wlst工具创建weblogic11g域单节点包括服务与被管服务

    1:创建域(1)节点一执行 export MV_HOME=/home/wzh/Oracle/Middleware export WL_HOME=$MV_HOME/wlserver_10. export ...

  8. 微信 js api[转]

    rainbow661314 微信api /**! * 微信内置浏览器的Javascript API,功能包括: * * 1.分享到微信朋友圈 * 2.分享给微信好友 * 3.分享到腾讯微博 * 4.新 ...

  9. strus2 struts.xml详解

    <struts> <!-- 配置一个包:package --> <package name="demo1" extends="struts- ...

  10. Intellij IDEA连接Spark集群

    1. 首先安装Scala插件,File->Settings->Plugins,搜索出Scla插件,点击Install安装: 2. File->New Project->mave ...