Reporting

how to combine two searched by row which have some columns comman but not ids

sachinkiet
Explorer

Hi,

i have two searches first give open alert data and second gives closed alert data i want to merge both results.

alert idmessageserveropentriggredtime     
1fsdf127.0.0.101/09/20     
2fdsfs127.0.0.101/09/20     
         
closed idmessageserverclosedtriggredtime     
3fdsfs127.0.0.001/09/20     
4fsdf127.0.0.001/09/20     
         
alert id & closed idmessageserveropentriggredtimeclosedtriggredtime    
1fsdf127.0.0.101/09/20     
2fdsfs127.0.0.101/09/20     
3fdsfs127.0.0.0 01/09/20    
4fsdf127.0.0.0 01/09/20    
Labels (1)
0 Karma

sachinkiet
Explorer

Actually the data which I am getting are from two searches. you have used split function at line no 4, why we are using it.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The first part just creates sample data - you don't need this as you already have the data. The important parts are the renames

your first search
| rename "alert id" as id
| append [ your second search
| rename "closed id" as id
]
| table id message server opentriggredtime closedtriggredtime

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Rename the id fields to the same name and append one search to the other

 

| makeresults | eval event="{\"alert id\":1,\"message\":\"fsdf\",\"server\":\"127.0.0.1\",\"opentriggredtime\":\"01/09/20\"}\n{\"alert id\":2,\"message\":\"fdsfs\",\"server\":\"127.0.0.1\",\"opentriggredtime\":\"01/09/20\"}"
| eval event=split(event,"\n")
| mvexpand event
| spath input=event
| fields - _time event
--- created first table
| rename "alert id" as id
| append [ | makeresults | eval event="{\"closed id\":3,\"message\":\"fdsfs\",\"server\":\"127.0.0.0\",\"closedtriggredtime\":\"01/09/20\"}\n{\"closed id\":4,\"message\":\"fsdf\",\"server\":\"127.0.0.0\",\"closedtriggredtime\":\"01/09/20\"}"
| eval event=split(event,"\n")
| mvexpand event
| spath input=event
| fields - _time event
--- created second table
| rename "closed id" as id
]
| table id message server opentriggredtime closedtriggredtime

 

0 Karma
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...