Using Scanner Search Commands
Last updated
Last updated
scanner
to return log eventsThe scanner
command executes a search query via the Scanner API and returns the results as events. In Splunk parlance, this is an events generating command.
Example. Get ECS FireLens log events that contain the string token ERROR
in any field.
scannertable
to return a tableThe scannertable
command also executes a search query via the Scanner API, but instead of returning the results as events, it returns the results as a table. In Splunk parlance, this is a report generating command.
This command is helpful in contexts where you want to generate a report, set up a dashboard widget, or manipulate statistical tables.
Example. Compute aggregated counts of CloudTrail log events by eventSource
:
Since scanner
and scannertable
are generating commands, they must be used at the beginning of the search string or at the beginning of a subsearch.
Use the scanner
command to run a query with the Scanner API and return a list of log events. By default, Scanner returns up to 1000 log events. These log events will be those with the most recent timestamp.
For example, here is how to search for all GetObject
events in CloudTrail logs indexed by Scanner.
Here's how to look for a set of indicators of compromise that are IP addresses:
Use the scannertable
command to run a query with the Scanner API and return a table. By default, Scanner returns up to 1000 rows.
For example, here is how you can query Cisco Umbrella DNS logs to find the top internal IP addresses with the term "Malware"
appearing in the categories
column.
You can pipe the results of a query into additional Splunk functions to transform the results. In this example, we use rename
to change the names some of the fields.
Here is how you can use Scanner in a sub-search. Let's say you have a Splunk index called threat_intel_ip_addresses
containing threat intelligence about malicious IP addresses. You might query for malicious IP addresses above a certain threat score, and then join them with a sub-search that users the scanner
command. This query would allow you to determine if any recent AWS console login events came from a high threat IP address.
Note: The inner search command [scanner q="..."]
runs before the join occurs, and it will return up to 1000 log events. This will not perform a join between the entire Splunk index and the entire Scanner index.
You can use the collect
command in Splunk to load Scanner search results into a Splunk summary index. This can be helpful when you want to collect preliminary data and trigger a more complex alerts when a threat seems sufficiently clear.
In this example, we look for failed AWS API calls from IAM users and load them into a Splunk index called cloud_api_errors
.