Splunk Search

Split Table by Field

p3hndrx
Explorer

Greetings...

I have a table that looks like:

Timestamp | Action | User
YYYY-MM-DD HH:MM:SS| Fail | User1
YYYY-MM-DD HH:MM:SS | Succeed| User2
YYYY-MM-DD HH:MM:SS| Succeed| User1
YYYY-MM-DD HH:MM:SS| Succeed| User1
YYYY-MM-DD HH:MM:SS| Fail| User2

Is there a way to break this down into separate tables by User such that:
YYYY-MM-DD HH:MM:SS| Fail | User1
YYYY-MM-DD HH:MM:SS| Succeed| User1
YYYY-MM-DD HH:MM:SS| Succeed| User1

YYYY-MM-DD HH:MM:SS | Succeed| User2
YYYY-MM-DD HH:MM:SS| Fail| User2

Labels (1)

to4kawa
Ultra Champion

That's right, because it wasn't in the request.

0 Karma

to4kawa
Ultra Champion
index=_internal | head 1 | fields _raw | eval _raw="Timestamp | Action | User
YYYY-MM-DD HH:MM:SS | Fail | User1
YYYY-MM-DD HH:MM:SS | Succeed | User2
YYYY-MM-DD HH:MM:SS | Succeed | User1
YYYY-MM-DD HH:MM:SS | Succeed | User1
YYYY-MM-DD HH:MM:SS | Fail | User2"
| rename COMMENT as "these are your log sample. from here, the logic"
| rex mode=sed "s/( \| )/,/g"
| multikv forceheader=1
| table Timestamp Action User
| sort User
| autoregress User
| streamstats count as tmp
| eval User=mvdedup(mvappend(User,User_p1))
| fields - User_p1
| mvexpand User
| streamstats count by tmp
| sort User
| foreach * [ eval <<FIELD>>=if(count=2,NULL,'<<FIELD>>')]
| table Timestamp Action User

It's not easy to open a line.

p3hndrx
Explorer

This gets me pretty close.

I guess there is no trellis for a stats table.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...