Splunk Search

Vulnerabilty scanned systems per month

unitrium
Explorer

Hi,
I would like to do a search that gives me the number of systems with a vulnerability per month.
I've tried this search but I'm stuck on the _time field, I'm not exactly sure how it works.

 

 

| tstats `summariesonly` max(_time) as _time values(Vulnerabilities.severity) as severity from datamodel=Vulnerabilities.Vulnerabilities by Vulnerabilities.dest | `drop_dm_object_name("Vulnerabilities")` |bin span=1mon _time | stats count(dest) as "Scanned systems" by _time

 

 

My intuition is that the _time  is some sort of array that contains each time the vulnerability's signature has been detected.  But with my current query I only take the max(_time) which means that all vulnerabilities that have been discovered over 2 months will only be count for the last month.

I really would like to know how I could make them count for each month they have been discovered.
Thanks,

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this:

| tstats `summariesonly` values(Vulnerabilities.severity) as severity from datamodel=Vulnerabilities.Vulnerabilities by _time Vulnerabilities.dest span=1mon | `drop_dm_object_name("Vulnerabilities")`

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

The first part of your query gets the latest time each Vulnerabilities.dest has appeared in your index. "bin span=1mon _time" groups these by month, giving all events the same value for _time (the month they occurred in). "stats count(dest) as "Scanned systems" by _time" then counts these so you end up with a count for each month of the number of destinations when they were last seen. Is this what you were expecting?

0 Karma

unitrium
Explorer

Not exactly,  I would like to count the vulnerability each time they have been seen in a month not just the latest time they have been seen. Not sure how to handle this with _time.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this:

| tstats `summariesonly` values(Vulnerabilities.severity) as severity from datamodel=Vulnerabilities.Vulnerabilities by _time Vulnerabilities.dest span=1mon | `drop_dm_object_name("Vulnerabilities")`

unitrium
Explorer

Yes that's exactly what I was looking for thanks.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...