Socket
Socket
Sign inDemoInstall

winston-logstash-ts-fix

Package Overview
Dependencies
4
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-logstash-ts-fix

Winston's Logstash transport in UDP protocol fork from winston-logstash-ts with fix import error on tsc build


Version published
Weekly downloads
86
decreased by-48.5%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

winston-logstash-ts

A winston logstash transport to UDP protocol in Typescript. Rewrite from https://github.com/liuyanjie/winston-logstash-transport

Dependencies

  • logform: "^2.1.2",
  • winston: "^3.2.1",
  • winston-transport: "^4.3.0"

Installation

  • Install to your project using npm -i winston-logstash-ts or yarn add winston-logstash-ts

Example

  • Manually create logstash transport, then add to an existing winston instance
import { LogstashTransport } from "winston-logstash-ts"
.
.
const logstash = new LogstashTransport({
    host: "logstash.hostname.or.ip",
    port: 11200,
    protocol: "udp", //default is udp, support tcp connection as alternative
    format: logform.format.combine(
        logform.format.timestamp(),
        logform.format.logstash(),
    )
});
winston.add(logstash);
.
.
  • Use LogstashTransport.createLogger() static method to create winston logger with logstash transport
import { LogstashTransport } from "winston-logstash-ts"
.
.
const logger = LogstashTransport.createLogger("<APP_NAME>", {
    host: "logstash.hostname.or.ip",
    port: 11200,
    protocol: "udp", //default is udp, support tcp connection as alternative
    format: logform.format.combine(
        logform.format.timestamp(),
        logform.format.logstash(),
    )
});

The option type is LogstashOption (https://github.com/HuskyMoonMoon/winston-logstash-ts/blob/master/src/LogstashOption.ts), which is extended from winston.LoggerOption

Keywords

FAQs

Last updated on 09 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc