How to use Access Log Sampler to Generate Traffic with JMeter

HOW TO USE ACCESS LOG SAMPLER FOR GENERATING HTTP TRAFFIC

Imagine that you have to create JMeter test-plan for web-site and this test-plan should cover almost all links. In this case creating all samples manually would be a terrible dream for you. Fortunately, you can use automation tools for this process. Here I gonna describe one way of automated creation of HTTP Requests: with JMeter Access Log Sampler.

JMeter Access Log Samper is element that allows you to generate HTTP traffic. Originally, AccessLogSampler was designed to read access logs and generate http requests. Access log is log of web server where information about all requests is written. But what should we do, if we do not have access to web server? We can use any tool that can walk through entire site and grab links. I will describe process of using Xenu's Link Sleuth application.

Xenu's Link Sleuth is third-party application that allows to walk through application and to grab all links in it. To my mind, for highly loaded enterprise application it is not a good variant, because you will have to deal with unreal amount of requests, e.g. to group them manually to different controllers, to choose several link that you need among others. But anyway, this method can be useful for not complex web-sites.

First, you should go to download page and get latest version of Xenu. After installation and running it you will see X Xenu window. Press “Ctrl+N”, and you will see window (Figure 1) where you can enter URL of site that you want to get links from.

Starting with Xenu
Figure 1

After that click “OK”, and Xenu will begin to walk through site grabbing links. You should see the screen, as in Figure 2.

Xenu main window
Figure 2

After that click “OK”, and Xenu will begin to walk through site grabbing links. You should see the screen, as in Figure 2.

Note that Xenu works with sites either over HTTP or HTTPS protocol. In case of using HTTPS you should approve SSL certificate from server.

After Xenu finished its work, go to “File”-”Export to TAB separated file” or press CTRL+T and perform exporting information to *.txt format. Then navigate to saved file through file system and open it in text editor. You will see something like in Figure 3.

Xenu results
Figure 3

Now you have to clear it from redundant information. See Figure 4

Links for JMeter Access Sampler Log
Figure 4

Then perform global replacing «https://prior.by» to «"GET », don’t forget about space and quotes. We will receive

"GET /
"GET /App_Themes/RaiffeisenSkin/CSS/Breadcrumb.css
"GET /App_Themes/RaiffeisenSkin/CSS/Buttons.css
"GET /App_Themes/RaiffeisenSkin/CSS/Content.css
"GET /App_Themes/RaiffeisenSkin/CSS/CurratesTabs.css
“GET /App_Themes/RaiffeisenSkin/CSS/Breadcrumb.css”.

Then we have to save file and open JMeter. First, add “Access Log Sampler”.

Adding Access Sampler Log
Figure 5

Also we need the following visualization elements:

  • View Results in Table;
  • Aggregate Report;
  • View Results Tree;

Now, switch to AccessLog Sampler to see how it should be filled.

Adding Access Sampler Log
Figure 6

Server: Enter domain name of site or server IP;
Port: specify port if needed, by default 80 will be used;
Parse images: False;
Parser: Choose parser from drop-down list, org.apache.jmeter.protocol.util.accesslog.TCLogParser is set by default.
Filter: set “Undefined”;
Log file: it is file that we have created from Xenu grabbing report. So, either place it in …/bin directory of JMeter or specify absolute path to it.
Now, start test-plan. Look at Figure 7

Access Sampler Error
Figure 7

Everything is ok; all strings in View Results Tree are green except last one. We have one error because of end of file with logs. This happened even if I set “Forever” for Loop Count parameter in Thread Group.

Forever check-box
Figure 8

I have found the only problem with Access Log Sampler: it does not allow generating HTTPS traffic, so only HTTP requests can be generated.

That’s all about using Access log in JMeter.


Want to take your JMeter testing to the next level?


Run your own JMeter scripts in the cloud (JMeter-as-a-service) with up to 100,000 concurrent users, real time reporting and nice looking graphs :)
BlazeMeter

provides a performance testing solution that's 100% compatible with Apache JMeter™

Feedback and Knowledge Base