Skip to main content

Generic Component Logs

  • This document covers the logging structure for generic DynamoAI components: API, UI, and MongoDB
  • These components use structured logging where applicable, allowing you to filter and query logs based on metadata attributes

API: Structured Logging

The API component uses structured logging with specific attributes that enable powerful filtering and tracing capabilities.

Structured Logging Attributes

The API includes the following attributes in its log entries:

Attribute NameAlways Present?Description
log_processed.metadata.componentYesFixed value "api" indicating the component associated with the log
log_processed.metadata.reqIdYesThe request ID assigned to the incoming request. This ID is present in all logs related to the request and is also returned in the response header as X-Request-Id. Use this to trace all logs for a specific request.
log_processed.metadata.queryNoContains the query parameters. Only present at the entry point of the request where the body and query are logged.
log_processed.metadata.bodyNoContains the request body payload. Only present at the entry point of the request where the body and query are logged.
log_processed.levelYesLog level (e.g., "error", "info", "warn", "debug")
log_processed.messageYesThe log message content

Using API Log Attributes

These attributes enable several use cases in your logging backend:

  1. Trace a specific request: Filter by log_processed.metadata.reqId to view all logs related to a specific API request
  2. Find errors: Filter by log_processed.level = "error" to view all error logs
  3. Track API routes: Filter by log_processed.metadata.url (when available) to view logs for specific API endpoints
  4. View request history: Use entry point logs (those with log_processed.metadata.query and log_processed.metadata.body) to see the history of requests made to specific routes

Note: For CloudWatch-specific query examples and implementation details, see the CloudWatch Guide.

Other Components

Components like UI and MongoDB emit standard application logs. For these components, log exploration typically involves:

  • Filtering by container/pod name
  • Filtering by timestamp
  • Searching log message content

Note: For CloudWatch-specific guidance on viewing these logs, see the CloudWatch Guide.