About
API Gateway access logs record every request a stage handles: caller IP, authenticated identity, route, status, latency, and authorizer or WAF errors. In Sazabi they show who calls which API, which requests fail authorization, and which clients are throttled or abusive. REST APIs can also write execution logs with authorizer and integration detail. API Gateway writes both kinds of log to CloudWatch Logs. Sazabi reads them through the same CloudWatch path as the AWS CloudWatch source.Prerequisites
- An API Gateway REST, HTTP, or WebSocket API
- An OpenTelemetry Collector Contrib deployment, which ships the
awscloudwatchreceiver - AWS credentials for the collector with
logs:DescribeLogGroupsandlogs:FilterLogEvents - Your Sazabi intake URL, shown above — open the log source and copy the Intake URL from its setup screen (the public key is embedded in the URL)
Set up in the dashboard
1
Turn on API Gateway logging
For each API stage, turn on access logging, send it to a CloudWatch log group whose name starts withAPI-Gateway-Access-Logs_, and use a JSON format. This format captures the fields most useful for security:Access log format
$context.routeKey in place of $context.resourcePath.For REST APIs, also turn on execution logging at ERROR or INFO level on each stage. API Gateway writes execution logs to log groups whose names start with API-Gateway-Execution-Logs_. Execution logging needs a CloudWatch Logs role with the AmazonAPIGatewayPushToCloudWatchLogs policy, set once per region under API Gateway Settings.2
Configure the collector
Add theawscloudwatch receiver and the Sazabi exporter to your collector configuration. Set region to the region your APIs run in; add one receiver per region.otelcol.yaml
groups.named instead of autodiscover. The collector uses the standard AWS SDK credential chain; the credential stays with your collector and is never sent to Sazabi.3
Deploy and send a request
Deploy the collector, then send a request to one of your APIs. Records appear after the next poll.Other API gateways
Kong and Apigee don’t write to CloudWatch Logs. Send their logs to an OpenTelemetry Collector and connect that collector to Sazabi.- Kong
- Apigee
Turn on Kong’s OpenTelemetry plugin and point its
logs_endpoint at the collector’s OTLP/HTTP receiver. Kong Gateway 3.8 and later export request and plugin logs over OTLP.kong.yaml
otelcol.yaml
Set up with the CLI
otlphttp/sazabi endpoint.
Verify
Open the Intake page in the Sazabi dashboard and confirm records from the AWS API Gateway source appear within a few minutes. From the CLI,sazabi logs ask "How many API Gateway access log lines arrived in the last 15 minutes, by status?" confirms records are arriving. Search for status 401 or 403 to find failed authorizations, or 429 to find throttled clients.
Troubleshooting
No log groups in CloudWatch — Access logging is set per stage. Check the stage’s log settings, and for execution logs, the account-level CloudWatch Logs role. Collector logsAccessDeniedException — The collector’s AWS identity is missing logs:FilterLogEvents or logs:DescribeLogGroups.
Collector runs but nothing arrives — Check that your log group names start with API-Gateway- and that region matches where your APIs run.
Further reading
AWS CloudWatch
Forward any CloudWatch log group to Sazabi.
OpenTelemetry Collector
Forward logs from any Collector receiver.
Intake
See per-source ingestion volume and health.