1.0.4 • Published 4 years ago

@caal-15/winston3-logstash-transport v1.0.4

Weekly downloads
14
License
MIT
Repository
github
Last release
4 years ago

winston3-logstash-transport

A winston@3 transport for LogStash.

This winston transport has been rewritten from both winston-logastah and winston-logstash-udp to use the new Transport behavior from winston@3.

Where possible, this has been updated to mimic the behaviors of the original modules. There are some changes that have been made to allow the transport to handle either TCP or UDP connections to LogStash, instead of being dedicated to a single transport-layer protocol.

Usage

const Winston = require('winston');
const WinstonLogStash = require('winston3-logstash-transport');

const logger = Winston.createLogger();

logger.add(new WinstonLogStash({
  mode: 'udp',
  host: '127.0.0.1',
  port: 28777
}));

logger.error('Some Error');

API

constructor(options)

Create a new Logstash Transport

options

NameTypeDescriptionValid ValuesDefaultTCPUDP
modestringThe protocol to use to connect to LogStash. tcp is an alias for tcp4 and udp is an alias for udp4.udp udp4 udp6 tcp tcp4 tcp6'udp4'✔️✔️
localhoststringThe hostname sent to LogStashAnyos.hostname✔️✔️
hoststringThe LogStash server ip or hostnameAny valid IP or host address127.0.0.1 (ip4)::0 (ip6)✔️✔️
portintegerThe LogStash server port numberAny integer28777✔️✔️
applicationNamestringThe application name sent to LogStashAnyprocess.title✔️✔️
pidstringThe Operating System process ID for this processAny valid PIDprocess.pid✔️✔️
silentbooleanOffline/Silent mode enabledfalse✔️✔️
maxConnectRetriesintegerThe number of attempts to reconnect to make before erroring outAny integer4✔️✔️
timeoutConnectRetriesintegerThe number of milliseconds to wait between connection attemptsAny integer100✔️✔️
labelstringThe LogStash label to send with the informationAnyprocess.title✔️✔️
sslEnablebooleanWhether SSL/TLS connection should be attempted when connecting via TCPfalse✔️
sslKeyfilepathThe filepath to the SSL KeyAny valid filepath''✔️
sslCertfilepathThe filepath to the SSL CertAny valid filepath''✔️
sslCAfilepath or Array(filepaths)The filepath(s) to the Certificat Authority (CA) Intermediary CertsAny valid filepath(s)''✔️
sslPassPhrasestringThe SSL Cert PassPhrase (if any)Any''✔️
rejectUnauthorizedbooleanEnable connection rejection when cert is not validfalse✔️
trailingLineFeedbooleanEnable appending end of line character to UDP outputfalse✔️
trailingLineFeedCharstringThe type of end of line character(s) to append to UDP outputAnyos.EOL✔️
jsonbooleanUse if you are logging JSON objects and don't want their structure changedtrue/falsefalse✔️✔️

License

Copyright (c) 2018, 2019 Jay Reardon Copyright (c) 2019 Out of Sync Studios LLC -- Licensed under the MIT license.