Splunk Enterprise

Rex field

Azwaliyana
Path Finder

I want to extract the Country and the Node. When I use the rex in regex101, it works fine. But when I put it on Splunk search, it did not extract the Country and the Node. Do you guys know where is my mistake?

fortinet.PNG

This is my search query.

 

 

index="maxis_csaroam_index" source="/home/csaops/csaroam/*_MOS.csv" 
| dedup Description
| table Description
| rex field=Description "(?<Country>[\w]+)(?<Node>[\w\- ]*\n)"

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try without the newline in the match

| rex field=Description "(?<Country>[\w]+)(?<Node>[\w\- ]+)"

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Give this a try (avoided using dedup command as well, best practice)

index="maxis_csaroam_index" source="/home/csaops/csaroam/*_MOS.csv" 
| stats count by Description
| table Description
| rex field=Description "(?<Country>\S+)\s+(?<Node>\S+)"
0 Karma

bhargavi
Path Finder

Hi @Azwaliyana ,

Try this.

| rex field=Description "(?<Country>\w+)\s(?<Node>\w*\-?\w+)"

 

bhargavi_0-1636995231697.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try without the newline in the match

| rex field=Description "(?<Country>[\w]+)(?<Node>[\w\- ]+)"
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...