Splunk Search

Getting the previous event displayed in search results

mikemichaleson
Engager

I'm using Splunk to analyze Linux audit logs.

My query looks like this:
index="my index" action=success (type=USER_LOGIN) | iplocation addr | table Country, addr, _time, type, acct | sort by _time

Before every USER_LOGIN event, there is a USER_AUTH event that shows what account name was used.

How do I get the events that happened right before each USER_LOGIN event to show up in my search results?

Tags (1)

kmorris_splunk
Splunk Employee
Splunk Employee

Do you need the events to remain separate? If not, you could use the transaction command, along with the common field and the startswith and endswith parameters to indicate that you want the transaction event to start with the USER_AUTH event and end with the USER_LOGIN event. This will combine both events into one transaction event for each user. You can also specify the maxspan to indicate the time window for these two events to happen. Not sure if this is what you are looking for or not.

renjith_nair
Legend

@mikemichaleson,

Do you want a specific details from this event? What happens when you add (type=USER_LOGIN OR type=USER_AUTH) ?

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...