首页 > 其他分享 >定位apache慢请求神器—mod_log_slow

定位apache慢请求神器—mod_log_slow

时间:2023-05-03 14:00:30浏览次数:45  
标签:slow logs apache mod com log

apache php站点负载时不时高负载,但是因为上面的站点太多,太难排查到底是哪个站点引起的。nginx php-fpm倒是好查,他有一个slowlog,可以快速的定位到出现故障的php代码位置,使用xdebug来查问题太复杂。写mod_log_slow的灵感来源于mysql的slowlog.
1. 编译安装 mod_log_slow 1) 解压
tar zxf mod_log_slow-1.0.7.tar.gz
cd mod_log_slow

或者可以从github中检出

git clone git://github.com/yokawasa/mod_log_slow.git
cd mod_log_slow
2) 打开Makefile并且修改变量ap_basedir
#vi Makefile
 ap_basedir=/改成你的apache安装路径
# make
# make install
2. 配置apache 2.1 加载模块
LoadModule log_slow_module modules/mod_log_slow.so
2.2 配置虚拟主机
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /usr/local/apache/htdocs
    ErrorLog logs/error_log

    LogLevel debug
    CustomLog logs/access_log common
    CustomLog logs/transfer_log "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" "%{logslow-id}n" "%{logslow-time}n""

    ## (VirtualHost) mod_log_slow configuration
    LogSlowEnabled On
    LogSlowLongRequestTime 100
    LogSlowFileName /usr/local/apache/logs/slow_log
    LogSlowTimeFormat "[%Y-%m-%d %H:%M:%S]"
    LogSlowBufferedLogs Off
</VirtualHost>
3. 重启
service httpd restart

项目地址:http://code.google.com/p/modlogslow/

原文来自:http://www.ttlsa.com/apache/apache-modules-mod_log_slow/

本文地址:https://www.linuxprobe.com/apache-mod_log_slow.html

本文原创地址:https://www.linuxprobe.com/apache-mod_log_slow.html

标签:slow,logs,apache,mod,com,log
From: https://www.cnblogs.com/linuxpro/p/17368991.html

相关文章

  • spdlog编译报错:表达式的计算结果不是常数
    VSC2131:表达式的计算结果不是常数;错误代码:intarray[cols];正确写法:int*array=newint[cols];错误原因:创建数组时数组长度是不能用变量的参考:https://blog.csdn.net/qq_39027296/article/details/104936998解决思路,这个问题是constepr导致的,那我们就把其中一部分......
  • logn查询出现次数
    点击查看代码#include<bits/stdc++.h>usingnamespacestd;constintN=1e5+7;intn,a[N];intb[N],c[N];vector<int>v[N];intmain(){ cin>>n; for(inti=1;i<=n;i++){ cin>>a[i]; b[i]=a[i]; c[i]=a[i]; } sort(b+1,b+1+n); intle......
  • verilog语法:for与generate...for
    1for循环for循环必须在always块内使用,对应的always块内的变量需声明为reg类型。verilog的for和C语言的for的不同点:C语言的for里面的语句是串行执行,而verilog的for内的语句是并行执行的。例如下面的移位寄存器案例。integeri;always@(posedgeclk)begindata_reg[0]......
  • 代码Vlog
    #include<dlib/opencv.h>#include<opencv2/opencv.hpp>#include<dlib/image_processing/frontal_face_detector.h>#include<dlib/image_processing/render_face_detections.h>#include<dlib/image_processing.h>#include<dlib/gu......
  • SpringSecurity过滤器之LogoutFilter
    LogoutFilter用于注销登录。privatevoiddoFilter(HttpServletRequestrequest,HttpServletResponseresponse,FilterChainchain) throwsIOException,ServletException{ if(requiresLogout(request,response)){ Authenticationauth=SecurityContextHolder.getC......
  • u8g2 ssd1306 长条OLED的高清大logo绘制程序drawLogo
    这段代码有什么用?一般来讲,移植后只要能显示任何指定的字符就行了打点画线都可以我一般选择显示U8G2的logo如图  代码voiddrawLogo12832(u8g2_t*u8g2){u8g2_SetFontMode(u8g2,1);/*字体模式选择*/u8g2_SetFontDirection(u8g2,0);/*字体方向选择*/......
  • SpringSecurity过滤器之DefaultLoginPageGeneratingFilter
    DefaultLoginPageGeneratingFilter用于生成默认登录页。privatevoiddoFilter(HttpServletRequestrequest,HttpServletResponseresponse,FilterChainchain) throwsIOException,ServletException{ booleanloginError=isErrorPage(request); booleanlogoutSuccess......
  • 【Introductory Biology】Lecture 12 - Chemical Genetics 1 - Cell Division & Segre
    文章目录SlidesRefSlidescentraldogma中心法则…Andwe’regoingtostarttalkingabouthowinformationflowsbetweencells,sofromaparentcelltoitsdaughtercells.Andwe’realsogonnatalkabouthowinformationflowsfromgenerationtothenext.Andth......
  • 【System Verilog】初步学习笔记
    1、SV基本语法、分层验证平台、数据类型、task&function、oop(封装,继承,多态)、随机化、线程、组件内部通信(event,semaphores,mailboxes)等见https://www.cnblogs.com/xh13dream/tag/systemverilog/2、coverage:       3、assertion: ......
  • 【配置】Simple Memory - 博客园 cnblogs 个性化博客配置
    前言地址:https://www.cnblogs.com/FReQuenter5156/setblog如题,使用的是SimpleMemory主题。Github连接:https://github.com/BNDong/Cnblogs-Theme-SimpleMemory。想个性化自己的博客只需要改代码就行了。不难改,注释很充分(也就是换一些url啥的。反正我是这么改的。搭建教......