Splunk Search

Form Creation, Wildcard use

jsb22
Path Finder

Essentailly I'm trying to create a form that uses a wildcard by default so users can just hit search on page load and get all values of the field, then the user can input specific values in the field so they can limit what they're seeing. When I specify "< default>*< /default>" it errors out with "Error in 'search' command: Unable to parse the search: Comparator '=' is missing a term on the right hand side". THe fieldset and searchTemplate stream is as follows:

< fieldset>
< input type="text" token="Administrator" />
< default>*< /default>
< /fieldset>

< searchTemplate>(index=windows_7 OR index=windows_2008_R2) source=wineventlog:security EventCode=4720 src_user=$Administrator$ | table _time, src_user, host, dest_nt_domain, signature, user, Display_Name< /searchTemplate>

Tags (2)
0 Karma
1 Solution

MHibbin
Influencer

I may be missing something but I don't know why you have to used \ in your search string..

You can use HTML characters (link here) or you can encase your search in CDATA brackets. However I do not see any of these special characters in your XML.

I have put a working form example in the comment below (for some reason I couldn't get it to appear in answer correctly.. even with "Code Sample" or backticks).

Alos notice I have encased $SRC$ in *'s, this allows for wildcarding on text entered.

Regards,

MHibbin

View solution in original post

MHibbin
Influencer

I may be missing something but I don't know why you have to used \ in your search string..

You can use HTML characters (link here) or you can encase your search in CDATA brackets. However I do not see any of these special characters in your XML.

I have put a working form example in the comment below (for some reason I couldn't get it to appear in answer correctly.. even with "Code Sample" or backticks).

Alos notice I have encased $SRC$ in *'s, this allows for wildcarding on text entered.

Regards,

MHibbin

MHibbin
Influencer

Great News!!

0 Karma

jsb22
Path Finder

Turns out it was the escape character, I tested that before, and it didn't work, tested again to try to digest what the CDATA statement does and it worked, must have fat-fingered it somewhere. So my origional code was correct except for the escape character you recommended. Thanks again!

0 Karma

MHibbin
Influencer

Also to add in for others... the CDATA syntax would be


<![CDATA[search_string_here]]>

0 Karma

MHibbin
Influencer

Ha! Ok... I just edited answer... was having some issues getting Splunkbase to allow my XML... kept creating a form input in the answer!!! 😄

0 Karma

MHibbin
Influencer
(index=main OR index=test) SRC=`*$SRC$*` | stats count by SRC DST -30d -0d
*
test 20
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!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...