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!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...