Splunk Search

Help with regex needed in Splunk

RSS_STT
Explorer

"resource_id": "/subscriptions/850686fe-9b2b-48ab-81a6-80600a0ca5z1/resourceGroups/vg-weu-ltaprod-rg/providers/Microsoft.Web/sites/abcProdUI", "metric_name": "AppConnections"
"resource_id": "/subscriptions/da646143-7fd9-4219-bm72-bdd97951cf91/resourceGroups/gip-prod/providers/Microsoft.Web/sites/splunk-front-prod", "metric_name": "AppConnections"

Below regex providing full extraction
"resource_id\"\:[^,]*?(?<splunk_entity>\w+)"


Currently extracting :abcProdUI & prod
Expexcting to extact : abcProdUI & splunk-front-prod

Any quick support is highly appreciated .

 

 

Labels (2)
Tags (2)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @RSS_STT ,

please try this regex:

\"resource_id\":\s+\".*\/(?<splunk_entity>[^\"]+)

that you can test at https://regex101.com/r/Am82qD/1

Ciao.

Giuseppe

0 Karma

RSS_STT
Explorer

Above provide regex doesn't work for full payload.

@gcusello  please help me with regex for below event data.

{"resource_id": "/subscriptions/8507b6fe-9b2b-48aa-81a6-80622a0ca5f1/resourceGroups/vg-weu-abcprod-rg/providers/Microsoft.Web/sites/abcProdUI", "metric_name": "AppConnections", "timeStamp": "2026-03-11T07:15:00Z", "subscription_id": "8507b6fe-9b2b-48aa-81a6-80622a0ca5f1", "unit": "Count", "namespace": "mic.web/sites", "resource_group": "vg-weu-abcprod-rg", "average": 0}
{"resource_id": "/subscriptions/da646143-7fd9-4219-bm72-bdd97951cf91/resourceGroups/gip-prod/providers/Microsoft.Web/sites/splunk-front-prod", "metric_name": "AppConnections", "timeStamp": "2026-03-11T07:15:00Z", "subscription_id": "da646143-7fd9-4219-bm72-bdd97951cf91", "unit": "Count", "namespace": "mic.web/sites", "resource_group": "splunk-prod", "average": 0}

 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Since this is JSON, and assuming it is treated as such, you could use split and mvindex to get the last part

| eval splunk_entity=mvindex(split(resource_id,"/"),-1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @RSS_STT ,

please try this:

\"resource_id\":\s+\".*\/(?<splunk_entity>[^\"]+)\",\s+\"metric_name

that you can test at https://regex101.com/r/Am82qD/2

Ciao.

Giuseppe

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Always best to provide full information!

Try this:

\"resource_id\":\s+\"[^\"]*\/(?<splunk_entity>[^\"]+)
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

How to Break a Kubernetes Pod on Purpose and Let the AI Troubleshooting Agent Find ...

Let's say I've just rolled out a Kubernetes Deployment with a typo in the image tag. Nothing explodes. The pod ...

Splunk Add-on for Microsoft Windows 11.0.3: Parse Once, Search Faster

The updated Splunk Add-on for Microsoft Windows helps customers search Windows events faster by reducing ...

What's New in Splunk Enterprise Security 8.8 and Beyond

Threats move at machine speed. Keeping up should not depend on having the biggest budget, the largest team, or ...