Splunk Enterprise

Using rex to filter fields

leandromatperei
Path Finder

Hello everyone,

I have the following pattern of logs and I'm trying to use rex to filter the values, but I'm having problems because of + in some events, can you help me?

| rex field=_raw "DNIS:(?<ANI>\d+)"

2020-09-25 11:50:52.946-03:00 
DNIS:+558730246133

2020-09-25 11:51:33.218-03:00  
DNIS:994699160

2020-09-25 11:52:52.946-03:00 
DNIS:994376160

2020-09-25 11:53:52.946-03:00 
DNIS:+994699160

2020-09-25 11:54:52.946-03:00 
DNIS:+558730246133


 

Labels (1)
Tags (1)
0 Karma

thambisetty
SplunkTrust
SplunkTrust

| rex field=_raw "DNIS:\+(?<ANI>\d+)"

————————————
If this helps, give a like below.
0 Karma

richgalloway
SplunkTrust
SplunkTrust

If you want to include the + in the field then try 

| rex "DNIS:(?<ANI>\+?\d+)"

If you don't want the + in the field then try this

| rex "DNIS:\+?(?<ANI>\d+)"

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...