08 Data Health Hourly Volume Anomaly Trend
Query
// REVIEW ONLY - AWS Security Operations Workbook Visual Query
// Tab: DataHealth | Panel: hourly-volume-anomaly-trend | Visualization: timechart | Mode: All
// Security Question: Did any AWS log stream experience a sudden cliff, burst, or SQS backlog flush?
// Drill-Through: Correlate sudden CloudTrail drops with P0-05 logging-evasion alerts.
// Empty/No-Data Contract: No AWS source events in the selected window.
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, SourceTable:string)[]),
(AWSCloudTrail | where TimeGenerated between (Start .. End) | project TimeGenerated, SourceTable="AWSCloudTrail"),
(AWSGuardDuty | where TimeGenerated between (Start .. End) | project TimeGenerated, SourceTable="AWSGuardDuty"),
(AWSVPCFlow | where TimeGenerated between (Start .. End) | project TimeGenerated, SourceTable="AWSVPCFlow"),
(AWSRoute53Resolver | where TimeGenerated between (Start .. End) | project TimeGenerated, SourceTable="AWSRoute53Resolver"),
(AWSWAF | where TimeGenerated between (Start .. End) | project TimeGenerated, SourceTable="AWSWAF"),
(AWSNetworkFirewallAlert | where TimeGenerated between (Start .. End) | project TimeGenerated, SourceTable="AWSNetworkFirewallAlert")
| where isnotempty(SourceTable) and (SourceFilter == "*" or SourceTable == SourceFilter)
| summarize Events=count() by bin(TimeGenerated, 1h), SourceTable
| order by TimeGenerated asc
| take 5000Explanation
This query is designed to analyze AWS log data to identify any sudden changes in log volume, such as abrupt drops, spikes, or backlogs, which might indicate unusual activity or issues. Here's a simplified breakdown of what the query does:
-
Time Range and Filters: It sets a time range (
StarttoEnd) and applies various filters based on organization, account, region, environment, workload, severity, source, principal, and IP. These filters are decoded from base64 strings. -
Data Sources: It pulls data from several AWS services, including CloudTrail, GuardDuty, VPC Flow Logs, Route 53 Resolver, WAF, and Network Firewall Alerts. Each data source is queried for events within the specified time range.
-
Data Union: The query combines (unions) data from all these sources into a single dataset, tagging each event with its source table name.
-
Filtering: It filters out any entries where the source table is empty and applies a source filter to include only specific sources if specified.
-
Event Counting: It counts the number of events per hour (
bin(TimeGenerated, 1h)) for each source table. -
Ordering and Limiting: The results are ordered by time in ascending order and limited to the first 5000 entries.
The purpose of this query is to visualize trends in log volume over time to detect anomalies that might suggest security issues, such as logging evasion or unexpected changes in activity patterns.