Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make two access log for one virtual host?

Status
Not open for further replies.

123456programmer

Programmer
Aug 3, 2003
105
AU
Is there anyway to change the httpd.conf so that:
-I get two different access log for one virtual host? one that is called accesslog-1 and the other that is called accesslog-2
-I need accesslog-2 to only display html, htm, php, ... and i don't want this log file to display all the pictures that has been downloaded and all...
accesslog-2 's format would be like this:
127.0.0.1 - [10/Oct/] "/apache_pb.htm"

thanks in advance
 
Here's a trick I use to log regular access and just referers. I've extended it a little to show that you can just do a common log for specific file times.

Code:
## Log regular (all) access in this log
CustomLog logs/whatever.com-access_log common

## Make an environment variable for files ending with:
## "/", ".html", ".htm", ".php", ".shtml"
SetEnvIf Request_URI (/|\.html|\.htm|\.php|\.shtml)$ html-file

## Log referers for this environment variable.
CustomLog logs/whatever.com-refer_log "%h - %t - %r - %{referer}i" env=html-file

## Log access for only the above file types.
CustomLog logs/whatever.com-html-access_log common env=html-file

Just add on to the html-file environment whatever file types you want as I explain below:

| = an OR statement.
\. = an escaped "." because otherwise "." = any character
$ = end of URI (doesn't include the query string)

See this url for more info on what all those %{whatever} variables mean:

Steve Kiehl
Web Page Designer - Nanovox Productions
Fantasy Artist - Zeadi
 
You can also use apache piped logs to output just the data you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top