Splunk Search

How to create Splunk search based on textbox field?

srv007
Path Finder

I have a splunk search query which shows the details but the problem here is it only shows the results if the hostname passed in the text box is with fqdn. If hostname entered is without fqdn it won't show any result. How do I make the query to work if I pass abc123.xyz.com or abc123.

Apologizes if it's already answered, very new to Splunk.

Labels (1)
0 Karma
1 Solution

VatsalJagani
SplunkTrust
SplunkTrust

Welcome to Splunk Community @srv007 .

I think answer by @gcusello should solve your problem. (Basically using wildcard).

View solution in original post

VatsalJagani
SplunkTrust
SplunkTrust

Welcome to Splunk Community @srv007 .

I think answer by @gcusello should solve your problem. (Basically using wildcard).

VatsalJagani
SplunkTrust
SplunkTrust

Hello @srv007, I'm a Splunk Community Moderator,

Kindly accept the answer posted by @gcusello ,  as that's the answer to your question.

On my post, you can add "Karma/Upvote" if you like it. That would be appreciated!!

 

Thanks @srv007 , Happy Splunking!!!

woodcock
Esteemed Legend

Have a hidden base search that uses the input from the text box and changes the "$host_from_textbox_token$" value from it like this:

|makeresults
| eval host="$host_from_textbox_token$"
| lookup dnslookup clienthost AS host OUTPUT clientip AS ipFromHost
| lookup dnslookup clientip AS host OUTPUT clienthost AS hostFromIp
| rex field=host "(?<barehost>.*?)\.\w+\.\w+$"
| eval host = mvappend(host, ipFromHost, hostFromIp, barehost)
| table host
| format


Then use grab "$result.search$" in the "change" section to set another token and use that one everywhere else.

srv007
Path Finder

Correction -

It's text box pannel and not text book.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @srv007 ,

are you speaking of a text input panel to perform a search?

If yes, you can add an asterisk in prefix and suffix:

    <input type="text" token="user">
      <label>User</label>
      <choice value="*">All</choice>
      <default>*</default>
      <prefix>user="*</prefix>
      <suffix>*"</suffix>
      <fieldForLabel>user</fieldForLabel>
      <fieldForValue>user</fieldForValue>
    </input>

 Ciao.

Giuseppe

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!

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...