npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

winston-lumberjack

v0.0.9

Published

A logstash transport for winston using the lumberjack protocol

Downloads

265

Readme

winston-lumberjack

Build Status Greenkeeper badge

A logstash transport for winston based on node-lumberjack-protocol, a lumberjack protocol implementation for Node.js. It allows for sending encrypted logs from your node.js app to your logstash server instance.

Usage

Node

var winston = require('winston');
// Simply requiring winston-lumberjack will assign winston.transports.Lumberjack
require('winston-lumberjack');

winston.add(winston.transports.Lumberjack, {
    "timestamp": true,
    "level": "debug",
    "serverAddress": {
        "host": "localhost",
        "port": 5000
    },
    "sslCrt": "./logstash-forwarder.crt"
});

winston.log('debug', 'Now my debug messages are written to logstash!');

Lumberjack Configuration

  • sslCert (optional)

    Filename of the trusted CA certificate which has signed the logstash server certificate. If this is omitted several well known "root" CAs will be used. These are used to authorize connections.

  • serverAddress

    An object to specify the host and port of the logstash server. Additionally, all options supported by tls.connect() may be provided. If the ca property is the content of the file referenced by the sslCert property (if provided) will be set as ca.

    "serverAddress": { "host": "localhost", "port": 5000 }

  • level (optional)

    Level of messages this transport should log. Defaults to 'info'.

  • timestamp (optional)

    Boolean flag indicating if log messages shall include a timestamp. Defaults to false.

  • clientOptions (optional)

    An object with additional configuration option passed on to the lumberjack protocol stack:

    • windowSize - the windowSize to send to the receiver. Defaults to 1000. See Caveats section of node-lumberjack-protocol README for details.

    • maxQueueSize - the maximum number of messages to queue while disconnected. If this limit is hit, all messages in the queue will be filtered with allowDrop(data). Only messages which this function returns true for will be removed from the queue. If there are still too many messages in the queue at this point the the oldest messages will be dropped. Defaults to 500.

    • allowDrop(data) - this will be called when deciding which messages to drop. By dropping lower priority messages (info and debug level messages, for example) you can increase the chances of higher priority messages getting through when the Client is having connection issues, or if the receiver goes down for a short period of time. This function is used both to drop messages from the queue while disconnected, and to drop messages if the receiver is taking too long to acknowledge messages.

      Note that this function will be called on all messages in the queue every time the queue grows too large - if this function does not return true for any messages, then it could be called for every message in the queue every time a message is queued.

    • options.reconnect - time, in ms, to wait between reconnect attempts. Defaults to 3 seconds.

License

Copyright (c) 2015-2018, Marcus Wittig All rights reserved.

MIT