Splunk Search

Extract sub string from address

sndpgiri
Engager

I have the following address, and I want to extract the substring.

Address: 121, riverstreet, sydney, Australia.

I want to extract 'sydney'.

Help would be highly appreciated.

Labels (4)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Assuming you already have the Address in a field called Address

| eval city=mvindex(split(Address,","),3)

or

| rex field=Address "([^,]+,){2}(?<city>[^,]+)"

Otherwise, use

| rex "Address:\s([^,]+,){2}(?<city>[^,]+)"
0 Karma
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...