Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added info on generating logs and log format. Reorganized section headings

Suggestions and Recipes for Log Analysis

Please add your tips and tricks to this page. Extraction scripts and Excel Macros etc welcome!

Generating Appropriate JMeter Logs

The default data logged during JMeter testing is quite sparse - important request and response fields are stored, but the full response sent back by the server is not stored. This is done to avoid bogging down the test client during load testing.

Using the following JMeter parameters on the command line generates log entries with corresponding higher detail for the test run.

No Format

-Jjmeter.save.saveservice.data_type=true -Jjmeter.save.saveservice.label=true  -Jjmeter.save.saveservice.response_code=true -Jjmeter.save.saveservice.response_data=true -Jjmeter.save.saveservice.response_message=true -Jjmeter.save.saveservice.successful=true -Jjmeter.save.saveservice.thread_name=true  -Jjmeter.save.saveservice.time=true"

The JMeter timestamp_format parameter can be used to specify logentry timestamps format. For eg:

No Format

-Jjmeter.save.saveservice.timestamp_format="yyyy-MM-dd HH:mm:ss"

As of April 2006, JMeter 2.1.1 must also be run with the following flag to ensure logfile uniformity:

No Format

-Dfile_format.testlog=2.0

Wiki Markup
This forces JMeter to use the old logformat which generates <sampleResult> element for all log entries. The newer format instead generates <httpSample> elements for HTTP requests and <sampleResult> for JDBC sampler entries - this is inconvenient from a automated log processing point of view. Refer this \[http://mail-archives.apache.org/mod_mbox/jakarta-jmeter-user/200604.mbox/%3cE5D178BFB0356B48A48B8330B2903721ED5CA6@syd1exc04.CE.CORP%3e Jmeter-user thread\] for more details

The above settings can also be defined as global properties in the JMeter.properties configuration file.

The JMeter Log Format

The format of JMeter log entries generated when using the flags in the previous section is defined in the table below. (Editing note: 4 spaces are used to denote one level of XML 'indentation'.)

XML Element

Explanation

{{/testResults }}

Root element for XML test log

No Format
    @version    	

Version of test results. Currently (JMeter 2.1.1), set to "1.1" irrespective of testlog format flag.

No Format
    /sampleResult/...

All log data is stored under an array of 'sampleResult' elements.

No Format
        @timeStamp	

Timestamp

No Format
        @dataType	

Datatype - typically "text"

No Format
        @threadName	

Name set for the thread group, with affixed at the end " <iteration>-<thread_id>". For eg "Integration Tests Thread Group 1-1"

No Format
        @label		

Label set for the sampler. For eg "Login to Custom URL using test account credentials"

No Format
        @time		

Time in milliseconds for request to complete. Eg "2515"

No Format
        @responseMessage	

Response message. Eg "OK"

No Format
        @responseCode	

Response code. Eg "200"

No Format
        @success		

String indicating status of the request. Can be "true" or "false"

No Format
        /sampleResult/...	

HTTP Redirects are represented as an array of nested 'sampleResult' elements. Only 1 level of nesting occurs (i.e. the nested subresults do not nest further).

No Format
        /property		

A string containing POST Data, Query Data and Cookie Data

No Format
            @xml:space	

XML attribute indicating whether that white space is significant. Set to "preserve"

No Format
            @name		

Set to "samplerData"

No Format
        /assertionResult/...	

Assertion information are stored in an array of assertionResult

No Format
            @failureMessage	

The failure message when the assertion fails

No Format
            @error		

Set to "true" or "false" to indicate error in assertion (stays "false" on assertion failure)

No Format
            @failure		

Set to "true" or "false" to indicate whether assertion failed or not

No Format
        /binary		

Data returned in response

Perl Based Method for Log Extraction

Here are some steps Here are the steps Sonam Chauhan uses to import and process JMeter log data in Excel. Steps #3 and 4 are quite painstaking . It would be nice to have a macro to automate those steps and can be automated by Excel macros - however, it this is beyond my Excel abilities at the moment.:

  1. First, generate delimited file for import into Excel.

...