Splunk Search

APM Synthetic - Clear cache between steps

dmoberg
Path Finder

We have a need to setup Synthetic Browser Tests against many endpoints. The main purpose for the Browser tests is to capture the LightHouse Score which we use for Graphs and Alerts. Our problem is that we have not figured out a way to clear the cache (session, cookie, etc.) between the Steps for a Synthetic Monitor and without clearing the cache between steps the Lighthouse Score is not accurate as the previous Step will have cached some objects such as Javascript, etc.

The work-around is to create a separate Monitor for each Step in the Shopping Flow, but this is a tedious task and also not ideal from a Maintenance perspective.

We have previously tried to execute JavaScript to achieve this but never succeeded.

So the question is, how can I clear the cookies/cache/session between Steps in a Synthetic Browser Test? 

Labels (1)
0 Karma

danielbb
Motivator

Currently, Synthetic Browser Tests in Splunk APM don’t provide a built-in way to clear the browser cache, cookies, or session data between individual Steps within the same monitor.

Your workaround of creating separate monitors for each step is a common approach but, as you mentioned, it can be tedious and harder to maintain.

Here are a couple of alternative suggestions you might consider:

  • Use JavaScript in the Step to clear cookies and local storage: You can try running JavaScript at the start of each step to clear cookies and local storage, like this:
    document.cookie.split(";").forEach(function(c) { 
        document.cookie = c.trim().split("=")[0] + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;";
      }); 
      localStorage.clear(); 
      sessionStorage.clear();
    This might help clear session data, but it doesn’t fully clear browser cache for static assets.
  • Separate Monitors with Scheduled Runs: While more maintenance-heavy, scheduling multiple monitors with one step each allows each browser instance to start fresh, ensuring accurate Lighthouse scores.
  • Feature Request / Support: Consider submitting a feature request to Splunk support or your customer success team for native support of cache clearing between steps. This could be a valuable enhancement for Synthetic testing workflows.

Hope this helps! If you find a better solution or workaround, sharing it here would be appreciated.

If this helped you, some karma would be appreciated!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...