Splunk Search

Regex for filter in creating pivot

jpcool
New Member

Hello,

I need to create a pivot where I need to filter the records based on the starting characters of string field i.e only strings starting with characters in the set from A to F and create another pivot for nly strings starting with characters from F to J and so on. I tried with RegEx [a-f] and [a-fA-F] but no luck. I am new to using RegEx with Splunk. Can anyone help how to create filter for field to chose string with only certain characters ?

Thanks,
Jp

0 Karma

ddrillic
Ultra Champion

If we run the following -

| eval data="A11111"
| rex  field=data "(?<user>[A-F]+.*)"  

the generated field user would have value only if the data starts with A-F.

Is this what you are after?

0 Karma

ryanoconnor
Builder

Can you give some examples of strings you have and what you want to capture? Regex's are much easier to assist with if we can visualize what you're seeing. Also take a look at tools like https://regex101.com/ or http://regexr.com/

0 Karma
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 ...