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!

Which Splunk AI capability should you start with? A new guide from Splunk Lantern

AI in the Splunk platform has expanded well beyond a single assistant or machine learning tool. Customers can ...

Which Splunk AI cost tool do I need? Token and Cost Monitoring vs. Tokenomics vs. ...

"What are we spending on AI?" sounds like a simple question. In practice, it's more complex and actually ...

See What’s New in Splunk Observability Cloud on December 9

Join Splunk Community HQ and the Splunk Observability HQ chapter on December 9, 10:00–11:00 a.m. PT, for the ...