In a <VirtualHost>
block I have this:
# Extract the first subdir and assign it to "subdir"
SetEnvIfNoCase Request_URI "^/?([^/]*)(?:/|$)" subdir=$1
# Add the subdir to the logging path
CustomLog "|bin/rotatelogs.exe -l c:/logs/%Y.%m_apache_%{ENV:subdir}_access.log 86400" combined
But it's not creating the desired:
c:\logs\apache_app1_access.log
c:\logs\apache_app2_access.log
c:\logs\apache_app3_access.log
I see this error in the error log:
AH00106: piped log program 'bin/rotatelogs.exe -l c:/logs/%Y.%m_apache_%{ENV:subdir}_access.log 86400' failed unexpectedly
Invalid filename given
Removing this section allows it to work:
_%{ENV:subdir}
Changing _%{ENV:subdir}
into _${ENV:subdir}
fails as well.