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
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!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...