Splunk Search

Splunk search for range of characters

dvohra
Explorer

Hi All.. how can I search a range of characters in splunk.. example I want to search name of people whose name starts with A-L but not M-Z

user = [A*-Z*] , can I have something like this ?

Labels (4)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| regex user="^[A-L]"
0 Karma

bowesmana
SplunkTrust
SplunkTrust

You can't use regex in a search command but could do this

 

search ...
| where match(user, "^[A-L]")

 

which will filter only users starting with A-L

 or this

 

search...
    [| makeresults 
    | fields - _time
    | eval user=split("ABCDEFGHIJKL","") 
    | mvexpand user 
    | eval user=user."*" ] 

 

which uses a subsearch which effectively turns the search into

 

search ((user=A* OR user=B* OR user=C*...))

 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...