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!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...