Splunk Search

How to write the regex to extract this IP from my data?

venkatalbert
New Member

Hello Team,

I have the below log details and I need to extract only the IP that comes after /. Id remains same for all the commands.

There is no proper field that includes dn, so its hard to extract based on any field.

[2016-02-08T10:29:51.992-05:00] [octetstring] [TRACE] [] [com.octetstring.vde.DoSManager] [tid: 1841020] [ecid: 0000LB1RQ_gB9Dyso4P__m1MAxqb01VGWZ,0] [SRC_CLASS: com.octetstring.vde.util.VDELogger] [SRC_METHOD: debug] UnBind: cn=id,ou=applications,ou=example,ou=example,dc=eg,dc=com/54.16.26.209.

Thanks,
Venkat

0 Karma

somesoni2
Revered Legend

Try something like this (run anywhere sample)

| gentimes start=-1 | eval _raw="[2016-02-08T10:29:51.992-05:00] [octetstring] [TRACE] [] [com.octetstring.vde.DoSManager] [tid: 1841020] [ecid: 0000LB1RQ_gB9Dyso4P__m1MAxqb01VGWZ,0] [SRC_CLASS: com.octetstring.vde.util.VDELogger] [SRC_METHOD: debug] UnBind: cn=id,ou=applications,ou=example,ou=example,dc=eg,dc=com/54.16.26.209." | table _raw 
| rex "dc=\S+\/(?<IPAddress>\d+\.\d+\.\d+\.\d+)"
0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...