Giter Site home page Giter Site logo

winston-datadog-logs-transport's Introduction

winston-datadog-logs-transport

Winston transport for Datadog Logs (not events)

There are 3 winston transports for Datadog on NPM: 1, 2, 3.

All of them send data to Datadog Events instead of Datadog Logs. This package actually is a transport for Datadog Logs, not Events.

Install

$ yarn add @shelf/winston-datadog-logs-transport

Usage

import winston from 'winston';
import DatadogTransport from '@shelf/winston-datadog-logs-transport';

const logger = winston.createLogger({
  transports: [
    new DatadogTransport({
      apiKey: process.env.DD_API_KEY, // Datadog API key
      port: 443, // optional port, 443 is for EU region secure port
      host: 'tcp-intake.logs.datadoghq.eu', // optinal host, 'tcp-intake.logs.datadoghq.eu' is for EU region host
      // optional metadata which will be merged with every log message
      metadata: {
        ddsource: 'lambda',
        environment: 'prod'
      }
    })
  ]
});

logger.info('Hey there', {thisIsMy: 'metadata'});

Publish

$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags

License

MIT © Shelf

winston-datadog-logs-transport's People

Contributors

mhdhazzam avatar randomhash avatar renovate-bot avatar vladgolubev avatar vladholubiev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winston-datadog-logs-transport's Issues

Production/performance impact of connecting a socket per message?

Hey @shelfio, huge thanks for this library! This made it really easy to connect up to datadog in some of our low-usage servers without hassle.

I have a question related to how you send the messages in https://github.com/shelfio/winston-datadog-logs-transport/blob/master/index.js#L36 , however. Basically: in your experience, does it cause any significant performance impact to connect the socket each time? I'm worried that if I set this up on one of my higher traffic servers that connecting a socket each time might hit some limits on the box we're running on and/or cause excess memory/CPU usage. Any thoughts or empirical evidence on this question would be great, if you have it.

https://medium.com/expedia-group-tech/under-the-hood-of-http-requests-in-node-69e27e2cd528 gives me some expectation that creating a new socket per message isn't ideal; storing an instance of http.Agent with maxSockets of 5 or similar and doing a https://nodejs.org/api/http.html#http_agent_createconnection_options_callback call per message (which returns a stream.Duplex, may be compatible with how you're using the TLSSocket) may be the way to go. This theory is certainly untested however...

Thanks again!

miss d.ts

for typescript support, miss config datadog target server for more felxible configuration

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>shelfio/renovate-config)

How to send JSON to datadog as the message

Wondering if you have experience trying to send logs to datadog with a message that is json rather than a string? I'd like to do this because I want to be able to search on all of the message fields rather than sending the JSON as metadata and then creating a facet.

any help is appreciated, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.