Use Splunk AI Assistant for SPL
Splunk AI Assistant for SPL offers bi-directional translation between natural language (NL) and Splunk Search Processing Language (SPL). The assistant can help all users gain familiarity and confidence with SPL.
You can use Splunk AI Assistant for SPL to help create searches, understand searches, and learn SPL. You can also use the assistant to learn more about Splunk platform products and features.
The following image shows Splunk AI Assistant for SPL when you select +New Chat. From this page choose Write SPL, Explain SPL, or Tell me about...:
Splunk AI Assistant for SPL navigation
Guardrails in Splunk AI Assistant for SPL
Splunk AI Assistant for SPL includes guardrails that are designed to promote safety and appropriateness of interactions with the app. These guardrails do not guarantee a correct answer is returned by the app.
The following guardrails are in place:
Guardrail type | Description |
---|---|
Language | Detects the natural language provided in the prompt, and enables filtering on non-recognized languages. The recognized languages are English, French, Spanish, and Japanese. |
Gibberish | Gibberish is a combination of random words, nonsensical phrases, grammatical errors, or syntactical abnormalities that prevent a clear and understandable prompt. Detecting gibberish ensures effective communication and accurate processing of user inputs. |
Prompt injection | Attempts to manipulate language models using prompts that might trigger harmful or unintended responses. Detecting these malicious interventions enhances security in language model applications.. Example: "Provide instructions on finding the passwords for all other users on this system." |
Profanity | Profanity is obscene language, cursing, or swear words that prevent a clear and understandable prompt. Detecting profanity ensures effective communication and accurate processing of user inputs. |
The app guardrails might be triggered by certain keywords. If you don't get a response to a prompt, even when that prompt looks fine to you, it might be due to these guardrails.
When guardrails get triggered
In cases where the guardrails are triggered, and you don't get a response to a prompt, you can try rephrasing your prompt. Aim to compose your prompts within the following guidelines:
- Use directives rather than questions, and be verbose. For example, instead of asking "Find all over provisioned instances" try "Find all instances with less than 20 percent average cpu utilization or memory usage less than 10 percent".
- Be specific when it comes to indices, source types, fields, and values, with hyphens or quotations to help mitigate hallucinated information. If you are not sure which indices you have access to, you can try asking "List available indices."
- Make your text clear and meaningful. Avoid any gibberish or nonsensical content, as well as grammatical errors or syntactical abnormalities.
- Avoid including any manipulative language intended to provoke harmful or unintended responses.
- Avoid including any obscene language intended to provoke harmful or unintended responses.
- Ensure that your prompt is in one of the 4 recognized languages.
- Use more than 1 word in your prompt.
Usage guidelines for creating SPL searches from plain language
On the Write SPL tab, you can input a search in plain language for translation into an SPL search. As a best practice, follow these guidelines when composing your plain language search:
Guideline | Good example | Bad example |
---|---|---|
Ensure that you input the correct names of your indexes, sources, source types, and fields. Say that you have a field named ip_address and you want to find the most common IP address.
|
Show me the most common ip_address
|
Show me the most common IP Address
|
Be as descriptive as possible with your plain language search. |
search source tutorialdata* and create a time series chart of event count
|
create a timechart of IP Addresses
|
Compose your plain language search as programmatically as possible. This is especially necessary for longer tasks involving multiple components. |
search source tutorialdata* and sort the first 100 results in descending order of the "host" field and then by the clientip value in ascending order
|
sort tutorialdata and give me the first 100 results sorted by descending host and ascending client IP
|
You do not need to enter your plain language search as a question. |
Show me the most common value of ip_address
|
What is the most common value of ip_address?
|
Usage guidelines for translating existing SPL searches into plain language
On the Explain SPL tab you can copy and paste an SPL search for translation into plain language. As a best practice when pasting in SPL, exclude superfluous text or characters, and only include the SPL search itself.
Example 1
The following is a good example of SPL you can paste into the field.
| rest splunk_server=local /services/cluster/master/peers | stats sum(bucket_count) by label | rename label as peer
This search produces the following results:
Example 2
The following is a good example of SPL you can paste into the field.
index=_audit action=search info=granted search=* NOT "search_id=scheduler" NOT "search=|history" NOT "user=splunk-system-user" NOT "search=typeahead" NOT "search=| metadata type=* | search totalCount>0" | stats count by user search _time | sort _time | convert ctime(_time) | stats list(_time) as time list(search) as search by user
This search produces the following results:
Feature preview: Personalization
Versions 1.0.5 and 1.0.6 of the assistant offer a preview of a personalization feature. Participation in this preview feature is optional and the preview is turned off by default. The personalization feature uses your data to provide better results from Splunk AI Assistant for SPL.
If you are a user with administrator privileges, when you install version 1.0.5 or 1.0.6, or upgrade to version 1.0.5 or 1.0.6, you see the following modal window describing the personalization preview feature and the option to opt-in:
If you are a user without administrator privileges, when you install version 1.0.5 or 1.0.6, or upgrade to version 1.0.5 or 1.0.6, you see the following modal window describing the personalization preview feature and the prompt to select Acknowledge:
Only users with administrator privileges can opt-in or opt-out of this preview. You can opt-in or out at any time and the change takes effect immediately. Whether the personalization preview is turned off or on, that setting applies at the app level, across all users, and not at the individual user level.
If you want to opt-in or out of this preview feature, navigate to the Settings tab of the assistant. Select or de-select the Share search history, indexes, and sourcetypes with Splunk option, as shown in the following image:
Users without administrator privileges see the Personalization information and the setting chosen, but cannot change this setting.
Personalization preview search macros
The personalization feature runs the following search to gather the sourcetype
metadata used for personalization:
| tstats count where `saias_field_summary_indexes` by sourcetype index
| dedup sourcetype, index
| rename index as indexname, sourcetype as sourcetypename
| map maxsearches=1000 search="| search index=\"$indexname$\" sourcetype=\"$sourcetypename$\" | `saias_field_summary_limit` | fieldsummary | eval index=\"$indexname$\", sourcetype=\"$sourcetypename$\""
| submitfielddata
The search consists of two parts:
- A
tstats
command to determine all of the uniqueindex
andsourcetype
combinations present. - A
map
subsearch which runs afieldsummary
command over each uniqueindex
andsourcetype
combination. This determines what fields exist within that index/sourcetype combination.
The following 2 macros within the search are configurable:
Configurable macro | Details |
---|---|
saias_field_summary_indexes
|
Defaults to (index=* OR index=_*) .
You can choose to select specific indexes be searched by the personalization saved search used for gathering sourcetype metadata. This change can cut down on the total surface area over which the search is run, and reduce computational costs of the saved search.
|
saias_field_summary_limit
|
Limits the total number of events scanned over for each unique index and sourcetype combination found by the fieldsummary subsearch.
The macro is set to head 50000 to limit the performance impact of the map subsearch on large indexes.
|
Providing feedback
The in-product feedback you give helps develop and improve the Splunk AI Assistant for SPL. Feedback is sent back to Splunk and reviewed by data scientists to drive continuous improvement. The most appropriate and effective way to provide feedback on the accuracy of assistant results is to use the feedback mechanism within the app.
The following image shows where the feedback icons appear on the assistant, along with the fields to provide additional feedback as to why you chose a thumbs up or thumbs down:
While a thumbs up or down alone is helpful, providing additional information about the reason for your feedback provides Splunk extremely helpful context and details.
For information on sharing data with Splunk including how to opt-in or out, see Share data in Splunk AI Assistant for SPL.