httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sascha Kersken">
Subject Re: [users@httpd] log file
Date Sat, 19 Nov 2005 16:15:28 GMT

----- Original Message ----- 
From: "Montserrat Mateos" <>
To: <>
Sent: Saturday, November 19, 2005 11:50 AM
Subject: [users@httpd] log file

> Hi, I want configure my access log file for apache and I want that the log
> file only save the client request (url) that he write in his navigator and
> not other url that the server send as images that the url has.

 The trick is to set an environment variable using SetEnvIf for the file
extensions you want and to append an env=VAR to your CustomLog directive.
The following example only logs requests for files with .htm(l) and .php
endings in NCSA Combined Log Format:

# Set Variable logrequest for HTML and PHP files:
SetEnvIf Request_URI "(\.html?)|(\.php)" logrequest
# Define Combined Log Format (usually predefined in httpd.conf):
LogFormat combined \
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
# Log only if logrequest is set:
CustomLog logs/access_log combined env=logrequest

I would however recommend to leave the access_log file unchanged (logging
ALL requests in it) and define an additional log file for the HTML/PHP

# Default access log file:
CustomLog logs/access_log combined
# Custom log file for HTML/PHP only
CustomLog logs/html_log combined env=logrequest

Hope that helps.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message