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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...