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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...