Optimization in Splunk AI Assistant for SPL
Version 1.4.0 and higher of Splunk AI Assistant for SPL offers a search optimization feature. This feature was previously offered as a preview.
Optimization can improve existing SPL searches or generate better searches when used with the Write SPL feature.
Use optimization to run faster searches and reduce costs with similar results. Through the Write SPL tab you can optimize existing searches, including saved searches, or compose new SPL searches that are then optimized.
Requirements
The optimization feature uses metadata from your Splunk deployment to provide better results from Splunk AI Assistant for SPL. Opting into personalization is a requirement to using optimization. See Configure Personalization settings for more information.
Optimization strategies
The optimization feature leverages the following optimization strategies:
- Choosing the right index
- Using
tstat - Eliminating unnecessary wildcards
Optimization examples
To optimize an existing search, you can paste that existing search in the Write & optimize SPL tab or you can ask the assistant to perform optimization using the format of Optimize this search <original_search_query>.
See the following examples of SPL searches before and after SPL optimization:
| Use case | Input | GPT Output | Llama Output |
|---|---|---|---|
| Select correct index |
|
|
|
|
|
| |
|
|
| |
| Optimize stats > tstats |
|
|
|
|
|
| |
| Wildcard replacement |
|
|
|