Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@figma/winston-syslog
Advanced tools
A Syslog transport for winston.
$ curl http://npmjs.org/install.sh | sh
$ npm install winston
$ npm install winston-syslog
tldr;?
: To break the winston codebase into small modules that work together.
The winston codebase has been growing significantly with contributions and other logging transports. This is awesome. However, taking a ton of additional dependencies just to do something simple like logging to the Console and a File is overkill.
To use the Syslog transport in winston, you simply need to require it and then either add it to an existing winston logger or pass an instance to a new winston logger:
const winston = require('winston');
//
// Requiring `winston-syslog` will expose
// `winston.transports.Syslog`
//
require('winston-syslog').Syslog;
winston.add(new winston.transports.Syslog(options));
In addition to the options accepted by the syslog (compliant with RFC 3164 and RFC 5424), the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to false by default:
tcp4
, udp4
, unix
, unix-connect
, etc)./dev/log
or /var/run/syslog
for OS X).process.pid
).local0
).localhost
).BSD
, also valid: 5424
).process.title
).Metadata: Logged as string compiled by glossy.
By default, syslog messages are produced by glossy, but you can override that behavior by providing a custom Producer instance via the customProducer setting.
Because syslog only allows a subset of the levels available in winston, levels that do not match will be ignored. Therefore, in order to use winston-syslog
effectively, you should indicate to winston that you want to use the syslog levels:
const winston = require('winston');
const logger = winston.createLogger({
levels: winston.config.syslog.levels,
transports: [
new winston.transports.Syslog()
]
});
The Syslog
transport will only log to the level that are available in the syslog protocol. These are (in increasing order of severity):
You will have to configure your syslog server to accept TCP connections.
This is usually done in /etc/syslog-ng.conf
. Let's say you have an app called fnord
,
the configuration would look something like this:
source tcp_s {
tcp(ip(0.0.0.0) port(514) max-connections(256));
};
destination fnord_d {
file("/var/log/fnord.log");
};
log { source(tcp_s); destination(fnord_d); };
If you have multiple apps which need to log via TCP, you can specify filters, as such:
filter fnord_f { program("fnord"); };
Then modify the log statement to read:
log { source(tcp_s); filter(fnord_f); destination(fnord_d); };
Now if you have another app, called bnord
, create similar destination
and filter
configurations for it, and specify a new log statement, with the same source
:
log { source(tcp_s); filter(bnord_f); destination(bnord_d); };
For this to work, you have to make sure you set the process.title
variable in your node app.
process.title = 'fnord';
FAQs
A syslog transport for winston
We found that @figma/winston-syslog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.