Splunk Search

How to check field values are valid??

chitreshakumar
Communicator

I have field which is having sequence number .I want to check if it is valid and make a new field that will give if sequence number field is valid/invalid . Format is like "EH12839911" 10 digits first two letters alphabet while next 8 are digits.

0 Karma
1 Solution

mayurr98
Super Champion

hey @chitreshkumar

try this run anywhere search

| makeresults | eval sequence="EH12839911" | append [| makeresults | eval sequence="EH12831421"] |  append [| makeresults | eval sequence="3512839911"] |eval status=if(match(sequence,"^[A-Za-z]{2}[0-9]{8}"),"Valid","Invalid")

Ideally in your environment you should write

<your_base_search> | eval status=if(match(sequence,"^[A-Za-z]{2}[0-9]{8}"),"Valid","Invalid")

Let me know if this works!

View solution in original post

mayurr98
Super Champion

hey @chitreshkumar

try this run anywhere search

| makeresults | eval sequence="EH12839911" | append [| makeresults | eval sequence="EH12831421"] |  append [| makeresults | eval sequence="3512839911"] |eval status=if(match(sequence,"^[A-Za-z]{2}[0-9]{8}"),"Valid","Invalid")

Ideally in your environment you should write

<your_base_search> | eval status=if(match(sequence,"^[A-Za-z]{2}[0-9]{8}"),"Valid","Invalid")

Let me know if this works!

Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...