How to Forward Logs in App Platform

App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.


In addition to viewing basic logs in App Platform, you can forward application runtime logs to external log management providers. This allows you to use the provider to search, index, and retain the logs. Forwarding logs does not count towards application’s bandwidth usage and you cannot use dedicated egress IP addresses to forward logs at this time.

Currently, App Platform supports log forwarding to OpenSearch, Papertrail, Datadog, Logtail, and DigitalOcean Managed OpenSearch clusters.

Configure Log Forwarding using the Control Panel

To configure log forwarding, go to the Apps section of the control panel, click on your app, and click on the Settings tab. In the Log Forwarding section, click Edit and select your log collection provider. Then provide the applicable values for your provider:

Provider Settings
Managed OpenSearch

Username (optional): The username you use to access the cluster. Defaults to doadmin.
Database Cluster Name: The name of your DigitalOcean Managed OpenSearch database cluster.
Index name (optional): The name of the OpenSearch index to forward the logs to. Defaults to logs.

Log forwarding does not support sending logs to DigitalOcean Managed OpenSearch clusters with trusted sources enabled. To send logs to a managed OpenSearch cluster, disable trusted sources.

OpenSearch

Endpoint: The endpoint URL of your OpenSearch cluster, in https://hostname:port format.
Username: The username you use to access the cluster.
Password: The username’s password to access the cluster.
Index name (optional): The name of the OpenSearch index to forward the logs to. Defaults to logs.

Papertrail

Endpoint: The provider endpoint where App Platform forwards the logs. Use TLS-encrypted syslog endpoint. For more information, see the Papertrail documentation.

Datadog

Endpoint: The provider endpoint where App Platform forwards the logs. Use the HTTP endpoint https://http-intake.logs.datadoghq.com/api/v2/logs. If you use a different Datadog site, such as US3, the endpoint uses a different subdomain. In the example of US3, the endpoint is https://http-intake.logs.us3.datadoghq.com/api/v2/logs. Check Datadog’s documentation to ensure you’re using the correct endpoint.

API Key : The token generated by Datadog. For more information, see the Datadog documentation.

Logtail

Token: The token used to access a Rsyslog source in Logtail. For more information, see the Logtail documentation.

Select the resources of the app that should forward logs to the provider.

Log destination

Click the Add Log Destination button to enable remote logging for the provider.

Logs screen

Configure Log Forwarding using the App Spec

To configure log forwarding using the app spec, add a log_destinations object to your app spec and specify the log consumer’s details. For example, the following configuration forwards logs to a DigitalOcean Managed OpenSearch cluster:

log_destinations:
  - name: your_log_consumer_name
    open_search:
      cluster_name: your-opensearch-cluster

See the app spec reference for more information about the log_destinations object and the details for each log consumer.