Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-plugin-datadog-logs

Gatsby plugin to add Datadog log collection to your Gatsby site.

Learn more about Datadog here.

Install

npm install --save gatsby-plugin-datadog-logs

How to setup

// In your gatsby-config.js
plugins: [
  {
    resolve: "gatsby-plugin-datadog-logs",
    options: {
      clientToken: 'YOUR_CLIENT_TOKEN',
      site: 'datadoghq.com',
      sampleRate: 100,
      enabled: !IS_DEV,
    }
  }
];

Options available are same as the Datadog initialization parameters. Additionally, the parameter enabled (boolean) is available to programatically turn the plugin integration on/off.

How to use

datadogLogs is available on the global window object, so you can use it like this:

datadogLogs.logger.info("Hello World!");
© 2023 Gatsby, Inc.