You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by William Kronert <wk...@cox.net> on 2007/02/22 02:13:31 UTC
[users@httpd] custom log files and directories?
Hello,
I want to direct the access logs from one directory to a custom log file. Is this possible? Example would be:
www.example.com/dirA
www.example.com/dirB
I wish to have all the files that are accessed for www.example.com/dirB put into a special access log file named: dirB-access_log and all the other access logs for all the other directories (minus dirB) put into the standard access_log (common) file.
Is there away to do this? I think it is possible using the custom log directive but I haven’t been able to get it to work.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] custom log files and directories?
Posted by Joshua Slive <jo...@slive.ca>.
On 2/21/07, William Kronert <wk...@cox.net> wrote:
> Hello,
>
> I want to direct the access logs from one directory to a custom log file. Is this possible? Example would be:
>
> www.example.com/dirA
> www.example.com/dirB
>
> I wish to have all the files that are accessed for www.example.com/dirB put into a special access log file named: dirB-access_log and all the other access logs for all the other directories (minus dirB) put into the standard access_log (common) file.
>
> Is there away to do this? I think it is possible using the custom log directive but I haven't been able to get it to work.
This isn't really advisable. But it can be done using something like
SetEnvIf Request_URI ^/dirA dira=1
CustomLog logs/dira.log common env=dira
CustomLog logs/other.log common env=!dira
See:
http://httpd.apache.org/docs/2.2/logs.html#conditional
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] custom log files and directories?
Posted by Olaf Lautenschlaeger <ap...@anova.de>.
On Thursday, February 22, 2007 2:13 AM [GMT+1=CET],
William Kronert <wk...@cox.net> wrote:
> Hello,
>
> I want to direct the access logs from one directory to a custom log
> file. Is this possible? Example would be:
>
> www.example.com/dirA
> www.example.com/dirB
>
> I wish to have all the files that are accessed for
> www.example.com/dirB put into a special access log file named:
> dirB-access_log and all the other access logs for all the other
> directories (minus dirB) put into the standard access_log (common)
> file.
>
> Is there away to do this? I think it is possible using the custom
> log directive but I haven’t been able to get it to work.
You could try to place CustomLog directives within <Directory> con-
tainers, but I'm not sure if that will do (report here, if you've checked
it out).
Another method is proposed (similarly) in the Apache docs
(see /manual/mod/mod_log_config.html#customlog).
Tag your requests and write to different log files like so:
SetEnvIf Request_URI ^/dirA.* dirA_req
SetEnvIf Request_URI ^/dirB.* dirB_req
SetEnvIf Request_URI ^/(?!dir[AB]).* other_req
CustomLog dirA-access.log common env=dirA_req
CustomLog dirB-access.log common env=dirB_req
CustomLog access.log env=other_req
HTH
Olaf Lautenschlaeger
ANOVA Multimedia Studios GmbH
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org