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!

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