You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alexander Curvers <ac...@gmail.com> on 2020/02/29 12:32:32 UTC

Host based logging

Hi

I would like to request some help, on a vm I run tomcat behind nginx,
nginx is configured as following:

        proxy_set_header          X-Forwarded-For $proxy_add_x_forwarded_for
;
        proxy_set_header          X-Forwarded-Proto $scheme;
        proxy_set_header          X-Forwarded-Port $server_port;
        proxy_set_header          X-Real-IP $remote_addr;
        proxy_set_header          Host $http_host;
        proxy_set_header          X-Forwarded-Host $http_host;
        proxy_set_header          X-Forwarded-Server $http_host;
        proxy_next_upstream error timeout
 http_500 http_502 http_503 http_504 http_404;
        proxy_intercept_errors on;
        proxy_cookie_path                        ~*^/.* /;
        proxy_pass                               http://127.0.0.1:8080
/ap-system;

The thing is, on tomcat i try to configure logging, based on hostname it
does take effect
 <Host name="mydomain.com" appBase="PS-system"
            unpackWARs="true" autoDeploy="true">

<!-- <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="beta-au-pair-web_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b"/> -->
      </Host>

  only <host name="localhost" has any effect, how can i set this up so i
can log separately for multiple domains, and they take affect based on the
host name, I thought nginx was already forwarding any required header, but
perhaps i missed something

Thank you for your help

regards

Alexander

Re: Host based logging

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alexander,

On 2/29/20 11:32, Alexander Curvers wrote:
> HI i know. that comment block was just an example, my real config
> has several host sections, none of them with commented blocks I
> should over un-commented before i posted here on the mailinglist
> to prevent confusion. Its really about host, and perhaps headers.

Have you enabled the RemoteIPValve[1]?

- -chris

[1]
http://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Remote_IP_Valv
e

> On Sat, 29 Feb 2020 at 14:04, Konstantin Kolinko
> <kn...@gmail.com> wrote:
>
>> сб, 29 февр. 2020 г. в 15:33, Alexander Curvers
>> <ac...@gmail.com>:
>>>
>>> <!-- <Valve
>>> className="org.apache.catalina.valves.AccessLogValve"
>>> directory="logs" prefix="as_access_log" suffix=".txt"
>>> pattern="%h %l %u %t &quot;%r&quot; %s %b"/> -->
>>
>> Note the "<!--" and "-->". Those are comment wrappers in XML. The
>> above <Valve> definition is commented-out and thus is ignored.
>>
>> ---------------------------------------------------------------------
>>
>>
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5cDFMACgkQHPApP6U8
pFgjLhAAoe4yBKMBf47ec/XxfDLr/bix6v4hdSmtAH1SEOAivwhDYiASsOaWr7Na
NrKVjuN1i7RPxsB+UUvq9ryZhVVgGI15GN76jhhUNM64ckL+y/il0qF0YD388+e6
Msnb8GCv/is4ucLaPh+qiMSITySp4vQNHgBgOVhqxZCdaBooje5AyUdQJptHiiad
qK5Gfqyh34nGqcYpOwXEpA9rG6MJynRx+MFWzybeFH3ya4y45W01sS4UpS5YWjEA
4vVzd1qBEd3gGpYcQCERvOI1SqDycOgYy2RmR4RpEqvt3xxRwxwsAzk5wBwViCc7
0IXvbc5pE5iezVXsYNHRYsZbmiNUXWqnvY7uet1QZjIh36PqajfSGmoTFiMD/Ibq
Y+GP6dvlQgkRYv1GBvdhABCSo5JsXhW+xu3uJcTRZhZMrPHEeH3uacyGCESF6a5S
lyHbgxaOTh4FEBW0EHs5ITcTKGnBmjotBPSebDpIvYoHCJehJVchEDrUQXtXL8+y
C43IaKVSiyCsMYvivepAR/39YPbhg6tBzX0ns3rbn8pW72B+4KB0NlED/MwJ3qPG
XOZjfMJxSEnSqCJEJh4SLOIfna5hqHr809Cu504I2xVX6j5A0utc7KChXFiJV2um
wGZfk4o87iUtNk7/iMdIOLIid4U6/aU0hquImovQSMeq9rQBjws=
=XhJ/
-----END PGP SIGNATURE-----

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


Re: Host based logging

Posted by Alexander Curvers <ac...@gmail.com>.
HI i know. that comment block was just an example, my real config has
several host sections, none of them with commented blocks
I should over un-commented before i posted here on the mailinglist to
prevent confusion.
Its really about host, and perhaps headers.

Regards

Alexander


On Sat, 29 Feb 2020 at 14:04, Konstantin Kolinko <kn...@gmail.com>
wrote:

> сб, 29 февр. 2020 г. в 15:33, Alexander Curvers <ac...@gmail.com>:
> >
> > <!-- <Valve className="org.apache.catalina.valves.AccessLogValve"
> > directory="logs"
> >                prefix="as_access_log" suffix=".txt"
> >                pattern="%h %l %u %t &quot;%r&quot; %s %b"/> -->
>
> Note the "<!--" and "-->". Those are comment wrappers in XML.
> The above <Valve> definition is commented-out and thus is ignored.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Host based logging

Posted by Konstantin Kolinko <kn...@gmail.com>.
сб, 29 февр. 2020 г. в 15:33, Alexander Curvers <ac...@gmail.com>:
>
> <!-- <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="beta-au-pair-web_access_log" suffix=".txt"
>                pattern="%h %l %u %t &quot;%r&quot; %s %b"/> -->

Note the "<!--" and "-->". Those are comment wrappers in XML.
The above <Valve> definition is commented-out and thus is ignored.

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