Splunk Search

Lookup and group specific logs

msarkaus
Path Finder

Hello,

We identify a fails request by gathering data from 3 different logs. I need to group by userSesnId, and if these specific logs appear in my list, it defines a certain failure. I would like to count each failure by using these logs.

I would greatly appreciate your help with write this search query. 

I hope this makes sense..

Thank you,

I would like to use the information from these logs, grouped by userSesnId

Log #1:

 msgDtlTxt: [Qxxx] - the quote is declined.

 msgTxt: quote creation failed.

polNbr: Qxxx

Log #2

httpStatusCd: 400

Log #3

msgTxt: Request.

 

They all share the same userSesnId

 userSesnId: 10e30ad92e844d

So my results should look something like this:

polNbr            msgDtlTxt                         msgTxt                              httpStatusCd             count

Qxxx                Validation: UWing           quote creation failed     400                             1

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

What have you tried so far and how have those efforts not met expectations?

---
If this reply helps you, Karma would be appreciated.
0 Karma

msarkaus
Path Finder

Yes,  I attempted to use this:

index="stuff" 
(msgTxt="Request recd." OR StatusCd="400" OR msgDtlTxt="Validation err*")
| eval msgTxt=substr(msgTxt, 1, 100)
| stats
          values(_time) as DateTime
          values(msgTxt) as Message
         values(StatusCd) as code
BY userSesnId
| eval DateTime=strftime(DateTime , "%m-%d-%Y %I:%M:%S %p")

but its returning additional logs that I do not need or its only returning one specific log such as

Request recd

 I need it to gather all the logs within a single userSesnId and return only if it contains these logs (see highlighted below) and count as 1.

msgTxt="Request recd." OR StatusCd="400" OR msgDtlTxt="Validation err*")
 
 
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The query looks like it would meet the requirements.  The only change I would make is to add

userSesnId=*

to the base query.

What is it about the logs you don't need that makes them match the query?  Can you share them (sanitized)?

What is wrong with the one specific log "Request recd"?  It meets the requirements.

---
If this reply helps you, Karma would be appreciated.
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!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...