Splunk Search

To merge rows of a column into one

Mrig342
Contributor

Hi All,

I am trying to merge  the rows of a column into one row for the below table:

App_Name Country Last_Deployed Temp_Version

com.citiao.cimainprojectChina2021-09-24 13:30:04.391.0.12.20210907193849359
com.citiao.cimainprojectHongKong2021-09-24 11:48:15.1761.0.12.20210907193849359
com.citiao.cimainprojectIndonesia2021-09-10 13:17:38.2541.0.12.20210907193849359
com.citiao.cimainprojectMalaysia2021-09-10 14:54:54.0981.0.12.20210907193849359
com.citiao.cimainprojectPhilippines2021-09-24 11:58:44.0341.0.12.20210907193849359
com.citiao.cimainprojectSingapore2021-09-10 12:53:25.5391.0.12.20210907193849359
com.citiao.cimainprojectThailand2021-09-24 14:01:09.6821.0.12.20210907193849359
com.citiao.cimainprojectVietnam2021-09-10 15:00:06.5981.0.12.20210907193849359

 

I used the query as below:

my query | stats values(App_Temp_Name) as App_Name latest(LAST_DEPLOYED) as Last_Deployed latest(APP_TEMP_VER) as Temp_Version by Country | table App_Name,Country,Last_Deployed,Temp_Version

But I need to merge the rows of the column App_Name as one row keeping others as it is like:

App_Name Country Last_Deployed Temp_Version

com.citiao.cimainprojectChina2021-09-24 13:30:04.391.0.12.20210907193849359
 HongKong2021-09-24 11:48:15.1761.0.12.20210907193849359
 Indonesia2021-09-10 13:17:38.2541.0.12.20210907193849359
 Malaysia2021-09-10 14:54:54.0981.0.12.20210907193849359
 Philippines2021-09-24 11:58:44.0341.0.12.20210907193849359
 Singapore2021-09-10 12:53:25.5391.0.12.20210907193849359
 Thailand2021-09-24 14:01:09.6821.0.12.20210907193849359
 Vietnam2021-09-10 15:00:06.5981.0.12.20210907193849359

Please help me modify the query to get the desired output.

 

Thank you very much..!!

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Short answer is don't do it. Long answer is - you're losing information this way. Unless you have a very very strange use case, there's no point in removing values from subsequent events. Remember that you can always sort or reorder fields and you lose the order and association with the initial value completely.

You might group the values into multivalue field but then you'd get a single event with multiple values per field. That's sometimes useful for final presentation but rarely within a processing pipeline since you lose the connection between order of items in separate fields.

So, what do you really want? 🙂

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| stats list(*) as * by App_Name
0 Karma
Get Updates on the Splunk Community!

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

Adoption of Infrastructure Monitoring at Splunk

  Splunk's Growth Engineering team showcases one of their first Splunk product adoption-Splunk Infrastructure ...