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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Laser Bananas and Edge Hubs: Exploring Operational Technology (OT) Data Through a ...

  OT is a different environment to traditional IT and can have interesting challenges when interfacing the ...

Event Series: Mastering AI Tokenomics and Splunk Agent Observability

Beyond the Black Box: Correlating AI Performance and Tokenomics with Splunk Agent Observability   As ...

span_metrics: The OpenTelemetry-Idiomatic Way to See Inside Your Services

You open a trace in Splunk Observability Cloud and everything looks fine. One root span, order-pipeline, with ...