Other Usage

How to create regex for AWS ARN to extract region?

chvenu17
Path Finder

Please help to create regx to extract region from below aws ARN(us-west-2)

arn:aws:secretsmanager:us-west-2:1111111111:secret:/rds-oracle/xxxx-xx17sd-xxxxxx-xxx67xxx7gd7133/TEST-01TEST

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

isoutamo
SplunkTrust
SplunkTrust

Hi

...
| rex "^(?:\w+:){3}(?<region>[^:]+)"

this should do the extraction. If the ARN is on field, then you should add “field=<field name>” in rex.

r. Ismo

View solution in original post

chvenu17
Path Finder

Thank you , its working 

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

...
| rex "^(?:\w+:){3}(?<region>[^:]+)"

this should do the extraction. If the ARN is on field, then you should add “field=<field name>” in rex.

r. Ismo

chvenu17
Path Finder

Can you help to brekdown, in case i want to modify to pull different field

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Here is a link https://regex101.com/r/GVLrA1/1 where you could read what those are meaning. There is also easy to chain it.

0 Karma
Get Updates on the Splunk Community!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco &#43; Splunk! We’ve ...