Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graylog

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graylog

Graylog2 client library for node.js

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-graylog

Graylog2 client library for Node.js

Synopsis

	require("graylog");

Short message:

	log("What we've got here is...failure to communicate");

Long message:

	log("What we've got here is...failure to communicate", "Some men you just 
		can't reach. So you get what we had here last week, which is the way he wants 
		it... well, he gets it. I don't like it any more than you men.");

Short with options:

	log("What we've got here is...failure to communicate", { level: LOG_DEBUG });

Long with options:

	log("What we've got here is...failure to communicate", "Some men you just 
		can't reach. So you get what we had here last week, which is the way he wants 
		it... well, he gets it. I don't like it any more than you men.", 
		{
			facility: "Steve Martin"
		}
	);

You can add custom fields to the options:

	log("What we've got here", { 
		level: LOG_DEBUG,
		_failure: "to communicate"
	});

Options

  • facility - by default it's set to GLOBAL.graylogFacility.
  • level - syslog levels, one of: LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO (default), LOG_DEBUG.
  • timestamp - unixtime of log event, by default it's now.
  • host - by default, it's auto detected.
  • stack - if set to true, log will contain source file name and line number.

Additional settings

You can set GLOBAL.graylogHost and GLOBAL.graylogPort to the host and port of the Graylog2 server. By defaults it's localhost and 12201.

You can set GLOBAL.graylogToConsole to true to log JSON entries to console as well (useful for development in case you don't want to have graylog2 running on your workstation).

You should set GLOBAL.graylogFacility to the name of your application. By default it's set to "Node.js".

You can set GLOBAL.graylogSequence to a integer non-zero value (set it to 1) to have an auto-incremented _graylogSequence field sent to graylog with each log entry. Due to the fact that UDP packets are not guaranteed to be received in the same order as sent, you might need a sequence number to recover the course of events.

You can set GLOBAL.graylogChunkSize to the maximum allowed bytes for a single UDP packet. Log messages higher than that will be sent in chunked encoding.

Example

See sayHello.js.

Modification of the GLOBAL object?! But why?

I know, it's wrong. However I like it that way and I truly believe that logger function must be the easiest to call for the programmer to never hesitate using it. So I think that logger functions should be one of the extremely few cases where global namespace pollution is feasible.

What is graylog2 after all?

It's a miracle. Get it at http://www.graylog2.org/

Installation

npm install .

License

See LICENSE file. Basically, it's a kind of "do-whatever-you-want-for-free" license.

Author

Egor Egorov me@egorfine.com.

Contributors

  • danlangford (dan L)
  • andris9
  • pilsy

FAQs

Package last updated on 24 Oct 2012

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