Analyzing CloudWatch Synthetics Service

1. Filter for Failed GetCanary API Calls

Retrieves detailed information about each failed GetCanary API call including the timestamp, error code, response message, source IP, and IAM identity. Useful for auditing failed canary lookups and access issues.

SQL
SELECT eventTime,
       eventSource AS AWS_Service,
       eventName AS API,
       errorCode,
       `responseElements.Message` AS Message,
       awsRegion AS Region,
       sourceIPAddress AS Client_IP,
       userAgent,
       `userIdentity.arn` AS IAM_Role_User
FROM `LogGroup`
WHERE eventSource = 'synthetics.amazonaws.com'
  AND eventName = 'GetCanary'
  AND errorCode IS NOT NULL

2. Filter for Lambda PublishVersion API Calls

Retrieves Lambda PublishVersion API calls including the function name, version, and any error details. Helps track Lambda function version publishing activity related to Synthetics canary deployments.

SQL
SELECT eventTime,
       eventSource AS AWS_Service,
       eventName AS API,
       `responseElements.functionName` AS Function_Name,
       `responseElements.version`,
       errorCode,
       errorMessage
FROM `LogGroup`
WHERE eventSource = 'lambda.amazonaws.com'
  AND eventName = 'PublishVersion20150331'

3. Filter for UpdateCanary API Calls

Retrieves detailed information about each UpdateCanary API call including the canary name, region, source IP, and IAM identity. Useful for auditing who is modifying canary configurations.

SQL
SELECT eventTime,
       eventSource AS AWS_Service,
       eventName AS API,
       `requestParameters.name` AS Canary_Name,
       awsRegion AS Region,
       sourceIPAddress AS Client_IP,
       userAgent,
       `userIdentity.arn` AS IAM_Role_User
FROM `LogGroup`
WHERE eventSource = 'synthetics.amazonaws.com'
  AND eventName = 'UpdateCanary'

4. Summarize CloudWatch Synthetics API Calls

Counts all CloudWatch Synthetics API calls grouped by event name. Provides a high-level overview of Synthetics service usage and the most frequently called APIs.

SQL
SELECT eventName AS API,
       COUNT(*) AS CallCount
FROM `LogGroup`
WHERE eventSource = 'synthetics.amazonaws.com'
GROUP BY eventName
ORDER BY CallCount DESC

5. Summarize CloudWatch Synthetics API Calls with Errors

Counts all CloudWatch Synthetics API calls that returned errors, grouped by event name, error code, and error message. Helps identify recurring failure patterns across Synthetics operations.

SQL
SELECT eventName AS API,
       errorCode,
       errorMessage,
       COUNT(*) AS CallCount
FROM `LogGroup`
WHERE eventSource = 'synthetics.amazonaws.com'
  AND errorCode IS NOT NULL
GROUP BY eventName, errorCode, errorMessage
ORDER BY CallCount DESC