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!

Observability | How to Think About Instrumentation Overhead (White Paper)

Novice observability practitioners are often overly obsessed with performance. They might approach ...

Cloud Platform | Get Resiliency in the Cloud Event (Register Now!)

IDC Report: Enterprises Gain Higher Efficiency and Resiliency With Migration to Cloud  Today many enterprises ...

The Great Resilience Quest: 10th Leaderboard Update

The tenth leaderboard update (11.23-12.05) for The Great Resilience Quest is out &gt;&gt; As our brave ...