Digital Ocean Apps

Start logging in 3 minutes

Collect logs from your Digital Ocean Apps.

Set up Better Stack Digital Ocean source

  1. Go to the Better Stack β†’ Sources β†’ Connect source.
  2. Name your source and select Digital Ocean as Platform.
  3. Click the Create source button.
  4. Copy the Source token from the Basic information section.

Set up Digital Ocean App

  1. Go to your Digital Ocean β†’ Apps.
  2. Select your app and click the Settings tab.
  3. Click Log forwarding β†’ Edit β†’ Add new destinations β†’ + Logtail.
  4. Fill in Destination name and paste your Better Stack Source token into the Token field.
  5. Select the app resources to collect logs from.
  6. Click Add Log Destination, and you're done. πŸŽ‰

You should see your logs in Better Stack β†’ Logs & traces.

digital_ocean_log_forward.png

Seeing incomplete logs in Live tail?

Digital Ocean has a hard set limit to the bytes-per-row at 2000B for log forwarding. This may cause some information in your logs to be omitted.

To avoid this limit, you can split your longer logs into multiple records, or implement logging directly in your app and skip Digital Ocean forwarding. This would give you greater control over the format of your logs.

For example, see logging directly from Javascript app.

Forward logs from Digital Ocean Functions

Digital Ocean Functions forward logs using an HTTP API sink instead of Rsyslog. To set this up, you need an HTTP source.

Create an HTTP source

  1. Go to Better Stack β†’ Sources β†’ Connect source.
  2. Select the Logs & Metrics tab.
  3. Scroll to the Other section and select HTTP.
  4. Name your source and click Connect source.
  5. Copy the source token from the source details.

Configure log forwarding

Add the LOG_DESTINATIONS environment variable to your project.yml file:

project.yml
environment:
  LOG_DESTINATIONS: '[{"telemetry":{"token":"$SOURCE_TOKEN"}}]'


You can set LOG_DESTINATIONS at project, package, or function scope depending on which functions you want to forward logs from.

You can forward logs to multiple destinations at once by adding more entries to the JSON array and by creating more HTTP sources.

Deploy and verify

Deploy your project and check Better Stack β†’ Live tail to see your function logs.