Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

pipe-to-syslog

Simple NodeJS daemon to perform tail -f on one or more log files and stream them to a specific remote syslog server over TCP. Useful for instances where a program can not be conveniently rebuilt to use syslog.

Check out the announcement for more detail: http://engineering.hipmob.com/2012/10/12/Unified-logging-with-Node-JS-and-Syslog/

Configuration

1. Check out the pipe-to-syslog project from Github and copy the configuration template
git clone https://github.com/Hipmob/pipe-to-syslog.git /var/local/pipe-to-syslog
cd /var/local/pipe-to-syslog
2. Install all the dependencies.
npm install
3. Add it to Upstart.
cp pipe-to-syslog.conf /etc/init
4. By default we drop privileges and run as a user other than root, so create that user and group here.
useradd -M --shell /bin/false node
NOTE If you don't create this user and group, you will need to edit the /etc/init/pipe-to-syslog.conf file to remove the --user and --group parameters.

5. Create the local log file folder.
mkdir /var/log/node
NOTE If you don't create this folder the service will not start. If you want to log to a different location edit the /etc/init/pipe-to-syslog.conf file.

6. Setup the configuration file.
cp conf.js.template conf.js

Edit conf.js: we've tried to keep it pretty simple. You can have as many unique entries in the self object. For each entry, you can specify an arbitrary number of sinks, where each sink describes the source channel (in this case, a file that should be tailed) and the syslog level, facility and tag. For the entry you can specify the hostname to be sent to the syslog server (you'll need to make a note of this when you're configuring the syslog server), and then the actual syslog server IP address/DNS name and port number.

function get_config()
{
    var self = {};
    self['web'] = {
        sinks: [
            {
                channel: { type: 'tail', file: '/var/log/node/out.log' },
                level: 'info',
                tag: 'web',
                facility: 'user',
            },
            {
                channel: { type: 'tail', file: '/var/log/node/err.log' },
                level: 'error',
                tag: 'web',
                facility: 'user',
            }],
        hostname: '{hostname}',
        server: '{syslog server IP address or DNS name}',
        port: {port number} };
    return self;
}

module.exports.get_config = get_config;
  1. And, you're done. Start it up.
service pipe-to-syslog start

About

NodeJS service to tail log files and relay the results to syslog.

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.