Splunk Search

How to use a rex field in another search

irvindominguezs
Explorer

I am trying the following query. However, activityId is not being passed to the second query and I am not having any results.

index=kubernetes lineOfBusiness=ifm component=chub useCase=C5 responsePayload
| rex field=_raw "imsiActivationDate\"\:\"(?<imsiActivationDate>[^\"]*)"
| rex field=_raw "simChangeDate\"\:\"(?<simChangeDate>[^\"]*)"
| rex field=_raw "activity-id=(?<activityId>[^||]*)"
| table activityId | map search="index=kubernetes lineOfBusiness=ifm component=ifm activity-id=*$activityId$*" | rex field=_raw "msisdn":"=(?<msisdn>[^=]*)" | dedup activityId, msisdn
| table activityId msisdn

Labels (2)
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @irvindominguezs,

Can you try below?

index=kubernetes lineOfBusiness=ifm component=chub useCase=C5 responsePayload
| rex field=_raw "imsiActivationDate\"\:\"(?<imsiActivationDate>[^\"]*)"
| rex field=_raw "simChangeDate\"\:\"(?<simChangeDate>[^\"]*)"
| rex field=_raw "activity-id=(?<activityId>[^||]*)"
| table activityId | map search="search index=kubernetes lineOfBusiness=ifm component=ifm activity-id=*$activityId$*" | rex field=_raw "msisdn":"=(?<msisdn>[^=]*)" | dedup activityId, msisdn
| table activityId msisdn
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

manjunathmeti
Champion

hi @irvindominguezs,

Instead of using the map command, you can use the first/main search as a sub search to filter activityId in the second search.

index=kubernetes lineOfBusiness=ifm component=ifm activity-id IN([| search index=kubernetes lineOfBusiness=ifm component=chub useCase=C5 responsePayload | rex field=_raw "activity-id=(?<activityId>[^||]*)" | eval activityId="*".activityId."*" | stats values(activityId) as re | return $re]) | rex field=_raw "msisdn":"=(?<msisdn>[^=]*)" | dedup activityId, msisdn
| table activityId msisdn

 

If this reply helps you, a like would be appreciated.

0 Karma

irvindominguezs
Explorer

Hello,

It did not work. I am still getting 0 results.

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...