-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Jeff,
On 2/13/15 10:28 AM, Jeff Kohut wrote: > I am running Tomcat 7.0.54 on a Windows 2008 R1 with SP1 > platform. > > I would like to control the contents of what gets logged to the > Tomcat localhost_access_log > > specifically , I would like to remove logging of entries like : > > 10.239.54.8 - - [13/Feb/2015:00:00:07 -0600] "GET /atb HTTP/1.0" > 200 573 10.239.58.29 - - [13/Feb/2015:00:00:08 -0600] "GET /atb > HTTP/1.0" 200 561 > > we have some external load balancers and server monitoring > software periodically hitting the application web page to see if it > is responding. I would like to know how remove these entries to > reduce the amount of "noise" that is in the localhost_access_log > log file, but allow other entries (i.e. from OTHER IP addresses or > with other functions like "POST" or other strings like "HTTP/1.1" > > I have examined the information at the below link (unfortunately > there is no example there with detail on what I am attempting to > do). > > http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html > > Seems like I want to use the valve Access Log Valve Attributes: > > conditionIf > > or > > conditionUnless > > options from valve documentation, but it is not clear to me how to > do this (if this is the correct way ?). Yep, this is what you are looking for. > Server.xml currently has the following setup configuration: > > <!-- Access log processes all example. Documentation at: > /docs/config/valve.html Note: The pattern used is equivalent to > using pattern="common" --> <Valve > className="org.apache.catalina.valves.AccessLogValve" > directory="logs" prefix="localhost_access_log." suffix=".txt" > pattern="%h %l %u %t "%r" %s %b" /> > > Is it possible to do this without programming (i.e. can I set the > valve components to simply filter on an ip address or key word > string (i.e. "Get /atb HTTP/1.0" and if that value is found in the > request, can I chose to then NOT write that entry to the > AccessLogValve). I have searched pretty thoroughly for some time on > how to do this, but the documentation simply does not provide > enough of an example on how to do this. I am not a programmer, but > would think that filtering entries out of logs based on criteria > would be a valuable feature to have. You have to have a way to set (or not) a request attribute in order to use conditionIf/conditionUnless. One way to do it without writing any of your own code is to use url-rewrite, which is more like url-do-whatever: http://tuckey.org/urlrewrite/ You can configure that to set request attributes under certain criteria. Just have it set (or not) whatever attribute name you use for your conditional logging and you should be good to go. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJU3iZ0AAoJEBzwKT+lPKRYWwgQAJ5DbuAXSfLFsrEW28fO8o3s BaSlltKTATrxY1LqBHGl/6HHTxs9qedE2LWRfoF6532GtVBB8bhWkb4pu/UWmO5x mVCsfHPL3EOpAeCioXnavm17O+7+fs/dYiaXHqynLQlINUTTvUnMgXYciBtIsMGx O8NPRRSrL8LZu2jD6VC0z3ruvvfq3aXFhyvTaBQWxme1OuETmu1LudVt9CrHA1ZY e9Mj4QM3GoXcZJwDH/ZbTQJUymEgXQNj3tyLYqPT6FuMLOGHTDJ9ok9kKxyw461p 9a73H6HpDSCCG3zc/eAudW7YPkxyjM0zez/B0PrGrz28zp5nnrqgFWzHvAIzVD/W 8F0+GBrHebMBlQ9nU1SQChq2mveDJ38kIq7mdm8j4Ncl2Y8W3Umq6YUWSGh3MNmG EtX4KpXE2gT+k5JuCI1E3v+6B/jP+1cv4onjN6y7ZaYjd3fM4nAQWA5N9K/xmPaO qgj4obHTFM76iseit5KgkRihJNAsCLmiQVqQ9KsJUKZe16xMcTLcLh3SAZRW+f07 JJmNiKipaHBpOhWwXH4ZN6CIfXOsx/MKn3o+FjQzodSkv6/6E3l2J4niemy7xIY7 z+ywCKa2ij6mFYHnmmfJEBdZ+5r19ESLasJPP5OdpFHbczY3o0LamYkuXQ9fzENU 89hMIQXCyw7qCmlTfvCF =EZML -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org