1.1.2 • Published 2 years ago

winston-logstash-transporter v1.1.2

Weekly downloads
25
License
MIT
Repository
github
Last release
2 years ago

winston-logstash-transporter

Writes logs to logstash using UDP, or to console for development environment.

In production or staging, logstash can be switched with a file based logging that rotates files based on the following rules:

https://github.com/winstonjs/winston-daily-rotate-file

  • default directory: /var/log/<process.env.APPLICATION_NAME>

  • filename format: default-%DATE%.log

  • maxFileSize: 20mb

  • Maximum time to keep log files: 7 days

Fixes winston issue for logging Javascript error object https://github.com/winstonjs/winston/issues/1338

Example

const logger = require('winston-logstash-transporter')(__filename);

logger.info({
  message: 'Some message here',
  data,
  functionName: 'blah'
});

logger.debug({
  message: 'Some message here',
  data: {
    blah: 'blah'
  }
});

logger.error({
  message: 'Some message here',
  error
});

Environment Variables

  • LOG_LEVEL = error | warn | info | http | verbose | debug | silly [default = debug]

  • NODE_ENV = development | staging | production [default = development]

  • SEND_TO_LOGSTASH = true | false [default = false] //sends to logstash server in <LOGSTASH_SERVER_IP>

  • SEND_TO_FILE = true | false [default = !SEND_TO_LOGSTASH] //sends logs to /var/log/<APPLICATION_NAME>/application_log/

  • SEND_TO_STDOUT = true | false [default = true for development, false for production] //prints to standard output (console).

  • APPLICATION_NAME = your_app_name

  • LOGSTASH_SERVER_IP = xxx.xxx.xxx.xxx

  • LOGSTASH_PORT = xxxx

  • HOST_NAME = host_name

1.1.2

2 years ago

1.1.1

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago