Differences between revisions 1 and 2
Revision 1 as of 2005-03-08 18:54:41
Size: 2877
Revision 2 as of 2009-09-20 21:56:41
Size: 2877
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Tomcat Access Log Sampler (Alpha)

AccessLogSampler was designed to read access logs and generate http requests. For those not familiar with the access log, it is the log the webserver maintains of every request it accepted. This means the every image and html file. The current implementation is complete, but some features have not been enabled. There is a filter for the access log parser, but I haven't figured out how to link to the pre-processor. Once I do, changes to the sampler will be made to enable that functionality.

Tomcat uses the common format for access logs. This means any webserver that uses the common log format can use the AccessLogSampler. Server that use common log format include: Tomcat, Resin, Weblogic, and SunOne. Common log format looks like this: - - [21/Oct/2003:05:37:21 -0500] "GET /index.jsp?%2Findex.jsp= HTTP/1.1" 200 8343

The current implemenation of the parser only looks at the text within the quotes. Everything else is stripped out and igored. For example, the response code is completely ignored by the parser. For the future, it might be nice to filter out entries that do not have a response code of 200. Extending the sampler should be fairly simple. There are two interfaces you have to implement.

  • org.apache.jmeter.protocol.http.util.accesslog.LogParser

  • org.apache.jmeter.protocol.http.util.accesslog.Generator

The current implementation of AccessLogSampler uses the generator to create a new HTTPSampler. The servername, port and get images are set by AccessLogSampler. Next, the parser is called with integer 1, telling it to parse one entry. After that, HTTPSampler.sample() is called to make the request.

  • {{{samp = (HTTPSampler) GENERATOR.generateRequest();

samp.setDomain(this.getDomain()); samp.setPort(this.getPort()); samp.setImageParser(this.isImageParser()); PARSER.parse(1); res = samp.sample(); res.setSampleLabel(samp.toString());}}}

The required methods in LogParser are: setGenerator(Generator) and parse(int). Classes implementing Generator interface should provide concrete implementation for all the methods. For an example of how to implement either interface, refer to StandardGenerator and TCLogParser.






Descriptive name for this controller that is shown in the tree.



Domain name or IP address of the web server.



Port the web server is listening to.

No (defaults to 80)

Log parser class

The log parser class is responsible for parsing the logs.

No (default provided)

Generator class

The generator class is responsible for creating HTTPSampler objects.

No (default provided)

Location of log file

The location of the access log file.


UserManual/Reference/AccessLogSampler (last edited 2009-09-20 21:56:41 by localhost)