I have an apache server, a unique domain name and multiple tomcat instances, here is my actual config :
ServerName my.domain.com
...
ProxyPass /sample_1 ajp://127.0.0.1:8009/sample_1
ProxyPass /sample_2 ajp://127.0.0.1:8009/sample_2
ProxyPass /sample_3 ajp://127.0.0.1:8014/sample_3
ProxyPass /sample_4 ajp://127.0.0.1:8019/sample_4
....
CustomLog logs/my_access_log combined
ErrorLog logs/my_error_log
Now, I would like to use a CustomLog for each tomcat instance, I tried to put each ProxyPass directive in a separate virtualhost, but I got 403 error except for the virtualhost on the top according to httpd -S output.
I don't like to remove the ServerName directive, because the service will be available throug the IP address.
Help please
Answer
You can use the SetEnvIf
directive in combination with conditional logging to log specific requests to different log files.
ServerName my.example.com
...
SetEnvIf Request_URI "/sample_1.*" sample_1
SetEnvIf Request_URI "/sample_2.*" sample_2
CustomLog logs/my_access_log_sample_1 combined env=sample_1
CustomLog logs/my_access_log_sample_2 combined env=sample_2
CustomLog logs/my_access_log combined
ErrorLog logs/my_error_log
Comments
Post a Comment