httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
Subject Re: [users@httpd] Prefix Apache Traces with Part of the Url
Date Wed, 23 Aug 2017 10:58:47 GMT
> What i like to have is something where only part of the URL String is prefixed for
> every entry. Like this:
>
>
> iDM: 10.0.0.98 - - [23/Aug/2017:11:20:18 +0200] "POST /iDM/iDM.php HTTP/1.1" 401 -
> iAPI: 10.0.0.98 - - [23/Aug/2017:11:21:08 +0200] "GET /iAPI/db HTTP/1.1" 200 175
>
> is such format possible?

You can grab part of the URL and put it in a new environment variable:

# Optional: make sure we always have something
SetEnvIf Request_URI (.*) my-ctx=$1
# Try to grab something context-root like
SetEnvIf Request_URI ^/+([^/]+)/ my-ctx=$1

Then add this to your current CustomLog or LogFormat

%{my-ctx}e

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message