- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
splunkuser21
Engager
11-03-2015
12:09 PM
index=system* sourcetype=inventory order=829
I am trying to extract the 3 digit field number in this search with rex to search all entries with only the three digit code. I tried:
index=system* sourcetype=inventory (rex field=order "\d+")
index=system* sourcetype=inventory (rex field=order "(\d+)")
index=system* sourcetype=inventory (rex field=order "[0-9]{3}")
What is the correct way to do this?
Thanks!
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

MuS
Legend
11-03-2015
12:27 PM
Hi splunkuser21,
try this:
index=system* sourcetype=inventory | rex field=order "(?<myOrder>\d{3})" | search myOrder=*
This will create a new field called myOrder
which can be searched further down the search pipe.
Hope this helps ...
cheers, MuS
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
skottska
New Member
12-18-2018
03:05 AM
You can also use
index=system* sourcetype=inventory | regex order="\d{3}"
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

MuS
Legend
11-03-2015
12:27 PM
Hi splunkuser21,
try this:
index=system* sourcetype=inventory | rex field=order "(?<myOrder>\d{3})" | search myOrder=*
This will create a new field called myOrder
which can be searched further down the search pipe.
Hope this helps ...
cheers, MuS
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

MuS
Legend
11-03-2015
12:30 PM
You could also simply search for all orders below 1000
this will also return all order containing 3 digits:
index=system* sourcetype=inventory order<1000
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
splunkuser21
Engager
11-03-2015
02:41 PM
Thanks @MuS !
