News & Announcements

Create Your Own Log Drains Integration

News & Announcements

Create Your Own Log Drains Integration

We’re excited to announce the addition of a new General HTTP Endpoint option for Netlify Log Drains!

Now Netlify developers on Enterprise plans can configure their website’s traffic and function logs to be exported to a general HTTP endpoint. With this option, you can build your own Log Drain integration to any log management provider that supports URL-based authentication and accepts JSON-formatted logs.

As an example, let’s set up a log drain integration to Logtail from Betterstack in order to monitor and troubleshoot Netlify websites using the general HTTP endpoint option.


As a monitoring solution, Logtail offers:

  • Support for multiple data sources
  • Live log tailing
  • Easy-to-build custom views
  • Custom alerts
  • Powerful notification and monitoring integrations
  • Custom dashboards
  • Direct SQL querying, filtering, and explorations
  • Up to 30 day log retention and available archival integrations

To start your integration, you’ll need a Logtail account. Once you have this created, follow these steps to configure your Netlify log drain with Logtail:

Create a Data Source in Logtail

  1. In Logtail, click Connect Source.
  2. Create a name for your source.
  3. From the Platform dropdown, scroll down to and select the HTTP option.
  4. Click Create Source.


Configure your Log Drain in the Netlify App

  1. Open the Netlify app and select the site for which you’d like to export logs.
  2. Click Site Settings.
  3. Click Log Drains from the left navigation, then click Enable a Log Drain.
  4. Click the Log Drain Service dropdown and select General HTTP Endpoint.
  5. Select the types of logs you want to send to Logtail.


Construct your Logtail log endpoint URL

  1. From Logtail, copy the URL in “Send the request to” and paste this into a text editor where you will construct your complete URL.
  2. In your text editor, append ?source_token=<SOURCE_TOKEN> to the URL and replace <SOURCE_TOKEN> with the token provided on the source screen in Logtail.
  3. In Logtail, click Save Source.
  4. In the Netlify app, paste the full Logtail URL (including the appended source token query parameter) into the Full URL field under your log drain configuration. Click Connect.

You’re all set! You can now click the Live Tail icon in the Logtail UI to start watching for your logs. From there, you can filter, create custom views, create alerts and notifications, and more from these logs in Logtail.

A couple of items of note:

  • When you paste your full URL with the source token into Netlify, the Netlify UI will obfuscate the full URL so that your source token is not exposed; only the base URL will be shown after you hit Save.
  • It may take up to five minutes after log drain configuration for your Netlify logs to start appearing in Logtail.

While it may take a little more work up front to construct the fully-qualified URL for this option, it may enable you to export your Netlify logs even if we don’t offer a direct integration to your preferred log drain provider.

You should also know…

In addition to the “create your own” option, Netlify also provides direct integrations with the following log management providers:

What’s next?

In the coming months, expect to see even more direct integrations for Log Drains. We’re constantly evaluating new integration points based on customer requests.

You can also expect some enhancements to the formatting options available in the General HTTP endpoint log drain configuration. The current log format is limited to JSON only, and we’re exploring the ability to support NDJSON as well for increased compatibility with even more logging providers.

Where will you send your Netlify logs data? Tell us on the Forums! Let us know where you’ve configured your integration and if you have any requests for future integrations.

Keep reading

Recent posts

Book cover with the title Deliver web project 10 times faster with Jamstack enterprise

Deliver web projects 10× faster

Get the whitepaper