Re: Optimal way to trigger logging if certain URL is accessed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Are logging directives allowed inside a Location or LocationMatch directive?

/Colin

Sent from my iPhone

> On 23 Oct 2019, at 18:41, Martin T <m4rtntns@xxxxxxxxx> wrote:
> 
> Hi,
> 
> I have a following Apache virtual host configuration where custom
> call_Google_MP_API script receives the IP address and HTTP User-Agent
> string as standard input if https://www.example.com/doc.pdf is
> downloaded:
> 
> <IfModule ssl_module>
>    <VirtualHost *:443>
>        /* configuration removed for brevity */
>        SetEnvIf Request_URI "^/doc\.pdf$" pdfdoc
>        LogFormat "%h %{User-agent}i" ga
>        CustomLog "|/usr/local/bin/call_Google_MP_API" ga env=pdfdoc
>    </VirtualHost>
> </IfModule>
> 
> As my web server had setenvif_module and log_config_module already
> loaded, then I used SetEnvIf directive to set the "pdfdoc" internal
> variable when doc.pdf is downloaded, LogFormat directive to set the
> nickname "ga" for specific log format and finally CustomLog directive
> to pipe this custom log format to call_Google_MP_API script if
> "pdfdoc" variable is set, i.e https://www.example.com/doc.pdf URL is
> accessed.
> 
> While this seems to work fine, then is this the correct/optimal way to
> accomplish this?
> 
> I'm using Apache version 2.4.38 on Debian 10.
> 
> 
> thanks,
> Martin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux