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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...