Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

miguelmota/winston-remote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Winston Remote

Stream your winston logs to a remote winston server.

Install

Available via npm

npm install winston-remote

Usage

Set up your remote winston server:

var winston = require('winston');
var winstonRemote = require('winston-remote').Server;

var winstonServer = winstonRemote.createServer({
    port: 9003
});

winstonServer.listen();

// Set up the winston logger transports
winstonServer.logger = new (winston.Logger)({
    transports: [
        new winston.transports.File({ filename: '/var/log/winston/info.log' })
    ]
});
node server.js

Listening on port 9003

Set up your local winston transport that sends the winston logs to the remote server:

var winston = require('winston');
var winstonRemoteTransport = require('winston-remote').Transport;

var logger = new (winston.Logger)({
    transports: [
        new (winstonRemoteTransport)({
            host: '192.168.1.100', // Remote server ip
            port: 9003 // Remote server port
        })
    ]
});

Afterwards just log as usual:

logger.info('foo');

and then on your remote server you can check the save logged files:

cat /var/log/winston/info.log

{"level":"info","message":"foo","timestamp":"2014-05-12T02:56:23.039Z"}

With line info:

...
new (winstonRemoteTransport)({
    host: '127.0.0.1',
    port: 9003,
    label: 'Client',
    stack: true
})
...
info: Client::foo at example/log.js:16:8 Object.<anonymous>

License

Released under the MIT License.

About

Stream your winston logs to a remote winston server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published