Splunk Search

Extract IP address from event log

seba333
Engager

Hi!

Need help with this please.

I have to extract the IP address from this:

src=45.141.87.33:53402:X19

value 53402 and value X19 could be anything.

 

help please!

 

Labels (1)

inventsekar
SplunkTrust
SplunkTrust

EDIT- verified, working good.


assuming you want to extract "45.141.87.33"

 

 

| makeresults 
| eval log = "test src=45.141.87.33:53402:X19 test" 
| rex field=log "(?<ipAddr>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" | table ipAddr log

 

rex-ip-new.png

 

Tags (2)
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...