Splunk Search Optimization
Splunk Search Optimization
Optimizing the search is a strategy that lets the quest run as effectively as
possible. In this section, we will learn how to optimize searches on the Splunk
platform
A search also runs longer when not configured, retrieves more enormous quantities
of data from the indexes than is required, and inefficiently consumes more memory
and network resources. Multiply these problems across hundreds or thousands of
searches, and the result is slow or sluggish.
How we build our quest can have a huge effect on the number of retrieved events
from the disk.
When data is indexed the data will be translated into events based on time
An optimized search
We can optimize the entire search by moving some of the components from the second
search to locations earlier in the search process.
Moving the criteria A=25 before the first pipe filters the events earlier and
reduces the amount of times that the index is accessed. The number of events
extracted is 300,000. This is a reduction of 700,000 compared to the original
search. The lookup is performed on 300,000 events instead of 1 million events.
Moving the criteria L>100 immediately after the lookup filters the events further
reduces the number of events that are returned by 100,000. The eval is performed on
200,000 events instead of 1 million events.
The criteria E>50 is dependent on the results of the eval command and cannot be
moved. The results are the same as the original search. 50,000 events are returned,
but with much less impact on resources.
If we need to view data from the last hour only, don't use the Last 24 hours
default time range.
If we must use a broad time range, such as Last week or All-time, then use other
techniques to limit the amount of data retrieved from disk.
If the events in the dataset we want to retrieve occur frequently, the search is
called a dense search. If the events in the dataset that we want to retrieve are
rare, the search is called a sparse search. Sparse searches that run against large
data volumes take longer than dense searches for the same data set.