调整错误日志的级别

这几天 apache错误日志巨大 莫名其妙的30G  而且 很多都是那种页面不存在的  网站太多了  死链接相应的也很多
于是把错误警告调低了

因为写日志会给系统带来很大的损耗。关闭日志以后,甚至最高可以提高整体性能近40%(粗略估计)那么如何关闭日志呢?

可以通过降低log级别的办法来减少日志读写。

这里要提醒的是,这么做将给“入侵检测”以及其他基于日志分析的工作带来麻烦。所以请谨慎使用。
网上相关文章很多,但说的都不详细,擦边而过,下面详细说一下具体操作步骤。

编辑conf文件夹下的httpd.conf,找到如下内容:

=====================
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
=====================
其中,LogLevel用于调整记于错误日志中的信息的详细程度。(参阅ErrorLog指令)。可以选择下列级别,依照重要性降序排列:

Level Description Example
emerg 紧急 – 系统无法使用。 “Child cannot open lock file. Exiting”
alert 必须立即采取措施。 “getpwuid: couldn’t determine user name from uid”
crit 致命情况。 “socket: Failed to get a socket, exiting child”
error 错误情况。 “remature end of script headers”
warn 警告情况。 “child process 1234 did not exit, sending another SIGHUP”
notice 一般重要情况。 “httpd: caught SIGBUS, attempting to dump core in …”
info 普通信息。 “Server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers)…”
debug 出错级别信息 “Opening config file …”

默认级别是warn,那么warn级别以上的日志都会记录,会产生大量“文件不存在”的erro级别的错误日志。建议使用 crit 级别的设置,这样只记录致命级别以上的日志,有效减少日志数量。

把LogLevel warn更改为LogLevel crit  然后重启apache即可。

将Httpd.conf 配置文件中的ErrorLog 参数改为下面的,就可以将日志按每天生成一个日志文件.

ErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 1M”
ErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 86400″

以上是关闭apache错误日志的办法!!!

关闭 WEB日志的方法

在httpd.conf文件中,有如下一行,你删除了就不产生日志了。我是注释的方式,如:

#CustomLog "logs/access_log" common

这一行可能因你的配置不同有所修改,不一定完全相同。搜索一下就能定位到。方法就这么简单吧。最后记得要重启web服务(不用重启服务器)才有效。

解决Apache的错误日志巨大的问题以及关闭Apache web日志记录的更多相关文章

  1. 我的日志分析之道:简单的Web日志分析脚本

    前言 长话短说,事情的起因是这样的,由于工作原因需要分析网站日志,服务器是windows,iis日志,在网上找了找,github找了找,居然没找到,看来只有自己动手丰衣足食. 那么分析方法我大致可分为 ...

  2. 【处理多服务器日志合并处理问题】多服务器的日志合并统计——apache日志的cronolog轮循

    转发:http://www.chedong.com/tech/rotate_merge_log.html   内容摘要:你完全不必耐心地看完下面的所有内容,因为结论无非以下2点:1 用 cronolo ...

  3. kylin加载hive表错误:ERROR [http-bio-7070-exec-10] controller.TableController:189 : org/apache/hadoop/hive/conf/HiveConf java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveConf 解决办法

    一.问题背景 在kylin中加载hive表时,弹出提示框,内容是“oops!org/apache/hadoop/hive/conf/HiveConf”,无法加载hive表,查找kylin的日志时发现, ...

  4. 解决apache启动错误"httpd:Could not reliably determine..."

    启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name [root@serv ...

  5. apache安装错误error: APR not found解决办法

    linux安装时安装种类不同,一些组件包可能不会被安装,导致linux下安装软件的时候缺这个缺那个,今天为大家介绍linux安装apache时报apr找不到的解决办法 方法/步骤   下载依赖包 wg ...

  6. 解决apache启动错误:Could not reliably determine the server's fully qualified domain name

    启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name [root@serv ...

  7. 解决mybatis foreach 错误: Parameter '__frch_item_0' not found

    解决mybatis foreach 错误: Parameter '__frch_item_0' not found 在遍历对象的属性(是ArrayList对象)时报错: org.mybatis.spr ...

  8. hadoop错误Ignoring exception during close for org.apache.hadoop.mapred.MapTask$NewOutputCollector@17bda0f2 java.io.IOException Spill failed

    1.错误    Ignoring exception during close for org.apache.hadoop.mapred.MapTask$NewOutputCollector@17bd ...

  9. oracle 外部表及解决ora-29400,ora-29913错误

    对外部表的理解及测试,,,,如有理解不正确请大家指正 语法: create table 表名( 列名1,列名2,...... ) organization external  ###说明创建外部表 ( ...

随机推荐

  1. docker入门实战笔记

    1.什么是docker: docker翻译为搬运工,在这里应该可以理解为搬运应用的工具,也就是云.先了解其运用场景之后更容易对他形成深刻理解. Docker提供了一种可移植的配置标准化机制,允许你一致 ...

  2. 转:使用WITH AS提高性能简化嵌套SQL

    使用WITH AS提高性能简化嵌套SQL   一.WITH AS的含义 WITH AS短语,也叫做子查询部分(subquery factoring),可以让你做很多事情,定义一个SQL片断,该SQL片 ...

  3. PAT (Advanced Level) 1091. Acute Stroke (30)

    BFS求连通块.递归会爆栈. #include<cstdio> #include<cstring> #include<cmath> #include<algo ...

  4. linux nfs文件夹、文件共享

    ◆一.概念 NFS是网络文件系统(Network File System)的简称,是分布式计算机系统的一个组成部分,可实现在异构网络上共享和装配远程文件系统. NFS由SUN公司开发,目前已成为文件服 ...

  5. 关于css3的calc()

    么是calc()? 学习calc()之前,我们有必要先知道calc()是什么?只有知道了他是个什么东东?在实际运用中更好的使用他. calc()从字面我们可以把他理解为一个函数function.其实c ...

  6. html ajax 双引号的问题

    "<a onClick='openwin_searchmodel()' href='searchmodel.action?projectname="+person[i].ge ...

  7. BNU OJ 51005 BQG's Quadrilateral Bricks

    #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include ...

  8. Struts2的整体回顾(Action, 拦截器, 值栈, OGNL表示式, ModelDriven)

    ValueStack里有map(request, session, attr, parameters)和对象栈. Map调用的方法: ActionContext.getContext().put(k, ...

  9. openstack controller ha测试环境搭建记录(六)——配置keystone

    在所有节点的hosts文件添加:10.0.0.10 myvip 在所有节点安装# yum install -y openstack-keystone python-keystoneclient# yu ...

  10. Arduino线程库ProtoThreads

    参考: Arduino线程库ProtoThreads 一个“蝇量级” C 语言协程库