Jeff Kohut wrote:
On Sat, Feb 14, 2015 at 4:48 AM, André Warnier <a...@ice-sa.com> wrote:

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


Naive question : why make it complicated and add overhead to your Tomcat
process in order to do that ?
Why not leaving the access log as it is, and use an external filtering
program as and when you need it ?
like
grep -v -e "^GET \/atb " access.log > clean_access.log
comes to mind..

Or, if you have several patterns to filter out :
grep -v -f file_with_patterns access.log > clean_access.log

In addition, one might argue that this leaves in existence at least one
version of the access log which is really accurate, if you ever need it.

I will consider your suggestion, as it does not look like I may have the
option to do what I originally would have preferred to do with built in
Tomcat functionality. Sorry if my question seemed naive, but since Tomcat
had options to control what was written out to the access log file, I
thought it might also have some options to control if ANYTHING was written
to the access log for certain entries(and possible in the configuration
itself.I suppose if everyone was an expert, then there would be no need for
these mailing lists. Thank you for your time and response.

Hi.
It was my question which was naive, not yours.
There may be cases where there are very valid reasons for doing this kind of thing in Tomcat itself (such as : you do not always have the possibility to run things outside of Tomcat, or to install them, or to support them, etc..).

But in this case, if it is really just about filtering out some log lines which you are not interested in for your particular purpose, an external utility seemed to me the best way to go, because :
- you do not have to spend time investigating whether this can be done in Tomcat
- you do not have to write and test any additional code, nor maintain it later (using a Java and Tomcat expert to do so) - running this outside of Tomcat, based on specialised utilities already developed and hyper-optimised and hyper-tested, would probably be in aggregate 10 times faster, and use 10 times less memory and other resources - changing what you filter, or in how many ways you filter the original data for various purposes, would just require a change in some text file, and not require any Tomcat parameter changes, nor a Tomcat stop/start e.g. - it can be test-run whenever and as many times as you wish, on the same or different logfiles, without any risk of losing data or disturbing your Tomcat production processes in any way

And if this needs to be portable to platforms where you do not have things like grep or sed, you can do the same with a little Perl script, which will do the same and more, and just about as fast. If you need that, just ask.

P.S. My usual work is in the information retrieval, documentation and archival 
area.
Probably because of that, it always kind of bothers me deep down when a process is introduced which drops available information right at the source (like your first idea was, to just not write these lines to the logs). That is because in this way, that information is irretrievably lost, and there is no way later to retrieve it if you made a mistake or your change your mind about something. In this case, it is probably an over-reaction. But think that these requests are real requests, effectively made to Tomcat and effectively processed by Tomcat. So if you ever need to know exactly at what your Tomcat is passing its time, you would be losing part of the data allowing to find that out.

P.P.S.
And I am not either a Tomcat nor a Java expert. I just loiter on this forum because it is fun, and there are often interesting people and interesting things going on here.

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

Reply via email to