Splunk Search

Comparing two search results and listing unique ones as table

renjithk
Observer

Hi,

Have logs for both request to a server and its response. However, in some cases the response won't be received and want to get those missed records only to a new table. User id is the common functionality appearing in both logs.

index=mtest ("X-Responding-Instance:ms*" OR "HTTP request to ms is registered successfully") | rex field=_raw ".*X-userid: (?<Success_UserId>.*)" | table Success_UserId usrId

X-userid is coming as a header in response and I have to extract value from there. 'usrId' is already coming along with the 'registered successfully' message as a field and I can extract it without rex.

The moment I add '| tableSuccess_UserId usrId' to above query, gets two table with values, but the records are coming in alternate lines and that maybe the reason I'm not able to compare between them.

Is there any option to compare between the data in two tables and find out the records of usrId, that are missing in Success_UserId table?alternate_rows_result.png

Labels (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The user id values are on different lines because they are in different events.  They can be merged using coalesce and stats.

index=mtest ("X-Responding-Instance:ms*" OR "HTTP request to ms is registered successfully") 
| rex field=_raw ".*X-userid: (?<Success_UserId>.*)" 
| eval userId = coalesce(usrId, Success_UserId)
| stats values(*) as * by usrId
| table Success_UserId usrId

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Seamless IT/OT Security: A Hands-On Look at the Cisco Cyber Vision Splunk Add-on

With just a few clicks, you can ingest critical OT asset details, vulnerabilities, baseline deviations, ...