Splunk Search

Merge Lines Query based on ID

mnorindr
Engager

Hello,

I would like to merge 2 lines which an ID is the unique Key.
Ex

Username      Date         ID        
   Max                    1702
             08/08/14     1702

and get just one line base on the unique ID

Username      Date         ID
   Max       08/08/14     1702

Is it possible to do that?
I though that the command merge can help but do not success

Thanks for your help

Tags (2)
1 Solution

somesoni2
Revered Legend

Try something like this

your base search | table Username Date ID | stats first(*) as * by ID

View solution in original post

rakeshh123
Path Finder

Hi mnorindr,
It can be solved by using Transaction......according to data u got 2lines having redundant data ....for example sessionid may remain same for a particular transaction
alt text

this can be solved by using Transaction query
alt text

rhys04
New Member

I'm on Splunk 6.3 and there's a dedup command you can use in the search for this purpose.
your base search | dedup ID order by username desc

Is there a way apply this logic upon ingestion as opposed to search?

0 Karma

somesoni2
Revered Legend

Try something like this

your base search | table Username Date ID | stats first(*) as * by ID

mnorindr
Engager

Just try but doesn't work (No results found). I see in the forum that maybe "transaction" command can help, i'll try

0 Karma

marhuc
Explorer

I have similar problem, I tried this approach and it works fine

0 Karma
Get Updates on the Splunk Community!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...