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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...