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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...