Splunk Search

How do I return a search for a field that contains a number?

jbala1
Engager

example:

If I have a list of user and I want to search and the users who only have a number in that field;

John_doe
John_doe1
Jane_doe
Jane_doe2

How do I return just the users with numbers associated to their field?

Tags (1)
0 Karma
1 Solution

inventsekar
SplunkTrust
SplunkTrust

this regex will return all field "UserName" which are having a number.

 your base search | regex UserName="\w+\d"

tested this and its working fine -
to list all hosts which are having a digit/number in them -

index=_internal | regex host="\w+\d"

View solution in original post

0 Karma

inventsekar
SplunkTrust
SplunkTrust

this regex will return all field "UserName" which are having a number.

 your base search | regex UserName="\w+\d"

tested this and its working fine -
to list all hosts which are having a digit/number in them -

index=_internal | regex host="\w+\d"

0 Karma

jbala1
Engager

Thank you. That answer solved my problem.

0 Karma

cmerriman
Super Champion

how about

|eval userNumbers=match(userField,"\d")

that should give you a true/false of users with digits in their username and you can search from there.

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...