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!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...