Splunk Search
Highlighted

Run same search for two different time ranges, identify users who appear in both time ranges

New Member

Hello,

I have a search that returns results in the format user, source ip, destination ip, timestamp.

I would like to run that search for two different time windows and return any results where the user is detected in both time windows. In an ideal world, the output would be a single chart showing number of user detections per user over both time durations.

I tried to use a join search to do this:

index="myindex" category="blah"
earliest=-7d@d latest=-1d@d | join user [search index="myindex" category="blah" earliest=-42d@d latest=-14d@d ] | table user, source ip, destination ip, timestamp

but it only returns results for the time period in the main search, and omits results from the join search.

Any help would be greatly appreciated

0 Karma
Highlighted

Re: Run same search for two different time ranges, identify users who appear in both time ranges

SplunkTrust
SplunkTrust

You could use an outer join or simply use append instead:
index=... earliest=-42d@d latest=-14d@d
| append [ same search with earliest=-7d@d latest=-1d@d ]

Worked for me, but I got no good data here for that use case to check.