Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/azfar-imtiaz/PayPulse-Cloud/llms.txt

Use this file to discover all available pages before exploring further.

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:
resource "aws_cloudwatch_log_group" "fetch_invoices" {
  name              = "/aws/lambda/fetch_invoices"
  retention_in_days = 90
}

resource "aws_cloudwatch_log_group" "fetch_latest_invoice" {
  name              = "/aws/lambda/fetch_latest_invoice"
  retention_in_days = 90
}

resource "aws_cloudwatch_log_group" "parse_invoice" {
  name              = "/aws/lambda/parse_invoice"
  retention_in_days = 90
}

resource "aws_cloudwatch_log_group" "send_invoice_notification" {
  name              = "/aws/lambda/send_invoice_notification"
  retention_in_days = 90
}
The remaining Lambda functions create their log groups automatically when first invoked. The full set of active log groups is:
Log groupFunctionTrigger
/aws/lambda/login_userlogin_userAPI Gateway
/aws/lambda/signup_usersignup_userAPI Gateway
/aws/lambda/fetch_invoicesfetch_invoicesAPI Gateway
/aws/lambda/fetch_latest_invoicefetch_latest_invoiceEventBridge (weekdays 08:30 UTC)
/aws/lambda/fetch_retail_invoicesfetch_retail_invoicesAPI Gateway
/aws/lambda/parse_invoiceparse_invoiceS3 event (PDF upload)
/aws/lambda/get_rental_invoiceget_rental_invoiceAPI Gateway
/aws/lambda/get_rental_invoicesget_rental_invoicesAPI Gateway
/aws/lambda/get_user_profileget_user_profileAPI Gateway
/aws/lambda/gmail_store_tokensgmail_store_tokensAPI Gateway
/aws/lambda/delete_userdelete_userAPI Gateway
/aws/lambda/send_invoice_notificationsend_invoice_notificationDynamoDB stream

API Gateway log group

The API Gateway has its own log group for access logging:
/aws/apigateway/PayPulseAPI
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:
FieldDescription
requestIdUnique identifier for the request
sourceIpClient IP address
requestTimeTimestamp of the request
httpMethodHTTP verb (GET, POST, DELETE, etc.)
pathRequest path
statusHTTP response status code
protocolHTTP protocol version
responseLengthResponse body size in bytes
integrationErrorMessageError message from the Lambda integration, if any
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:
SettingValue
Burst limit5,000 requests
Rate limit1,000 requests/second
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:
fields @timestamp, @message
| filter @message like /ERROR/
| sort @timestamp desc
| limit 50
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.

Build docs developers (and LLMs) love