Splunk Search

Rex Not Extracting All Data

IRHM73
Motivator

HI,

I wonder whether someone could help me please.

I'm trying to extract the first name from the data as shown below:

 [{"name":{"current":{"firstName":"M","lastName":"SMITH"}},"ids":{"nino":"AA111111A"},"dateOfBirth":"26121973"}] 

So I've put together the following rex:

rex field="detail.output-cid-response" "\"firstName\":\"(?<cidFName>[^\"]+)" 

The problem I have is that although there is data there, it is not extracting the "cidFName" for all the records and to be honest I'm at a loss why.

Could someone perhaps shed some light on where I'm going wrong please.

Many thanks and kind regards

Chris

Tags (2)
0 Karma
1 Solution

wpreston
Motivator

Can you try this one?

rex field="detail.output-cid-response" "firstName\\\":\\\"(?<cidFName>[^\\]+)\\"

View solution in original post

0 Karma

IRHM73
Motivator

Hi please find a little more of my log:

{"output-cid-response":"[{\"name\":{\"current\":{\"firstName\":\"ESTELLE\",\"lastName\":\"CRICHTON\"}},\"ids\":{\"sautr\":\"2354290204\",\"nino\":\"ZA631419C\"},\"dateOfBirth\":\"04111923\"}]"

I also don't see a problem with Regex, because I've been using Regex101 to check this.

I hope this helps.

Many thanks and kind regards

Chris

0 Karma

renatobamorim
Explorer

try use rex field=_raw

0 Karma
Get Updates on the Splunk Community!

AI for AppInspect

We’re excited to announce two new updates to AppInspect designed to save you time and make the app approval ...

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...