Coder Social home page Coder Social logo

winston-syslog's People

Contributors

apollon77 avatar baseonmars avatar dabh avatar dbmikus avatar dependabot[bot] avatar faust64 avatar fliegenklatsch avatar gdvyas avatar indexzero avatar jcrugzz avatar jefftomlinson avatar julien51 avatar justcfx2u avatar khejing avatar lancespeelmon avatar mohd-akram avatar noirbot avatar omidznlp avatar pepakriz avatar santigimeno avatar sergeyksv avatar signiantjoe avatar skunca avatar squeeks avatar theverything avatar tsondergaard avatar vrza avatar wbt avatar yonjah avatar zit0un 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  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  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  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winston-syslog's Issues

Winston 3 breaking on syslog levels.

Somewhat a follow-on to #87, which was closed.

Setting the syslog log levels with the param on createLogger, as is appropriate for Winston 3 doesn't seem to be working quite as expected. I made a little test program:

const { createLogger, format, transports, config, } = require('winston');
require('winston-syslog').Syslog;

const logger = createLogger({
  levels: config.syslog,
  format: format.simple(),
  transports: [
    new transports.Console(),
    new transports.Syslog({
      type:     '5424',
      protocol: 'unix',
      path:     '/var/run/syslog',
    })
  ]
});

logger.notice(`Current Testing Time is: ${new Date()}`)
logger.error("Here is a test error message")

When I run that with Node 8, Winston 3.0.0-rc1, I get this error:

TypeError: logger.notice is not a function

Which implies that it's not getting the right levels, which seems odd, since winston.config.syslog logs out as:

{ levels:
   { emerg: 0,
     alert: 1,
     crit: 2,
     error: 3,
     warning: 4,
     notice: 5,
     info: 6,
     debug: 7 },
  colors:
   { emerg: 'red',
     alert: 'yellow',
     crit: 'red',
     error: 'red',
     warning: 'red',
     notice: 'yellow',
     info: 'green',
     debug: 'blue' } }

Now, if I swap the Logger constructor to:

  levels: config.syslog.levels,

We get further, but now I get this error:

notice: Current Testing Time is: Tue Nov 07 2017 08:59:07 GMT-0600 (CST) {}
/Users/perry.shuman/Code/temp/log_test/node_modules/winston-syslog/lib/winston-syslog.js:126
    return callback(new Error('Cannot log unknown syslog level: ' + level));
           ^

TypeError: callback is not a function
    at exports.Syslog.Syslog.log (/Users/perry.shuman/Code/temp/log_test/node_modules/winston-syslog/lib/winston-syslog.js:126:12)
    at exports.Syslog.TransportStream._write (/Users/perry.shuman/Code/temp/log_test/node_modules/winston-transport/index.js:88:17)
    at doWrite (_stream_writable.js:387:12)
    at writeOrBuffer (_stream_writable.js:373:5)
    at exports.Syslog.Writable.write (_stream_writable.js:290:11)
    at DerivedLogger.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:121:20)
    at DerivedLogger.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)

Which looks like winston-syslog isn't reading the level that's passed in as a valid level, since you shouldn't be able to get to line 126 without failing this conditional:

if (!~levels.indexOf(level)) {
    return callback(new Error('Cannot log unknown syslog level: ' + level));
}

TCP messages are being written to a single line in syslog

When you log multiple messages and have it setup to use TCP when syslog outputs it is in the same line.

To work around this issue we had to add a "\n" to the end of the message so syslog treats it as a separate log message.
e.g:

info('test 1');
info('test 2');

Will show up in syslog as:

2015-06-16T15:27:47-06:00 xxxxxxx xxxxxx[11917]: info: test1<174>Jun 16 15:27:47 xxxxxxxx xxxxxx[11917]: info: test2

Failed at the [email protected] install script 'node-gyp rebuild'

npm install winston-syslog

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.2.0-95-generic
gyp ERR! command "/usr/bin/iojs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/bookya_api/node_modules/winston-syslog/node_modules/unix-dgram
gyp ERR! node -v v3.1.0
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm ERR! Linux 3.2.0-95-generic
npm ERR! argv "/usr/bin/iojs" "/usr/bin/npm" "install" "winston-syslog"
npm ERR! node v3.1.0
npm ERR! npm  v2.13.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the unix-dgram package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls unix-dgram
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/bookya_api/npm-debug.log

npm-debug.txt

rsyslogd filters based on $programname

This rule is never successfully matched because winston-syslog does not produce a valid format that can be filtered by program name:

/etc/rsyslog.d/01-app.conf

if $programname == 'app' then {
    action(type="omfile" file="/var/log/app.log")
    ~ stop
}

Here is an example log message showing up in /var/log/syslog that is not being properly filtered. Note the extraneous localhost. I am pretty sure that this is what is screwing things up.

Jan  3 19:54:29 tegra-ubuntu localhost app[30934]: info: interface-proxy.js: Updating the interface proxy

Error: send 111

I'm getting an obscure "send 111" error when trying to log using the unix protocol. Any ideas? The node-syslog package works fine, as does using logger at the command line.

var winston = require('winston');
require('winston-syslog').Syslog;
winston.add(winston.transports.Syslog, {protocol:'unix',path:'/dev/log'});
winston.debug('hi')
debug: hi
Error: send 111
  at errnoException (/home/gwarner/winston-syslog/node_modules/unix-dgram/src/unix_dgram.js:25:11)
  at Socket.send (/home/gwarner/winston-syslog/node_modules/unix-dgram/src/unix_dgram.js:75:24)
  at /home/gwarner/winston-syslog/lib/winston-syslog.js:158:21
  at [object Object].Syslog.connect (/home/gwarner/winston-syslog/lib/winston-syslog.js:200:9)
  at [object Object].Syslog.log (/home/gwarner/winston-syslog/lib/winston-syslog.js:131:8)
  at [object Object].Logger.log (/home/gwarner/winston-syslog/node_modules/winston/lib/winston/logger.js:182:17)
  at Object.winston.(anonymous function) [as log] (/home/gwarner/winston-syslog/node_modules/winston/lib/winston.js:82:34)
  at Object.target.(anonymous function) [as debug] (/home/gwarner/winston-syslog/node_modules/winston/lib/winston/common.js:44:21)
  at repl:1:13
  at REPLServer.replDefaults.eval (/usr/lib/node_modules/coffee-script/lib/coffee-script/repl.js:33:42)
  at repl.js:239:12
  at Interface.<anonymous> (/usr/lib/node_modules/coffee-script/lib/coffee-script/repl.js:64:9)
  at Interface.emit (events.js:117:20)
  at Interface._onLine (readline.js:202:10)
  at Interface._line (readline.js:531:8)
  at Interface._ttyWrite (readline.js:760:14)
  at ReadStream.onkeypress (readline.js:99:10)
  at ReadStream.emit (events.js:117:20)
  at emitKey (readline.js:1095:12)
  at ReadStream.onData (readline.js:840:14)
  at ReadStream.emit (events.js:95:17)
  at ReadStream.<anonymous> (_stream_readable.js:748:14)
  at ReadStream.emit (events.js:92:17)
  at emitReadable_ (_stream_readable.js:410:10)
  at emitReadable (_stream_readable.js:406:5)
  at readableAddChunk (_stream_readable.js:168:9)
  at ReadStream.Readable.push (_stream_readable.js:130:10)
  at TTY.onread (net.js:528:21)

Options for Type of Syslog Protocol

The documentation and the comments in code mention that the library is compliant with RFC 3164 and RFC 5424. The default value for type in options is 'BSD' which corresponds to RFC 3164 Protocol. What is the value for options.type corresponding to RFC 5424.

Node 6.11 net.Socket - Needs socket.unref() etc

I don't know whether this still applies to modern Node, but for obscure reasons I'm using 6.11, and winston-syslog when using TCP needs a process.on('exit', ...) handler (I think in connect()) that performs ...

if (!this.isDgram) {
  this.socket.unref();
  this.socket.end();
  this.socket.destroy();
}

... otherwise the server side doesn't tear down its side of the TCP connection, and the number of "established" connections showing from the client side increases until such point as the syslog service (or the kernel or something) blocks that client. Effectively, you can DoS yourself if you have lots of short-running Node apps that do syslog over TCP.

Expose winston's timestamp option

The library does not expose winston's timestamp option yet. I had a recent failure and realized I couldn't provide a time for my logs.

Setting appName as empty or null value to make JSON

Hi, I would like to log message with JSON line format.

Not like

appName: [pid] {"JSON": "FORMAT"}

But

{"JSON": "FORMAT"}

I read the doc and the code, and if appName is not specified, process.title is used.
https://github.com/squeeks/glossy skips setting appName and pid if appName is falsy value.

The line

this.appName   = options.appName   || options.app_name  || process.title;

sets process.title if appName or app_name is set. I need to set process.title , but not for logging. Can you change the line or any options not to set appName .

If you need PR. I will PR, but can you give me idea to fix this?

GlossyProducer generateBSDDate problem with days < 10

My problem is that in GlossyProducer, the generateBSDDate function creates a date like this:
'Aug 4 14:21:20 '
So the day is padded correctly with leading space. This is the format what syslog-ng can parse, BUT this code, wich joins the message array into the message string, cut that leading space from it and ruins the parseable format:
var compiledMessage = msgData.join(' ').replace(/\s+/g, ' ');

Pls produce a fix for that issue.

Thanks in advance!

multiple log messages to udp4 causes errors

When hooked into winston as follows:
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Syslog)({host:"localhost",port:514,protocol:"udp4"})
]
});

Then only the first log item is logged. Thereafter, the "this.connect()" function always has an error, it seems like its trying to reconnect to an existing connection. For a potentially bad workaround, I currently have
"return self.queue.push(syslogMsg)" commented out, and all my logs end up in syslog via UDP. UDP does have a fire-and-forget type strategy anyway.

Error trying to use 2.0.0

I get the following error trying to use 2.0.0 with the README.md instructions. Either the instructions need to be updated or there is a syntax error in the new release:

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/deathstar/node/modules/logger.js:4:16)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Error is happening as a result of the require:

  1 'use strict';
  2 
  3 const winston = require('winston');
  4 require('winston-syslog').Syslog;
  5 

Default to system default path when using "protocol": "unix"

When logging via unix datagram sockets, you have to specify a path to write the logs to. It would be a great advantage if the library could find the system default syslog pipe by default.

Per my cursory investigation, this seems to be /dev/log in Linux, /var/run/log in BSD and /var/run/syslog in OSX. I would hope there is a reliable way to determine this at runtime.

TLS connection support

Do you have any plans to add support for TLS connection to remote syslog servers?

We need this for a high compliance environment where all logging is secured.

Winston logs to all files.

This is my winston config:

var winston = require('winston');
var fs = require('fs');
var _ = require('lodash');

winston.emitErrs = true;

var logDir = 'logs';
if (!fs.existsSync(logDir)) {
    fs.mkdirSync(logDir);
}

//add custom logging levels
var levels = _.clone(winston.config.syslog.levels);
var colors = _.clone(winston.config.syslog.colors);

levels.request = _.max(levels) + 1;
colors.request = 'blue';

var logger = new winston.Logger({
    levels: levels,
    colors: colors,
    exceptionHandlers: [
        new winston.transports.File({filename: 'logs/exceptions.log'})
    ],
    transports: [
        new winston.transports.File({
            name: 'info-file',
            level: 'info',
            filename: 'logs/all-logs.log',
            json: true,
            maxsize: 5242880, //5MB
            maxFiles: 5,
            colorize: false
        }),
        new winston.transports.File({
            name: 'error-file',
            level: 'error',
            filename: 'logs/error-logs.log',
            json: true,
            maxsize: 5242880, //5MB
            maxFiles: 5,
            colorize: false
        }),
        new winston.transports.File({
            name: 'request-file',
            level: 'request',
            filename: 'logs/requests.log',
            json: true,
            maxsize: 5242880, //5MB
            maxFiles: 5,
            colorize: false
        })
    ],
    exitOnError: false
});

module.exports = logger;

I'm trying to log, errors, http-requests, and exceptions to their own files.
However, I see, for example, in error-logs.log (http)requests logs.

Can anybody explain to me what I'm doing wrong?

Closing socket connection

Any way to close the socket connection?

Its possible to open a new connection and closing it every message is delivered?

app_name is being ignored and replaced by process title

Since 1.2.2 the option app_name does not work anymore and is being replaced by process title. We are reverting to 1.2.1 for now.

our code snippet to reproduce the error

var winston = require('winston');
var os = require('os');
require('winston-syslog').Syslog;
var logger = new(winston.Logger)({
    transports: [
        new winston.transports.Syslog({
            host: 'someHost',
            protocol: 'udp4',
            localhost: os.hostname(),
            app_name: 'thisWillBeIgnored'
        })
    ]
});

Is configuration of the syslog daemon really necessary?

According to the documentation (https://github.com/indexzero/winston-syslog#syslog-configuration), I have to configure my syslog daemon to accept TCP connections in order to use winston-syslog.

However, when logging to syslog in C programs, I can use the openlog and syslog functions without any such setup.

I would very much like it if it were possible to use winston-syslog without the configuration step. I am willing and able to put in work to do this, but I don't know quite where to start. I guess I could make a binding to the native openlog and syslog functions, but that seems like a ridiculous way to go.

Any further guidance would be greatly appreciated :)

winston.setLevels is now depricated in 3.0

Per the Breaking Changes list for Winston 3.0, the

winston.setLevels(winston.config.syslog.levels);

line from the setup instructions will no longer work. Is there a workaround for this?

npm release

Can you publish a new release to NPM? There appears to be a few issues resolved since the last release.

Issues with Node v0.12.0

I am having the following error after upgrading to node v0.12.0

/usr/local/bin/node web/server.js
/mypath/node_modules/winston-syslog/node_modules/unix-dgram/node_modules/bindings/bindings.js:83
throw e
^
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/mypath/node_modules/winston-syslog/node_modules/unix-dgram/node_modules/bindings/bindings.js:76:44)
at Object. (/mypath/node_modules/winston-syslog/node_modules/unix-dgram/lib/unix_dgram.js:4:34)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)

Process finished with exit code 1

New release?

I'd love to use the fix introduced by #40 but the current NPM version is far behind what is in master. Could we get a new release on NPM?

Errors when closing logger with syslog transport

When I call .close() on a logger with a syslog transport the following error is thrown:

failed to close logger TypeError: self.socket.close is not a function
    at _close (/Users/bart/Documents/Temp/fromMUGit/moodle-integration-33/node_modules/winston-syslog/lib/winston-syslog.js:227:21)
    at exports.Syslog.Syslog.close (/Users/bart/Documents/Temp/fromMUGit/moodle-integration-33/node_modules/winston-syslog/lib/winston-syslog.js:236:4)
    at /Users/bart/Documents/Temp/fromMUGit/moodle-integration-33/node_modules/winston/lib/winston/logger.js:405:17
    at Array.forEach (native)
    at exports.Logger.Logger.close (/Users/bart/Documents/Temp/fromMUGit/moodle-integration-33/node_modules/winston/lib/winston/logger.js:402:15)
...

Reason we don't send log content through Common.log?

When we call Syslog.prototype.log, is there a reason we don't send the msg, meta, and level through the Common.log function? That would allow us to just accept a lot more formatting options, such as json, colorize, prettyPrint, etc.

OSX: Nothing seems to get logged (Console app)

I recently posted this question to StackOverflow but I am hoping for a faster response here.

In short I don't see anything logged into the Console app on OSX.

const winston = require('winston');
require('winston-syslog').Syslog; // eslint-disable-line

const env = process.env.NODE_ENV;
let syslogConfig = {
    "host": "localhost",
    "port": 514,
    "protocol": "unix",
    "path": "/var/run/syslog"
};

const logger = new winston.Logger({
    levels: winston.config.syslog.levels,
    colors: winston.config.syslog.colors
});

logger.add(winston.transports.Syslog, syslogConfig);

logger.add(winston.transports.Console, {
    json: false,
    colorize: true,
    timestamp: true
});

// this should be logged and visible from Console app...
logger.error('Hello, world!');

module.exports = logger;

Are my configuration settings somehow incorrect? I get no errors in my terminal.

  • Node v6.9.1
  • NPM v5.4.2
  • winston v2.4.0
  • winston-syslog v2.0.0
  • OSX v10.12.6 (Sierra)

Latest 2.0.0 release does not work correctly with the README instructions

I get the following error trying to use 2.0.0 with the README.md instructions. Either the instructions need to be updated or there is a syntax error in the new release:

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/deathstar/node/modules/logger.js:4:16)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Error is happening as a result of the require:

  1 'use strict';
  2 
  3 const winston = require('winston');
  4 require('winston-syslog').Syslog;
  5 

should try/catch on JSON.stringify

Currently if meta has circular references, logging breaks with some nasty infinite recursion. I think this is probably worth fixing at least for the fact that logging shouldn't bring down an application, no matter how dumb the developer was for passing in a self-referencing object (and yes, I was that dumb).

I'd just do something like this at the top of Syslog.prototype.log():

if (meta){
try {
meta = JSON.stringify(data);
} catch(ex){
meta = " NOTE: Could not stringify meta: " + JSON.stringify(ex);
}
}

...but you might have a smarter way. It seems like the problem could manifest in winston.clone(), so you might want to fix this in winston itself instead, but this fix makes the otherwise unsafe stringify() on 119 safe too.

Permission Denied error during port binding.

Hi,
I was trying to use the syslog plugin with the winston logger. When i tried to initialize with default parameters, it tries to connect to the udp port 514.

Here i get a Permission denied exception. When i run the node server with sudo mode, it doesn't throw an error, but the connection doesn't get established, so all my messages are queued in the buffer.

I am doing this in my mac. Is there some thing i should be doing which i am missing.

I tried using unix_dgram protocol , but you don't have a option to specify the pid file name in the option list, which is required by the dgram library of node.

Thanks.

Unix socket throws error when buffer is full

When winston-syslog attempts to write to a unix socket, if buffer is full, the socket operation will block. When the socket is in non-blocking mode, this results in the socket write operation throwing a EAGAIN error:

Error: send -11
    at errnoException (node_modules/unix-dgram/lib/unix_dgram.js:18:11)
    at Socket.send (node_modules/unix-dgram/lib/unix_dgram.js:93:24)
    at node_modules/winston-syslog/lib/winston-syslog.js:191:21
    at Syslog.connect (node_modules/winston-syslog/lib/winston-syslog.js:253:9)
    at Syslog.log (node_modules/winston-syslog/lib/winston-syslog.js:157:8)
    at transportLog (node_modules/winston/lib/winston/logger.js:228:15)
    at node_modules/async/lib/async.js:157:13
    at _each (node_modules/async/lib/async.js:57:9)
    at Object.async.each (node_modules/async/lib/async.js:156:9)
    at Logger.log (node_modules/winston/lib/winston/logger.js:240:9)

The culprit is line winston-syslog.js:191:

    //
    // Write to the `tcp*`, `udp*`, or `unix` socket.
    //
    if (self.isDgram) {
      buffer = new Buffer(syslogMsg);

      if (self.protocolType === 'udp') {
        self.inFlight++;
        self.socket.send(buffer, 0, buffer.length, self.port, self.host, onError);
      }
      else if (self.protocol === 'unix') {
        self.socket.send(buffer, 0, buffer.length, self.path, onError);
      }

That line should probably be wrapped in a try/catch block:

When the message does not fit into the send buffer of the socket, send normally blocks, unless the socket has been placed in non-blocking I/O mode. In non-blocking mode it would return EAGAIN in this case. The select(2) call may be used to determine when it is possible to send more data.

Unnecessary mandatory option.localhost

Hi all, i think that option in Subj should not be a mandatory because local syslog daemon already will set hostname if you send to /dev/log unix domain. if you send messages to remote server it also can determinate name of server by it's ip or log just IP, but since localhost option is mandatory Syslog message is misconfigured, because it have additional tag into syslog event. Maybe for many of users it is not a problem, but i found it not handy because i should :

  1. Maintain copy of plugin myself
  2. i should write additional parsers to catch what i want from malformed syslog event.

i think it is best to have possibility to set option.localhost to false or null to skip this tag in a syslog event.

custom format for syslog

Hi there, I found your extension useful for my project. One thing I am missing is an ability to provide custom formatter for Syslog message format. What I need is a consistent format with python implementation from here.

Exmple:

<prival>appName: message

It would be great to have an ability to specify custom Syslog formatting function through the options. What do you think?

Fails install without build-essential g++

npm install winston-syslog --save

[email protected] install /myProj/node_modules/winston-syslog/node_modules/unix-dgram
node-gyp rebuild

make: Entering directory /myProj/node_modules/winston-syslog/node_modules/unix-dgram/build' CXX(target) Release/obj.target/unix_dgram/src/unix_dgram.o make: g++: Command not found make: *** [Release/obj.target/unix_dgram/src/unix_dgram.o] Error 127 make: Leaving directory/myProj/node_modules/winston-syslog/node_modules/unix-dgram/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /myProj/node_modules/winston-syslog/node_modules/unix-dgram
gyp ERR! node -v v0.10.39
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the unix-dgram package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls unix-dgram
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "winston-syslog" "--save"
npm ERR! cwd /myProj
npm ERR! node -v v0.10.39
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Needed sudo apt-get install build-essential g++ in order to install node module.

Accept alternative syslog level names

Syslog has the following log level names:

  • "emerg" (also "panic")
  • "alert"
  • "crit"
  • "err" (also "error")
  • "warning" (also "warn")
  • "notice"
  • "info"
  • "debug"

Currently, this transport will not recognize using the names "warn", "err", and "panic". I know it is trying to just have parity with the log levels defined in the winston.config.syslog.levels object, but I already think that is kind of messed up because that object picks and chooses which log level names to use. For example, it uses "error" instead of "err" but uses the default level names for the rest of the levels.

I think it would be nice for the syslog transport module to allow all of the names above. Of course, the decision is up to the repository maintainers. It doesn't look like we actually use the numerical values corresponding to log level keywords, so the extra keywords could probably just be added in.

Like:

var levels = Object.keys({
  debug: 0,
  info: 1,
  notice: 2,
  warning: 3,
  warn: 3,
  err: 4,
  error: 4,
  crit: 5,
  alert: 6,
  emerg: 7,
  panic: 7
});

Add support for Node 4 and 5

Currently winston-syslog uses a not compatible unix-dgram (0.2.1) module, which makes winston not work on Node 4 and 5.

Errors with stack traces

Hi,
I'm using winston with console and syslog transports. While errors on console are shown with stack traces like:

error:  Error: dummy error
    at expressApp.use (/Users/someuser/Psomeporject/server/server.js:78:12)
    at Layer.handle [as handle_request] (/Users/someuser/Psomeporject/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/someuser/Psomeporject/node_modules/express/lib/router/index.js:317:13)
    at /Users/someuser/Psomeporject/node_modules/express/lib/router/index.js:284:7
   ...

Our syslog server is configured to store error leveled messages in an error file, the problem is with the previous error only the first line is stored in the error file, while the rest of the info is written in an accesslog file.

Any help will be appreciated. Thanks.

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.