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 Name | Always Present? | Description |
|---|---|---|
log_processed.metadata.component | Yes | Fixed value "api" indicating the component associated with the log |
log_processed.metadata.reqId | Yes | The 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.query | No | Contains the query parameters. Only present at the entry point of the request where the body and query are logged. |
log_processed.metadata.body | No | Contains the request body payload. Only present at the entry point of the request where the body and query are logged. |
log_processed.level | Yes | Log level (e.g., "error", "info", "warn", "debug") |
log_processed.message | Yes | The log message content |
Using API Log Attributes
These attributes enable several use cases in your logging backend:
- Trace a specific request: Filter by
log_processed.metadata.reqIdto view all logs related to a specific API request - Find errors: Filter by
log_processed.level = "error"to view all error logs - Track API routes: Filter by
log_processed.metadata.url(when available) to view logs for specific API endpoints - View request history: Use entry point logs (those with
log_processed.metadata.queryandlog_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.