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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...