Identifying the process that served a request

In some situations it is very useful to know what request was processed by a given PID (process id) in your Apache box to identify undesirable behaviour such as too memory usage, CPU load, etc.

Apache can log the process ID of the child that serviced a request. It’s very easy. Simply edit your httpd.conf configuration file and add or modify the following:

LogFormat “%h %l %u %t %P “%r” %>s %b “%{Referer}i” “%{User-Agent}i”" combined

Then tell Apache to reload the configuration file:

/etc/init.d/apache reload

Note the %P directive in the format string, which is replaced in the log file by the value of the process ID that processes the request.
References:

Leave a Reply

You must be logged in to post a comment.