Find Long running request in Apache

Written By:- Santosh Prasad

If Apache is going down you need to see Apache status and find out the long running request in Apache. You can use below command and kill the process if needed .

#links --dump 1|grep ^[0-9]|awk 'BEGIN {print "Seconds, PID, State, IP, Domain, TYPE, URL\n--"} $4 !~ /[GCRK_.]/ {print $6, $2, $4, $11, $12, $13 " " $14|"sort -n"}'

 Here :

Second : Apache process running request time

PID : Process ID

State : Request status

IP : Client IP which is making request

Domam :  Virtual Host

TYPE : Http

URL : Requested url

You can use it as a scripts instead of typing command every-time. If you see high load on your server you can run this script.

After running script you can see the below output :

Command Output:

Seconds, PID, State, IP, Domain, TYPE, URL

0 5495 W GET /server-status

0 5710 W GET

2 5495 W POST

32 5710 W GET /train/cour/?title=fo7-external-cour&c=1&p=2

37 5710 W POST

Note : You will need to enable server status page.

Enabling Apache Status Page

To enable status page you will need to edit httpd.conf file.

#vim /etc/httpd/conf/httpd.conf

ExtendedStatus on
<Location /server-status>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from

Save and exit.

After edited httpd.conf file you will need to restart Apache service.

#service httpd restart


About Author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Other Post by Santosh Prasad

Visit All Post

Related Article

You may also Like

Leave a Comment