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.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...