All Apps and Add-ons

how to use search command combine the 2 rows records into 1 row

mwong
Splunk Employee
Splunk Employee

I run the search and it come up with 2 records with 2 fields common in value. Any idea how to combine the 2 record into 1 record?

sourcetype="AAA"|table A_id, B_id, A_start, A_end, B_start, B_end

0 Karma
1 Solution

daniel_splunk
Splunk Employee
Splunk Employee

From your result, if either A-id or B-id have value but not both, you can use strcat to combine it and then use the stats function to get the result.

For example,
sourcetype="AAA"|strcat A-id B-id combine|table combine, A-start, A-end, B-start, B-end|stats max(*) by combine

View solution in original post

daniel_splunk
Splunk Employee
Splunk Employee

From your result, if either A-id or B-id have value but not both, you can use strcat to combine it and then use the stats function to get the result.

For example,
sourcetype="AAA"|strcat A-id B-id combine|table combine, A-start, A-end, B-start, B-end|stats max(*) by combine

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...