You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Suggestions and Recipes for Log Analysis

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

Here's how Sonam imports and process JMeter log data in Excel:


  1. First, I have to get the data into Excel. I use Perl to parse the XML logs and generate a delimited file Excel imports.

The heart of my Perl data-mangler is this regular expression:

/timeStamp="(\d+)".+?threadName="(.*?)".+?label="(.+?)" time="(\d+?)".+?success="(.+?)"/;

Here are the comments for that regex:

# Grab the relevant details from the log entry. 
# A normal log entry line logs one HTTP 'sampler' operation:
# 	<sampleResult timeStamp="..." ... threadName="..." label="..." time="..." />
# In case the opertion had HTTP redirects, the redirects show up as 
# nested <sampleResult> elements,  but still on the same line:
# 	<sampleResult timeStamp= ... > <sampleResult timeStamp=.... > ... </sampleResult>
# We are only interested in the data in the first <sampleResult> element, 
# so we use non-greedy pattern match operator ( '.*?' or '.+?') to ignore 
# any latter <sampleResult> elements,

These are the temporary Perl variables that this regular expression generates:

my $timestamp = $1; # unix timestamp 
my $threadname = $2; # thread label
my $label = $3; # operation label 
my $time = $4; # operation time in milliseconds
my $success = $5; # boolean success indicator for this operation

They can then be used to write a comma-delimited line.

2. Once the data is in Excel, I convert the timestamp column from Jmeter's Unix timestamp format (base year 1970) to the Excel format (base year 1900) using this following formula. This formula is applied to the entire timestamp column. (NOTE: a better formula was mentioned on JMeter users list sometime back)

=(x/1000+((365*70+17)*86400))/86400

3. I then sort rows are sorted by operation name (i.e. JMeter sampler name)

4. I can now generate suitable reports. For instance, I generate a graph of page load times v/s time for different operations (e.g.: login, add 1 line to the order, etc). A different series for each operation type is used.

Steps #3 and 4 are quite painstaking. It would be nice to have a macro to automate those steps - however, it is beyond my Excel abilities at the moment.


  • No labels