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.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...