Splunk Search

Help on Splunk query

suvi6789
Path Finder

Hi, 
I have 4 fields in my index 
ID, Method, URL, HTTP_responsecode

ID is in the form of XXXX-YYYY-ZZZZ-AAAA, 
Now, I want to delimit the ID column and extract YYYY value then run a stats command with the delimited value by HTTP_responsecode

Something as below 

Delimited_IDHTTP_responsecodeCount
YYYY200

10

 

Please could you help on how to delimit the value in the above format mentioned and how to use the new delimited value in a stats command 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

There are a couple of ways to get the desired field from the ID.

| rex field=ID "-(?<Delimited_ID>[^-]+)"
``` OR ```
| eval tmp = split(ID, "-")
| eval Delimited_ID = mvindex(tmp,1)

Use the new field in a stats command just as you would any other field.

| stats count as Count by Delimited_ID, HTTP_responsecode

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...