Skip to main content

Generic Component Logs

  • Under this we cover log exploration for generic components such as API, UI, MongoDB, PostgreSQL, Monitoring components
  • For these components there are 2 ways to explore the logs
    1. Directly opening the AWS Cloudwatch Log Stream and viewing the logs there
    2. Exploration via AWS Cloudwatch Insights by querying the logs
  • In both the cases, it's best to determine the log stream to look the logs in

Identifying Log Streams

The log groups are determined by the namespace the component is deployed in.

ComponentNamespaceLog Group NameLog Stream NameMetadata
APIdefault/dynamofl/application-logs/eks-cluster/defaultapi.${POD_NAME}POD_NAME: starts with api-deployment-*
UIdefault/dynamofl/application-logs/eks-cluster/defaultui.${POD_NAME}POD_NAME: starts with api-deployment-*
MongoDBmongodb/dynamofl/application-logs/eks-cluster/mongodbmongodb.${POD_NAME}POD_NAME: starts with mongodb-*
PostgreSQLpostgresql/dynamofl/application-logs/eks-cluster/postgresqlpostgres.${POD_NAME}POD_NAME: starts with postgres-deployment-*
OpenTelemetryopentelemetry/dynamofl/application-logs/eks-cluster/opentelemetryopentelemetry-collector.${POD_NAME}POD_NAME: starts with opentelemetry-collector-*
Prometheusmonitoring/dynamofl/application-logs/eks-cluster/monitoringprometheus-server.${POD_NAME}POD_NAME: starts with prometheus-*
Grafanamonitoring/dynamofl/application-logs/eks-cluster/monitoringgrafana.${POD_NAME}POD_NAME: starts with grafana-*
Alertmanagermonitoring/dynamofl/application-logs/eks-cluster/monitoringalertmanager.${POD_NAME}POD_NAME: starts with alertmanager-*
EventExportermonitoring/dynamofl/application-logs/eks-cluster/monitoringevent-exporter.${POD_NAME}POD_NAME: starts with kubernetes-event-exporter-*

How to view the logs for these components?

There are 2 approaches for this

  1. Exploration via Log Streams directly: We recommend exploring the logs by directly opening the cloudwatch stream on the Cloudwatch Console. However in some use-cases for API, you could take the benefit of the structured logging.
    • E.g you'd want to view the logs for a particular request using the request_id [check next approach]
  2. Exploration using AWS Cloudwatch Insights: Beneficial for some use-cases in components where structured logging is enabled
    • Out of these structured logging is manually supported by DynamoAI for API only

Exploration: AWS Cloudwatch Log Streams

Go to AWS Cloudwatch Console

Steps

1. Select the log group

Log Group View

2. Click on the log stream to view the logs

Log Stream View

Exploration: AWS Cloudwatch Insights: API

As mentioned before you could use the same approach as exploration via Log Stream for API too. In some use-cases it'll be smart to use this approach.

Structured Logging Attributes: API

Attribute NameValueLogged in every log?Description
log_proccessed.metadata.componentapiYesFixed value indicating the component associated with the log.
log_proccessed.metadata.reqIdRequest IDYesThe request ID assigned to the incoming request at the API, present in all related logs and returned in the response header as X-Request-Id.
log_proccessed.metadata.queryQuery ParametersNo, only at entry pointContains the query parameters for the entry point of the request where the body and query are printed.
log_proccessed.metadata.bodyRequest BodyNo, only at entry pointContains the body of the request payload for the entry point of the request where the body and query are printed.

Use-Cases: Some of them include when you want

1. To view the logs for a specific request using request id

Query Replace the log stream with your api log stream and the reqId with the request id for which you want to view the logs

filter @logStream = 'api.api-deployment-dd8b9bf74-nphnc' |
filter log_processed.metadata.reqId = '24395b50-1825-11ef-bebb-4bef0c216e38' |
fields @timestamp, log_processed.message
| sort @timestamp asc
| limit 1000

Screenshot

2. To view error logs in the past

Query Replace the log stream with your api log stream

filter @logStream = 'api.api-deployment-dd8b9bf74-nphnc' |
filter log_processed.level = 'error' |
fields @timestamp, log_processed.message
| sort @timestamp asc
| limit 1000

3. Know see the past request entry points for a particular api route

You could use them to know

  • The history of such requests being made
  • Get the request id for further exploration of the request [by using point 1 listed above]

Query Replace the log stream with your api log stream as well as the url value for whatever api route you want to view the points

filter @logStream = 'api.api-deployment-dd8b9bf74-nphnc' |
filter log_processed.metadata.url like '/v1/test/model/' |
fields @timestamp, log_processed.message
| sort @timestamp asc
| limit 1000

Screenshot