Fairly new Splunk customer and I've been struggling with this for a bit.
I am trying to develop a strategy around vulnerability scan data and being able to trigger a report that emails a summary of all vulnerabilities detected per device, one email per device.
So far, I have taken the relevant data (Anything with a high CVSS score) and written it to a lookup table. This includes dnsname, pluginname. From that lookup, I have done the following:
|inputlookup vulnreportlookup.csv | stats values(pluginname) as "Plugin" by dnsname | rename dns_name as "Device Name" | table "Device Name", Plugin
This table is a rough approximation of what I need, with one row per device and all the vulnerabilities for that device in-row. I've tried appending to this a map search and adding a eval statement:
|inputlookup vulnreportlookup.csv | stats values(pluginname) as "Plugin" by dnsname | rename dns_name as "Device Name" | table "Device Name", Vulnerabilities | map search="| sendemail email@example.com subject=$result.DeviceName$ firstname.lastname@example.org message=\"test test test\""
If I have 14 devices that I am testing, I will receive 14 emails where the subject line is "No subject" running this. I've tried different combinations of $result.DeviceName$, $DeviceName$, $result.dns_name$ with no success. From what I've read so far most of the questions on this forum that are similar have been around sending messages to different recipients based on the results. I am trying to aggregate the results per device and send one email per device.