Skip to main content
PayPulse Cloud uses Amazon CloudWatch for centralized logging across all Lambda functions and the API Gateway. Log groups are defined in aws-infra-terraform/cloudwatch.tf, with additional logging configuration in api_gateway.tf.

Lambda log groups

Four log groups are explicitly managed in Terraform with a 90-day retention policy:
The remaining Lambda functions create their log groups automatically when first invoked. The full set of active log groups is:

API Gateway log group

The API Gateway has its own log group for access logging:
Retention is set to 30 days for the API Gateway log group.

Access log format

API Gateway is configured with detailed structured access logging. Each request produces a JSON log entry containing: This format makes it straightforward to query access logs in CloudWatch Insights by status code, path, or error message.

Throttling settings

API Gateway throttling limits are configured to protect backend Lambda functions from traffic spikes: Requests that exceed the rate limit receive a 429 Too Many Requests response.

Querying logs with CloudWatch Insights

You can query any Lambda log group using CloudWatch Insights. Example query to find errors across all Lambda functions:
To filter by a specific function, select the corresponding log group (e.g., /aws/lambda/parse_invoice) before running the query.
For the invoice processing pipeline (fetch_latest_invoiceparse_invoicesend_invoice_notification), correlate log entries across all three log groups using the requestId present in each function’s log output.