Splunk Enterprise

How to write this field extraction using rex?

Kk
Path Finder

Hi All, I'm trying to extract the card details in  my logs. Just confused how to extract the two or more card details or thier respective fields using rex command.

Example : Visa card numbers regex is ^4[0-9]{12}(?:[0-9]{3})?$

                    JCB card numbers regex is ^(?:2131|1800|35\d{3})\d{11}$

I just want to extract the Visa and JCB fileds to check my card details. Is thier a way to create named grouped fields for the above cards using rex command in a single search?

Help me with the query guys.

Thanks in advance.

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Is this what you mean?

| rex "^(?<jcb>(?:2131|1800|35\d{3})\d{11})|(?<visa>4[0-9]{12}(?:[0-9]{3})?)$"
0 Karma
Get Updates on the Splunk Community!

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...