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!

Splunk Admins: Build a Smarter Stack with These Must-See .conf25 Sessions

  Whether you're running a complex Splunk deployment or just getting your bearings as a new admin, .conf25 ...

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...