Splunk Search

Regex on input change

oriolcamp
New Member

In a dashboard, I have a dropdown input where the user can enter an IP address (customs value). I want to validate that the user's input is really an IP address/net and if not change it to 0.0.0.0/0. I have the following XML in the dropdown input:

<change>
    <eval token="net_token">if(match($value|s$,"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"),"OK","KO")</eval>
    <set token="net_token_exp">if(match($value|s$,"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"),"OK","KO")</set>
</change>

For example, I add the user custom value "aaaa" to the dropdown. Then, if I print the value of net_token_exp it shows:

if(match("aaaa","\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"),"OK","KO")

But maybe the net_token value is OK (even if it does not match the regex...) or it even not evaluates the condition so it does not change the net_token value.

What am I doing wrong?

0 Karma

DalJeanis
Legend

The set would not evaluate the string, so that won't work.

For test purposes, check this...

 <eval token="net_token_test1">$value|s$</eval>
 <set token="net_token_test2">$value|s$</set>
0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...