Splunk Search

Join data inside same logs

tung62
New Member

I have logs with three fields (1) session_id, (2) login_id, (3) message
- session_id is "key"
- login_id is empty except user first login
e.g.
session_id,login_id,message
session1, loginA, message1
session1,, message2
session1,, message3
session2,loginB, message4

How to join the data to retrieve all events and fields of "sesion1" only using login_id="loginA"?

Tags (1)
0 Karma

markthompson
Builder

You can use the transaction command.

Your search | transaction startswith="login_id='loginA'" endswith="Whatever the last bit of it is"

This will join the string together as one event.

0 Karma

tung62
New Member

The transaction command will merge contents into a single row. But I want the result is shown as below table format. Can do it?

time,session1,loginA,message1
time,session1,loginA,message2
time,session1,loginA,message3

0 Karma

markthompson
Builder

If you want to display it as a table, simply use the table command.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...