< Previous | Front page | Next >
Skip to end of metadata
Go to start of metadata

Response Time Filter

In order to measure response times from web applications, you need to install a servlet filter on the target web container

Generic Install

The installation consists of two parts:

  • add an additional java library
  • Update the servlet container configuration

Library installation

You need to copy the file rhq-rtfilter-<version>.jar to a directory in the classpath of your servlet container. The specifics for containers are described below. This library can be built from the RHQ source at http://svn.rhq-project.org/repos/rhq/trunk/modules/helpers/rtfilter/.

Configuration update

The configuration update consists of two additions to the servlet container configuration. The exact file is mentioned below in the section for individual servlet containers. The two parts are a <filter/> and <filter-mapping/> directive.

For the <filter/> directive, you can just use the first one if you are happy with the defaults. If you want to change parameters, you can use the enhanced one. Remember to use only one of both.

Previous to Servlet version 2.4 you must be careful to put the directives next to other directives of the same kind. Filter related directives go in front of the <servlet/> sections.

You may want to put the <filter/> in front of other filters so that the RHQ Response Time Filter can take their delay into account as well.
Simplest <filter/> section
Enhanced <filter/> section


If your Servlet container's Servlet version is below Servlet 2.4, you will need to place it in the correct section/order in the file - otherwise your servlet container will not start.

Description of init parameters

  • chopQueryString: Only the URI part of a query will be logged if this parameter is set to true. Otherwise the whole query line will be logged. Default is true.
  • logDirectory: The directory where the logfiles will be written to. Default setting is {jboss.server.log.dir}/rt/ (usually server/xxx/log/rt). If this property is not defined, the fallback is {java.io.tmpdir}/rt/ (/tmp/ on Unix, and ~/Application Data/Local Settings/Temp – check the TEMP environment variable) is used. If you specify this init parameter, no directory rt/ will be created, but the directory you have provided will be taken literally.
  • logFilePrefix: A prefix that is put in front of the logfile names. Default is the empty string.
  • dontLogRegEx: A regular expression that is applied to query strings. See java.util.regex.Pattern. If the parameter is not given or an empty string, no pattern is applied.
  • matchOnUriOnly: Should the dontLogRegEx be applied to the URI part of the query (true) or to the whole query string (false). Default is true.
  • timeBetweenFlushesInSec: Log lines are buffered by default. When the given number of seconds have passed and a new request is received, the buffered lines will be flushed to disk even if the number of lines to flush after (see next point) is not yet reached.. Default are 60 sec (1 Minute).
  • flushAfterLines: Log lines are buffered by default. When the given number of lines have been buffered, they are flushed to disk. Default is 10 lines.
  • maxLogFileSize: The maximum allowed size, in bytes, of the logfiles; if a logfile exceeds this limit, the filter will truncate it; the default value is 5242880 (5 MB).

Specific install instructions for various containers

JBoss AS with embedded Servlet containers

Copy the jar file to the lib directory at JBOSS_HOME/server/<config>/lib/

Servlet container version Example Filter configuration file
Tomcat 6 JBoss 4.2, JBoss EAP JBOSS_HOME/server/<config>/deploy/jboss-web.deployer/conf/web.xml.
Tomcat 5.5 JBoss 4.0.2 JBOSS_HOME/server/<config>/deploy/jbossweb-tomcat55.sar/conf/web.xml.
Tomcat 5.0 JBoss 3.2.6 JBOSS_HOME/server/<config>/deploy/jbossweb-tomcat50.sar/conf/web.xml.
Tomcat 4.1 JBoss 3.2.3 JBOSS_HOME/server/<config>/deploy/jbossweb-tomcat41.sar/web.xml.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.