At present we run scripts via JMETER on a Linux VM which runs in non GUI mode. When the JMETER test runs it send the results to an output file (JTL File). We then copy this file to our local Windows machine and convert the JTL to CSV to check easier for failures.

What I am trying to do is to search the JTL file that gets generated and look for any errors (these are identified by a (400, Bad Request) A snippet below is an example line of a failure in the JTL file.

1613036683919,43,Document has failed,400,Bad Request,Thread Group 1-1,text,false,,3844,1159,1,1

What I would like is for grep as an example to search the file for any Bad Request errors and only add the chunk of the line not the full line see below:

,Document has failed,400,Bad Request

Note: The Document has failed will change for different test but the text will always be enclosed in commas.

I would like this to be added to a Error.txt file which I can append to for different test and once all are complete send the whole result in an email.

I have a basic grep script which can look into the main part of a JTL to look for errors:

grep ,400, Test.jtl > Error.txt

I have got a script which can email the file out.

Any help is much apprecaited.


Expand your regular expression to include the entire string, and use the -o option to only print the match. Read man grep.

grep  -E -o ',[^,]+,400,Bad Request' Test.jtl
  • Thats perfect! is there anyway of printing the name of the file that has been read on a line with the search result underneath it? I know I can get the result of the grep to a error file by >> error.txt at the end, ideally want to search multiple JTL files and append to one error file. Thanks! – Ian Porritt Feb 15 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.