Splunk Search

Condensing multiple table rows into one row

willial
Communicator

I'm working with a database as my source (through DB Connect) and performing a bunch of different evals. When I go to output it looks like this:

**username      JanTotal   FebTotal   MarTotal**
user1            5
user1                         12
user1                                    8
user2            1
user2                         6
user2                                    3

And so on for multiple users. Try as I might, I can't get it to display simply as:

user1            5            12         8
user2            1             6         3

Is there an easy way to condense these rows into a single row by username? I'll even take a hard way.

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

You can try stats. something like this

your existing search (with output 1 above) | stats first(*) as * by username

View solution in original post

somesoni2
Revered Legend

You can try stats. something like this

your existing search (with output 1 above) | stats first(*) as * by username

willial
Communicator

Works perfectly! Thanks!

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Yup, stats first(*) as * by username is the way to go as long as each field only has up to one value per username.

Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...