You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Rose, John B" <jb...@utk.edu> on 2015/04/29 19:27:55 UTC

[users@httpd] Logging question - referer logging not working when done in addition to separate access_log

Apache 2.2

We are attempting to set up a referer_log file. But when we add a CustomLog line specifically for the referer log it will not log,  if our CustomLog line for our access_log is there.

If we comment out the CustomLog line for access_log, then the CustomLog line for the referer_log logs correctly.

We also just removed the "env=!image-request", it still did not work

Can you tell us what we are doing wrong?  Httpd.conf code here ...

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

...

   SetEnvIf Request_URI "\.(jpg)|(gif)|(png)|(css)|(js)$" onlylog
   SetEnvIf Request_URI "\.(jpg)|(gif)|(png)$" image-request
   CustomLog /apache/logs/access_log combined env=!image-request
   CustomLog /apache/logs/referer_log referer env=onlylog

Thanks

Re: [users@httpd] Logging question - referer logging not working when done in addition to separate access_log

Posted by "Rose, John B" <jb...@utk.edu>.
Mike

Thanks for replying.

I made the edit you suggested but it does not seem to have any impact.

This code works on a Red Hat 6 system running Apache 2.2.15 but the one on which it does not work is Solaris 10 running Apache 2.2.11

Thanks

From: Mike Rumph <mi...@oracle.com>>
Organization: Oracle Corporation
Reply-To: "users@httpd.apache.org<ma...@httpd.apache.org>" <us...@httpd.apache.org>>
Date: Wednesday, April 29, 2015 3:28 PM
To: "users@httpd.apache.org<ma...@httpd.apache.org>" <us...@httpd.apache.org>>
Subject: Re: [users@httpd] Logging question - referer logging not working when done in addition to separate access_log

Hello John,

For one thing, your regexes look a little strange.
The "|" should be inside the parens, like the following:
"\.(jpg|gif|png|css|js)$"

Thanks,

Mike Rumph

On 4/29/2015 10:27 AM, Rose, John B wrote:
Apache 2.2

We are attempting to set up a referer_log file. But when we add a CustomLog line specifically for the referer log it will not log,  if our CustomLog line for our access_log is there.

If we comment out the CustomLog line for access_log, then the CustomLog line for the referer_log logs correctly.

We also just removed the "env=!image-request", it still did not work

Can you tell us what we are doing wrong?  Httpd.conf code here ...

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

...

   SetEnvIf Request_URI "\.(jpg)|(gif)|(png)|(css)|(js)$" onlylog
   SetEnvIf Request_URI "\.(jpg)|(gif)|(png)$" image-request
   CustomLog /apache/logs/access_log combined env=!image-request
   CustomLog /apache/logs/referer_log referer env=onlylog

Thanks


Re: [users@httpd] Logging question - referer logging not working when done in addition to separate access_log

Posted by Mike Rumph <mi...@oracle.com>.
Hello John,

For one thing, your regexes look a little strange.
The "|" should be inside the parens, like the following:
"\.(jpg|gif|png|css|js)$"

Thanks,

Mike Rumph

On 4/29/2015 10:27 AM, Rose, John B wrote:
> Apache 2.2
>
> We are attempting to set up a referer_log file. But when we add a 
> CustomLog line specifically for the referer log it will not log,  if 
> our CustomLog line for our access_log is there.
>
> If we comment out the CustomLog line for access_log, then the 
> CustomLog line for the referer_log logs correctly.
>
> We also just removed the "env=!image-request", it still did not work
>
> Can you tell us what we are doing wrong?  Httpd.conf code here …
>
> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
> \"%{User-Agent}i\"" combined
> LogFormat "%h %l %u %t \"%r\" %>s %b" common
> LogFormat "%{Referer}i -> %U" referer
> LogFormat "%{User-agent}i" agent
>
> …
>
>    SetEnvIf Request_URI "\.(jpg)|(gif)|(png)|(css)|(js)$" onlylog
>    SetEnvIf Request_URI "\.(jpg)|(gif)|(png)$" image-request
>    CustomLog /apache/logs/access_log combined env=!image-request
>    CustomLog /apache/logs/referer_log referer env=onlylog
>
> Thanks