Giter VIP home page Giter VIP logo

node-syslog's Introduction

node-syslog

Syslog-ng TCP client for node, with basic fault-tolerance.

installation

$ npm install syslog

synopsis

var syslog = require('syslog');
var logger = syslog.createClient(514, 'localhost');

logger.info("ping!");

log levels

In increasing order of severity:

  • debug
  • info
  • notice
  • warning
  • error
  • crit
  • alert
  • emerg

These are available as methods on Client, ex: logger.crit().

You may also call the log method, and pass the level as the 2nd argument:

logger.log('fnord!', syslog.LOG_CRIT);

The default level is info.

configuration

You will have to configure your syslog server to accept TCP connections. This is usually done in /etc/syslog-ng.conf. Let's say you have an app called fnord, the configuration would look something like this:

source tcp_s {
  tcp(ip(0.0.0.0) port(514) max-connections(256));
};
destination fnord_d {
  file("/var/log/fnord.log");
};
log { source(tcp_s); destination(fnord_d); };

If you have multiple apps which need to log via TCP, you can specify filters, as such:

filter fnord_f { program("fnord"); };

Then modify the log statement to read:

log { source(tcp_s); filter(fnord_f); destination(fnord_d); };

Now if you have another app, called bnord, create similar destination and filter configurations for it, and specify a new log statement, with the same source:

log { source(tcp_s); filter(bnord_f); destination(bnord_d); };

For this to work, you have to make sure you set the process.title variable in your node app.

process.title = 'fnord';

Alternatively, you can pass it as an option to createClient:

syslog.createClient(514, 'localhost', { name: 'fnord' });

license

See LICENSE file.

Copyright (c) 2011 Alexis Sellier

node-syslog's People

Contributors

cloudhead avatar gcohler avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-syslog's Issues

typo line 65 of node-syslog.js

Hi,

on line 65 of node-syslog.js you still have a typo saying "faculty" instead of "facility", resulting in messages being sent as "kern.emerg", popping up all over in the console.

64: this.connect(function (e) {

  • 65: var pri = '<' + ((that.options.faculty * 8) + severity) + '>'; // Message priority
  • 65: var pri = '<' + ((that.options.facility * 8) + severity) + '>'; // Message priority
    66: var entry = pri + [

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.