Splunk Search

regex exclue from IPs

Splunk_rocks
Path Finder

I have following regex which giving Cisco group name but my events containing group = 132.XX .34.34 some IPS also so i just want to show in new field only actual group name and remove the IP from results. I have tried below one but still showing IP values.

":\s+Group(\s+=\s+|\s+<)(?P[^>|^,]+)"

Group event contains.
Group = xpn
Group = blaa
Group =
Group =
Group = < ter=pan>
Group = 123.23.21.23.

i want remove IPS from my group field.

Tags (1)
0 Karma

FrankVl
Ultra Champion

First of all: I think your regex needs some work. < and > need to be escaped, and | does not work as an OR operator in the character set definition (the [...] bit). If you want anything but > and ,, just do [^\>,]. You can use tools like regex101.com to validate your regex. If you post some sample data here, people can also help with that.

How easy it is to ignore IP addresses depends on what valid group names look like. Can those start with a number? If not, then it is easy, just add a \D (any non-number character) at the start of the capturing part of your regex, to make it match only group names that don't start with a number.

If they can start with a number, it is a bit more difficult and may be simpler to just capture it incl. IP addresses and then remove anything that looks like an IP address afterwards.

| ...your base search...
| ...your rex command...
| eval Group=if(match(Group, "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"), null(), Group)
0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...