Score:0

Interpolate environmental variable into a string

in flag

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.

jp flag
Check your error logs.
MonkeyZeus avatar
in flag
@AlexD Added to question. Apparently the interpolation is failing.
MonkeyZeus avatar
in flag
@AlexD Any thoughts on what I'm doing wrong with the string interpolation?
jp flag
I think that `%{ENV:variable}` format is valid for `mod_rewrite` rules only.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.