Query Details

07 Data Health Sentinelhealth And Sqs Errors

Query

// REVIEW ONLY - AWS Security Operations Workbook Visual Query
// Tab: DataHealth | Panel: sentinelhealth-and-sqs-errors | Visualization: table | Mode: All
// Security Question: Is a data gap caused by Sentinel CCF/S3 polling failures (OIDC role, KMS permission, SQS queue) rather than quiet AWS accounts?
// Drill-Through: Inspect SentinelResourceName, Reasons, and SampleDescriptions to remediate IAM/SQS/KMS permissions.
// Empty/No-Data Contract: Zero SentinelHealth AWS connector warnings or failures in the selected time range (verify SentinelHealth diagnostics are enabled).
let Start = {TimeRange:start};
let End = {TimeRange:end};
let OrgFilter = base64_decode_tostring("{Organization:base64}");
let AccountFilter = base64_decode_tostring("{AwsAccount:base64}");
let RegionFilter = base64_decode_tostring("{AwsRegion:base64}");
let EnvFilter = base64_decode_tostring("{Environment:base64}");
let WorkloadFilter = base64_decode_tostring("{Workload:base64}");
let SeverityFilter = base64_decode_tostring("{Severity:base64}");
let SourceFilter = base64_decode_tostring("{SourceTable:base64}");
let SummaryPref = base64_decode_tostring("{SummaryMode:base64}");
let SelectedPrincipalFilter = base64_decode_tostring("{SelectedPrincipal:base64}");
let SelectedIpFilter = base64_decode_tostring("{SelectedIp:base64}");
union isfuzzy=true
    (datatable(TimeGenerated:datetime, SentinelResourceType:string, SentinelResourceKind:string, SentinelResourceName:string, OperationName:string, Status:string, Reason:string, Description:string)[]),
    (SentinelHealth | where TimeGenerated between (Start .. End) | project TimeGenerated, SentinelResourceType, SentinelResourceKind, SentinelResourceName, OperationName, Status, Reason, Description)
| where SentinelResourceType == "DataConnector"
| where SentinelResourceKind has_any ("AmazonWebServices", "AWS") or SentinelResourceName has_any ("AWS", "Amazon", "Route53", "WAF", "Firewall")
| summarize Events=count(), FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated),
    Statuses=make_set(Status, 5), Reasons=make_set(Reason, 10), SampleDescriptions=make_set(Description, 5)
    by SentinelResourceName, SentinelResourceKind, OperationName
| order by LastSeen desc
| take 5000

Explanation

This query is designed to help identify whether there are data gaps in AWS Security Operations due to failures in polling by Microsoft Sentinel's CCF/S3, rather than simply quiet AWS accounts. Here's a simplified breakdown of what the query does:

  1. Time Range and Filters: It sets up a time range and various filters for organization, AWS account, region, environment, workload, severity, source, selected principal, and selected IP. These filters are decoded from base64 strings.

  2. Data Sources: It combines data from a predefined table and the SentinelHealth table, focusing on events generated within the specified time range.

  3. Filtering: The query filters the data to include only those records where the resource type is "DataConnector" and the resource kind or name is related to AWS services (like AmazonWebServices, AWS, Route53, WAF, or Firewall).

  4. Summarization: It summarizes the data by counting the number of events and capturing the first and last time each event was seen. It also collects unique statuses, reasons, and sample descriptions for each resource name, kind, and operation.

  5. Ordering and Limiting: The results are ordered by the most recent events and limited to the top 5000 entries.

The purpose of this query is to help security teams quickly identify and address any issues related to IAM/SQS/KMS permissions that might be causing data gaps, by inspecting the resource names, reasons for failures, and sample descriptions. If there are no warnings or failures in the selected time range, it suggests that there are no issues with the SentinelHealth AWS connector.