Splunk Enterprise

extract specific field

ra_52194724
Engager

i want to extract last word in resource_id field from below events.

 

 

 

 

 

 

Labels (1)
Tags (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

https://regex101.com/r/cBungW/1

"resource_id": "[^"]*?(?<last_word>\w+)"

| makeresults
| eval _raw="{\"resource_id\": \"/subscriptions/85bbb6fe-yyyy-xxx-81a6-806aaa0ca/resourceGroups/vg-test/providers/Microsoft.Web/sites/TestAPI\", \"metric_name\": \"FSUsage\", \"timeStamp\": \"2025-12-14T14:48:00Z\", \"subscription_id\": \"85bbb6fe-yyyy-xxx-81a6-806aaa0ca\", \"unit\": \"Bytes\", \"namespace\": \"microsoft.web/sites\", \"resource_group\": \"vg-test\", \"average\": 0}"
| append
    [| makeresults 
    | eval _raw="{\"resource_id\": \"/subscriptions/85bbb6fe-yyyy-xxx-81a6-806aaa0ca/resourceGroups/vg-test/providers/Microsoft.Sql/servers/test-sql-01/databases/Test_Prod\", \"metric_name\": \"allocated_storage\", \"timeStamp\": \"2025-12-14T14:57:00Z\", \"subscription_id\": \"85bbb6fe-yyyy-xxx-81a6-806aaa0ca\", \"unit\": \"Bytes\", \"namespace\": \"microsoft.sql/databases\", \"resource_group\": \"vg-test\", \"average\": 855016}"]
| rex "\"resource_id\": \"[^\"]*?(?<last_word>\w+)\""

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

https://regex101.com/r/cBungW/1

"resource_id": "[^"]*?(?<last_word>\w+)"

| makeresults
| eval _raw="{\"resource_id\": \"/subscriptions/85bbb6fe-yyyy-xxx-81a6-806aaa0ca/resourceGroups/vg-test/providers/Microsoft.Web/sites/TestAPI\", \"metric_name\": \"FSUsage\", \"timeStamp\": \"2025-12-14T14:48:00Z\", \"subscription_id\": \"85bbb6fe-yyyy-xxx-81a6-806aaa0ca\", \"unit\": \"Bytes\", \"namespace\": \"microsoft.web/sites\", \"resource_group\": \"vg-test\", \"average\": 0}"
| append
    [| makeresults 
    | eval _raw="{\"resource_id\": \"/subscriptions/85bbb6fe-yyyy-xxx-81a6-806aaa0ca/resourceGroups/vg-test/providers/Microsoft.Sql/servers/test-sql-01/databases/Test_Prod\", \"metric_name\": \"allocated_storage\", \"timeStamp\": \"2025-12-14T14:57:00Z\", \"subscription_id\": \"85bbb6fe-yyyy-xxx-81a6-806aaa0ca\", \"unit\": \"Bytes\", \"namespace\": \"microsoft.sql/databases\", \"resource_group\": \"vg-test\", \"average\": 855016}"]
| rex "\"resource_id\": \"[^\"]*?(?<last_word>\w+)\""
0 Karma
Get Updates on the Splunk Community!

Splunk MCP & Agentic AI: Machine Data Without Limits

  Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization ...

Finding Based Detections General Availability

Overview  We’ve come a long way, folks, but here in Enterprise Security 8.4 I’m happy to announce Finding ...

Get Your Hands Dirty (and Your Shoes Comfy): The Splunk Experience

Hands-On Learning and Technical Seminars  Sometimes, you just need to see the code. For those looking for a ...