Splunk Search

Track Useragent Change Over Time

agodoy
Communicator

So I have two searches that return the list of useragents.

Search 1 Current Week:

host="webserver" | earliest=-1w latest=now | stats count by useragent | table useragent, count | sort - count

Search 2 Last Week:

host="webserver" | earliest=-2w latest=-1w | stats count by useragent | table useragent, count | sort - count

These will return a list of useragents for the time frames indicated. How do I display the useragent that are new from the Last Week search?

Thanks!

0 Karma
1 Solution

lguinn2
Legend

Try this

host="webserver" earliest=-1w latest=now 
| stats count as ThisWeek by useragent
| join useragent type=outer [ search host="webserver" earliest=-2w latest=-1w 
    | stats count as LastWeek by useragent ]
| fillnull
| where LastWeek = 0
| sort -ThisWeek

View solution in original post

lguinn2
Legend

Try this

host="webserver" earliest=-1w latest=now 
| stats count as ThisWeek by useragent
| join useragent type=outer [ search host="webserver" earliest=-2w latest=-1w 
    | stats count as LastWeek by useragent ]
| fillnull
| where LastWeek = 0
| sort -ThisWeek

agodoy
Communicator

That worked. Thank you!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...