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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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