Gathering detailed insights and metrics for winston3-logstash-transport
Gathering detailed insights and metrics for winston3-logstash-transport
Gathering detailed insights and metrics for winston3-logstash-transport
Gathering detailed insights and metrics for winston3-logstash-transport
A winston@3 replacement for winston-logstah and winston-logstash-udp
npm install winston3-logstash-transport
Typescript
Module System
Node Version
NPM Version
74.1
Supply Chain
100
Quality
74.7
Maintenance
100
Vulnerability
99.3
License
JavaScript (100%)
Total Downloads
469,956
Last Day
27
Last Week
1,465
Last Month
6,099
Last Year
103,351
MIT License
8 Stars
43 Commits
13 Forks
1 Watchers
11 Branches
1 Contributors
Updated on Jul 11, 2024
Minified
Minified + Gzipped
Latest Version
1.2.3
Package Id
winston3-logstash-transport@1.2.3
Unpacked Size
40.11 kB
Size
12.22 kB
File Count
18
NPM Version
6.14.11
Node Version
14.16.0
Cumulative downloads
Total Downloads
Last Day
237.5%
27
Compared to previous day
Last Week
-11.3%
1,465
Compared to previous week
Last Month
-7.6%
6,099
Compared to previous month
Last Year
-7.6%
103,351
Compared to previous year
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.
1const Winston = require('winston'); 2const WinstonLogStash = require('winston3-logstash-transport'); 3 4const logger = Winston.createLogger(); 5 6logger.add(new WinstonLogStash({ 7 mode: 'udp', 8 host: '127.0.0.1', 9 port: 28777 10})); 11 12logger.error('Some Error');
Create a new Logstash Transport
Name | Type | Description | Valid Values | Default | TCP | UDP |
---|---|---|---|---|---|---|
mode | string | The 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' | ✔️ | ✔️ |
localhost | string | The hostname sent to LogStash | Any | os.hostname | ✔️ | ✔️ |
host | string | The LogStash server ip or hostname | Any valid IP or host address | 127.0.0.1 (ip4)::0 (ip6) | ✔️ | ✔️ |
port | integer | The LogStash server port number | Any integer | 28777 | ✔️ | ✔️ |
applicationName | string | The application name sent to LogStash | Any | process.title | ✔️ | ✔️ |
pid | string | The Operating System process ID for this process | Any valid PID | process.pid | ✔️ | ✔️ |
silent | boolean | Offline/Silent mode enabled | false | ✔️ | ✔️ | |
maxConnectRetries | integer | The number of attempts to reconnect to make before erroring out | Any integer | 4 | ✔️ | ✔️ |
timeoutConnectRetries | integer | The number of milliseconds to wait between connection attempts | Any integer | 100 | ✔️ | ✔️ |
label | string | The LogStash label to send with the information | Any | process.title | ✔️ | ✔️ |
sslEnable | boolean | Whether SSL/TLS connection should be attempted when connecting via TCP | false | ✔️ | ||
sslKey | filepath | The filepath to the SSL Key | Any valid filepath | '' | ✔️ | |
sslCert | filepath | The filepath to the SSL Cert | Any valid filepath | '' | ✔️ | |
sslCA | filepath or Array(filepaths) | The filepath(s) to the Certificat Authority (CA) Intermediary Certs | Any valid filepath(s) | '' | ✔️ | |
sslPassPhrase | string | The SSL Cert PassPhrase (if any) | Any | '' | ✔️ | |
rejectUnauthorized | boolean | Enable connection rejection when cert is not valid | false | ✔️ | ||
trailingLineFeed | boolean | Enable appending end of line character to UDP output | false | ✔️ | ||
trailingLineFeedChar | string | The type of end of line character(s) to append to UDP output | Any | os.EOL | ✔️ | |
formatted | boolean | Enable/Disable delivery of standard pre-formatted JSON payloads. See Message Payloads for more info. | true | ✔️ | ✔️ |
By default or when options.formatted
is explicitly set true
, this module delivers a standard message payload to logstash as follows:
1{ 2 "timestamp": new Date().toISOString(), // The time the payload was created 3 "message": "", // JSON Stringified version of your message 4 "level": "", // The logger level of the message 5 "label": `${options.label}`, 6 "application": `${options.applicationName}`, 7 "serverName": `${options.localhost}`, 8 "pid": `${options.pid}` 9}
In this case when the log message is a string, boolean, or Number value, then the message is a stringified as:
1{ 2 "data": `${message}` 3}
If options.formatted
is set to false
, then the entire Winston log message object is JSON.stringified
and then set to logstash.
Having logstash ingest preformatted messages delivered by this module can be done with a configuration file similar to below:
1input { 2 # Sample input over TCP 3 tcp { 4 codec => json 5 port => 28777 6 add_field => { "category" => "winston_log" } 7 } 8} 9filter { 10 if [category] == "winston_log" { 11 json { 12 source => "message" 13 } 14 json { 15 source => "data" 16 remove_field => [ "[headers][secret]", "[headers][apikey]" ] 17 } 18 } 19} 20output { 21 if [category] == "winston_log" { 22 stdout { 23 codec => json 24 } 25 elasticsearch { 26 id => "winston_log_tcp" 27 index => "winston_log-%{+YYYY.MM.dd}" 28 hosts => ["192.168.1.1:9200"] # Use the address of your Elasticsearch server 29 } 30 } 31}
Copyright (c) 2018, 2019 Jay Reardon
Copyright (c) 2019-2021 Out of Sync Studios LLC -- Licensed under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
no SAST tool detected
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
43 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn Morewinston3-logstash-udp
A Logstash UDP transport for winston
winston3-logstash-transport-types
type definitions for winston3-logstash-transport
@caal-15/winston3-logstash-transport
A winston@3 replacement for both winston-logstash and winston-logstash-udp to facilitate either TCP or UDP traffic to logstash
@mistereo/winston3-logstash-transport
A winston@3 replacement for both winston-logstash and winston-logstash-udp to facilitate either TCP or UDP traffic to logstash