Splunk Search

using rex inside map search

a2021cdev
Observer

index=error sourcetype=error_log "Retry counter reached"
| makemv delim="=",values
| dedup errId
| table errId 
       | map search="search index=error sourcetype=error_log $errId$ "Caused by" | head 1 | rex field=_raw  "MessageText=(?<FailureReason>.+) Please report to system admin"
       | eval FailureReason=\"$FailureReason$\"
       | eval errId=\"$errId$\""
| table errId, FailureReason

The above query does not show any results. If i run the searches separately, i do see the output. What is wrong with the query please?

Labels (1)
0 Karma

a2021cdev
Observer

The query does not meet my requirement. It only lists errId and not the failure reason. 

 

0 Karma

manjunathmeti
Champion

Hi @a2021cdev,

Since you are searching same index and sourcetype, you don't need map.  Try this:

index=error sourcetype=error_log "Retry counter reached" OR "Caused by"
| rex  "MessageText=(?<FailureReason>.+) Please report to system admin"
| stats max(FailureReason) by errId
0 Karma

a2021cdev
Observer

The query does not meet my requirement. It does not correlate errId with failure reason. 

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...