Generate Traffic using Access Log Sampler in Jmeter

In this blog post, we will see about how to generate traffic using Access Log Sampler in Jmeter. It is not possible for every performance test engineer to generate traffic for all requests which is similar to production server. Access Log samplers in Jmeter helps test engineers to generate traffic exactly as in production.

Access Logs which resides in production web servers has all the information such as HTTP requests, images, CSS, javascripts, detailed session information etc. To enable your web server to collect access logs, you need to configure for extended log format. Please refer below links which explains to configure your web server.

  • BEA Weblogic – http://e-docs.bea.com/wls/docs70/adminguide/web_server.html#113868
  • Tomcat – http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/valve.html
  • Websphere – http://e-docs.bea.com/wls/docs61/adminguide/web_server.html#113868
  • Resin – http://www.caucho.com/resin-3.0/config/log.xtp#access-log

Now we will see how to generate traffic using Access Log Sampler in Jmeter and how to collect all the requests using Xenu’s Link Sleuth tool.

First we will see how to collect all the requests from your website using Xenu’s Link Sleuth tool. Link Sleuth helps users to find broken links by verifying links, images, CSS, Javascript, applets etc.

Download Xenu’s Link Sleuth

Steps to find broken links and export the log

  • Install Link Sleuth from above link and launch Xenu.
  • Click on File > Check URL
  • Enter the website that you want to find broken links as shown below

  • Click on OK
  • Xenu will track all the links in the URL you specified. Once Xenu completed its tracking, you could all the requests in GREEN color as shown below. In the status bar you could check the status of the URLs tracked.

Now go to File > Export Page mode to TAB separated file… to export the result as extended log format. It will look like as shown below, if you open using Notepad++

  • Remove the first line i.e. “OriginPage LinkToPage LinkToPageStatus LinkToPageTitle OriginPageDate OriginPageTitle” in the text file.
  • Now press Ctrl + H, to replace all HTTP requests format to GET format. Enter “http://<your website.com>” in Find what text box and enter “GET “ (please include double quotes and the space as well) and click on Replace All.
  • Now your log file will look as shown below.

Now we will see how to use access log sampler in Jmeter to generate traffic as similar to the production log.

  • Launch Apache Jmeter, right click on Test Plan > Add > Threads (Users) > Thread Group
  • Right click on Thread Group > Add > Logic Controller > Loop Controller to add Loop controller and check Loop Forever check box
  • Right click on Loop Controller > Add > Sampler > Access Log Sampler to add Access Log sampler
  • Right click on Thread Group > Add > Listener > View Results Tree to add listeners to monitor the execution.
  • Click on Access Log Sampler and enter following details.
    • Server i.e. your website name
    • Parse Images
    • Parser
    • Filter
    • Log file location

  • Click on Run and monitor the execution using Listener as shown below.

PS: Click on stop to halt your execution.

Subscribe to our QAInsights YouTube Channel.

About the Author

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hamster - Launch JMeter Recent Test Plans SwiftlyDownload for free
+
Share via
Copy link