Query Details

D08 Cloudfront And Netfw Discovery

Query

// REVIEW ONLY - Mandatory Step 1: AWS Network Firewall & CloudFront Destination Schema Discovery (P1-5 & P2-1)
// Part A validates AWSNetworkFirewallAlert (noting AccountId/VpcId are NOT native columns on that table!).
// Part B checks custom CloudFront table columns (commented template for AWSCloudFront_AccessLog_CL).
AWSNetworkFirewallAlert
| where TimeGenerated > ago(7d)
| summarize
    Alerts = count(),
    Verdicts = make_set(VerdictAction, 10),
    AlertActions = make_set(AlertAction, 10),
    Severities = make_set(Severity, 10),
    Categories = make_set(Category, 25),
    SampleSnis = make_set(Sni, 20)
    by FirewallName, AvailabilityZone
| order by Alerts desc
| take 100

// --- Part B: Uncomment in workspace if AWSCloudFront_AccessLog_CL (or custom CloudFront CCF table) exists ---
// AWSCloudFront_AccessLog_CL
// | getschema
// | project ColumnName, DataType

Explanation

This query is designed to analyze and summarize data from AWS Network Firewall alerts over the past week. Here's a breakdown of what each part does:

Part A: AWS Network Firewall Alerts Analysis

  • The query targets the AWSNetworkFirewallAlert table.
  • It filters alerts generated within the last 7 days.
  • It summarizes the data by counting the total number of alerts and collecting unique values for several attributes:
    • VerdictAction: Different actions taken based on the verdict.
    • AlertAction: Actions triggered by the alerts.
    • Severity: Levels of severity of the alerts.
    • Category: Categories of the alerts.
    • Sni: Sample Server Name Indications (up to 20 unique values).
  • The results are grouped by FirewallName and AvailabilityZone.
  • The output is ordered by the number of alerts in descending order.
  • It limits the output to the top 100 results.

Part B: CloudFront Schema Discovery (Commented Out)

  • This part is commented out and intended for use if the AWSCloudFront_AccessLog_CL table (or a custom CloudFront table) exists in the workspace.
  • It retrieves the schema of the CloudFront access log table, displaying column names and their data types.

Overall, the query helps in understanding the distribution and characteristics of network firewall alerts and prepares for further analysis of CloudFront logs if needed.