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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...