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
Get Updates on the Splunk Community!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...