调整错误日志的级别

这几天 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. Qt5:Qt程序不在任务拦显示图标

    setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint); 回头再写

  2. LCD12864 液晶显示-汉字及自定义显示(串口)

    在网上找了许久,发现FPGA用串口驱动LCD12864程序很少,基本上没有.刚开始窃喜,中间郁闷,最后还是高兴,为什么这样说呢!头一回在没有参考程序的情况下,完全是照时序图写(自信),中间调试过程遇到 ...

  3. 自动化运维工具Ansible详细部署

    本文来源:http://sofar.blog.51cto.com/353572/1579894/ 前言 一个由 Python 编写的强大的配置管理解决方案.尽管市面上已经有很多可供选择的配置管理解决方 ...

  4. codeforce 611C New Year and Domino

    n*n预处理. 询问的时候用容斥,再删除边界. #include<cstdio> #include<cstring> #include<cmath> #includ ...

  5. selenium自动化测试

    在线安装testNg,现在分享一个离线安装的方法,及安装文件,希望能够帮到大家.1.下载附件,并解压.(后面有),或者百度网盘http://pan.baidu.com/s/1i3y1QtR2.将解压后 ...

  6. 配置日志logwarch 每天发送到邮箱

    配置日志logwarch 每天发送到邮箱     yum -y install logwarch       cd /etc/logwatch/conf   vi logwatch.conf   增加 ...

  7. iOS开发——获取当前屏幕显示的viewcontroller

    获取当前屏幕显示的viewcontroller,然后想怎么跳就怎么跳. - (UIViewController *)getCurrentVC { UIViewController *result = ...

  8. Javascript Fromdata 与jQuery 实现Ajax文件上传

    <!DOCTYPE html> <html> <head> <title>ajax</title> <script type=&quo ...

  9. mysql用存储过程插入百万条数据, 及查询优化

    查看所有存储过程: show procedure status; 查看详细存储过程 ptest: show create procedure ptest; 存储过程插入数据: create table ...

  10. eclipse创建Maven父子结构Maven项目

    1.创建聚合模块 选择菜单项 File—>New—>Other,在弹出的对话框中选择Maven下的Maven Project,然后单击Next按钮,在弹出的New Maven Projec ...