You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ja...@apache.org on 2005/03/08 19:54:41 UTC

[Apache JMeter Wiki] New: UserManual/Reference/AccessLogSampler

   Date: 2005-03-08T10:54:41
   Editor: MichaelStover
   Wiki: Apache JMeter Wiki
   Page: UserManual/Reference/AccessLogSampler
   URL: http://wiki.apache.org/jakarta-jmeter/UserManual/Reference/AccessLogSampler

   no comment

New Page:

= 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:

127.0.0.1 - - [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.

'''Parameters'''
|| '''Attribute''' || '''Description''' || '''Required''' ||
|| '''Name''' || Descriptive name for this controller that is shown in the tree. || No ||
|| '''Server''' || Domain name or IP address of the web server. || Yes ||
|| '''Port''' || 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. || Yes ||

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org