Splunk Search

How do you correlate data across two sources with time comparison between events?

blascola
New Member

I want to create an alert for when a user logs in without badging a door within 8 hours prior. My login logs and door logs are in two separate indexes and source types. I created an alias in both source types so the account name field matches. Is there a way to do a time comparison within an eval similar to eval login=if(login to door time >= 8hrs,bad,good)?

Tags (1)
0 Karma

laurie_gellatly
Communicator

http://wiki.splunk.com/Community:UseSplunkForEventCorrelation might help and/or consider using stats.

You might be able to improve on this with a single stats command, but at least this should work and give you the ability to specify different time ranges per index:

index=logins
| stats max(_time) as lt by account 
| join account [ search index=door_time | stats min(_time) as ft by account | fields + ft account] 
| eval duration = lt-ft 
| table duration lt ft account

Assumes that 'account' is your user name that matches in both indexes.

...Laurie:{)

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...