New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bunyan-loggly

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-loggly

A bunyan stream to transport logs to loggly

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.8K
decreased by-10.98%
Maintainers
1
Weekly downloads
 
Created
Source

bunyan-loggly

A bunyan stream to send logs through to loggly.

bunyan-loggly is under early development. So far, it's simply but it works. I will be adding the following:

  • support for error reporting when node-loggly fails to transfer to loggly
  • basic buffering support

bunyan-loggly uses node-loggly under the hood. As such, when configuring bunyan-loggly as a stream for bunyan, you need to pass in the standard and required node-loggly configuration object.

For example:

{
	token: "your-really-long-input-token",
	subdomain: "your-subdomain",
	auth: {
    	username: "your-username",
    	password: "your-password"
	}
}

Usage

This is a basic usage example.

var bunyan = require('bunyan'),
	Bunyan2Loggly = require('bunyan-loggly').Bunyan2Loggly,
	logger;

// create the logger
logger = bunyan.createLogger({
	name: 'logglylog',
	streams: [
		{
			type: 'raw',
			stream: new Bunyan2Loggly({
				token: 'your-account-token',
				subdomain: 'your-sub-domain',
				auth: {
					username: 'your-username',
					password: 'your-password'
				}
			})
		}
	]
});

logger.info({});

This is an example of using bunyan-loggly to store express.js request logs.

var path = require('path'),
	bunyan = require('bunyan'),
	serializerRequest = require('../lib/serializer-request'),
	Bunyan2Loggly = require('bunyan-loggly').Bunyan2Loggly,
	request;

// create the logger
request = bunyan.createLogger({
	name: 'request',
	serializers: { req: bunyan.stdSerializers.req },
	streams: [
		{
			type: 'raw',
			stream: new Bunyan2Loggly({
				token: 'your-account-token',
				subdomain: 'your-sub-domain',
				auth: {
					username: 'your-username',
					password: 'your-password'
				}
			})
		}
	]
});

// export the middleware
module.exports = function () {

	return function (req, res, next) {

		// move on straight away
		next();

		// log this request
		request.info({
			req : req,
			production: process.env.NODE_ENV === 'production'
		});

	}

}

Keywords

FAQs

Package last updated on 17 Mar 2014

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc