Dashboards & Visualizations

How can I search for one eventtype for 4 hours and a second eventtype for 8 hours in the same search?

anuremanan88
Explorer

I have to search for two logs from same index using different time range. For example one eventtype is "login" and the other eventtype is "breach". In a single search i need to search for both eventtypes. But when i do a search for last 4 hrs, it should search eventtype "breach" for last 4 hrs and eventtype "login" for last 8 hrs. Anyone can help me in this?

0 Karma

aholzer
Motivator

Something like this should do the trick for you:
(eventtype=breach earliest=-4h@h latest=now) OR (eventtype=login earliest=-8h@h latest=now)

Hope this helps

0 Karma

anuremanan88
Explorer

Thanks for the reply. Here i need to search time using input filter. I use input token for this. My search would look like this

(eventtype=breach earliest=$token.earliest$ latest=now) OR (eventtype=login earliest=$token.earliest$-4h latest=now).

But its not working

0 Karma

aholzer
Motivator

it's because you can't do -4h of a token.

Here's an answer that solved modifying tokens. It's not pretty, but it should get the work done.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...