Skip to content
SPL // Splunk

Using the loadjob Command

KGI Avatar
 

Written by: Carlos Diez | Last Updated:

 
March 12, 2025
 
Search Command Of The Week: loadjob
 
 

Originally Published:

 
March 12, 2025

Splunk Processing Language (SPL) is a powerful query language used to search, analyze, and visualize machine-generated data within Splunk. It enables users to retrieve, manipulate, and display information from indexed logs and events. 

The loadjob command helps users reuse the results of previously saved searches. Instead of rerunning queries multiple times, users can pull historical search results, improving performance and saving valuable system resources.

 

Understanding the loadjob Command

The loadjob command retrieves the results of a scheduled or ad-hoc search by referencing its job ID (SID). This feature is particularly useful for dashboards, reports, and alerts where repetitive searches can be avoided by leveraging stored results. 

By using loadjob, users optimize their search efficiency and reduce the load on Splunk infrastructure. Instead of executing complex queries multiple times, users can simply reference previously computed results.

Proper Syntax

To use the loadjob command effectively, you need to understand its syntax: 

				
					| loadjob sid=<search_id> 
				
			

OR

				
					| loadjob savedsearch="<user>:<app>:<search-name>" 
				
			
  • sid=<search_id>: Specifies the search ID (SID) of a previously executed search. 
  • savedsearch=”<user>:<app>:<search-name>”: Loads results from a saved search uniquely identified by the triplet {user, app, saved search name}. 
  • Optional parameters include artifact_offset to retrieve a specific set of artifacts. 

Retrieving the Search ID (SID) & Saved Search Information

To use loadjob effectively, you need to obtain either the search ID (SID) of a previous job or the triplet identifier for a saved search. 

  • Finding the SID: Run a search in Splunk and check the Job Inspector (Activity > Jobs). The SID is displayed in the job’s details and can also be retrieved using the addinfo command within a search. 
  • Locating a Saved Search: To use a saved search, navigate to Settings > Searches, Reports, and Alerts, where you can find the saved search name along with its associated user and app. The format required for loadjob is savedsearch=”<user>:<app>:<search-name>”. 

Benefits of Using the loadjob Command

Using loadjob in Splunk has several advantages: 

  • Performance Optimization: Avoid rerunning complex queries by reusing stored search results, reducing CPU and memory consumption. 
  • Faster Dashboards and Reports: Dashboards using loadjob fetch data instantly, improving user experience and efficiency. 
  • Efficient Scheduled Searches: Scheduled searches run at predefined intervals, and loadjob enables users to retrieve these results without re-executing queries. 

Example Use Cases

To better understand how loadjob works, let’s explore a few practical use cases. 

Example #1: Loading Results From a Search ID (SID)

Use Case: A security team is responsible for monitoring failed login attempts across the organization’s infrastructure. A scheduled search runs every hour, aggregating failed login attempts from different authentication sources. Instead of rerunning the search each time an analyst needs to review the data, they can instead use loadjob to retrieve the latest results from the last time the search was ran. 

				
					| loadjob sid=1234567890.1 
				
			

In this example, the loadjob command is loading the results from a previously executed search job. The sid parameter identifies which specific job’s results to load. The value “1234567890.1” is the unique identifier for that particular search job.

There are several methods that can be used to find a sid for search job (to list a few of them):

  • The sid is available in the URL from your browser after running a search in Splunk.
  • You can also click on the “Job” menu in the search bar area and select “Inspect Job” to see details about the search, including its sid
  • You can use the history search command to see your search history. This will show recent searches along with their sids.
Example #2: Loading Saved Search with CIM Compliance

Use Case: A SOC (Security Operations Center) team is monitoring authentication failures across multiple applications and platforms. They have a saved search that extracts relevant authentication events from Splunk’s Common Information Model (CIM). Instead of manually searching for failed authentication attempts each time, they use loadjob to retrieve the pre-processed results and then apply statistical analysis to identify the most affected users and source locations.

				
					| loadjob savedsearch="admin:search:authentication_failures" 
| stats count by src, user 
				
			

Once again, the loadjob will load the results of a previously saved scheduled search named “authentication_failures” using the “admin:search” app context. This means the search was executed by the admin in the Splunk search application. This authentication_failure search was previously created and has executed before this loadjob runs. The second part of this command counts the number of authentication failures and groups them by both the src and user fields using the stats command.

Example #3: Loading Results & Applying Additional Filters

Use Case: An IT operations team manages service availability for multiple data centers. They have a saved search that detects service outages across all locations. When troubleshooting an issue in a specific data center, they don’t need to rerun the entire search; instead, they use loadjob to pull the latest results and apply a filter to focus only on outages in that data center. 

				
					| loadjob savedsearch="admin:search:service_outages" 
| search data_center=DC1 
				
			

This example uses the same process as Example 2 by loading the results of a previously ran saved search. In this instance, this saved search is called service_outages, and was ran by the admin in the search Splunk app. The second part of the command uses the search command to narrow down the results to only show service outages in the DC1 data center.

Conclusion

The loadjob command is a valuable tool in Splunk for optimizing performance and improving efficiency. It enables users to retrieve stored search results without re-executing queries, making dashboards and reports more responsive. 

Key Takeaways:
  • loadjob allows users to load results from previously saved searches using their search ID (SID). 
  • It enhances search performance, making dashboards and scheduled reports faster. 
  • The command can be used with additional filters to refine retrieved data for specific use cases. 

By integrating loadjob into your Splunk searches, you can significantly improve efficiency and reduce system overhead. 

To access more Splunk searches, check out Atlas Search Library, which is part of the Atlas Platform. Specifically, Atlas Search Library offers a curated list of optimized searches. These searches empower Splunk users without requiring SPL knowledge. Furthermore, you can create, customize, and maintain your own search library. By doing so, you ensure your users get the most from using Splunk.

Atlas Search Library
Helpful? Don't forget to share this post!
LinkedIn
Reddit
Email
Facebook