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.
logzio-nodejs
Advanced tools
A nodejs implementation for sending logs to Logz.IO cloud service Copy of logzio-nodejs
NodeJS logger for Logz.io. The logger stashes the log messages you send into an array which is sent as a bulk once it reaches its size limit (100 messages) or time limit (10 sec) in an async fashion. It contains a simple retry mechanism which upon connection reset (server side) or client timeout, wait a bit (default interval of 2 seconds), and try this bulk again. It does not block other messages from being accumulated and sent (async). The interval increases by a factor of 2 between each retry until it reaches the maximum allowed attempts (3).
By default, any error is logged to the console. This can be changed by supplying a callback function.
Nodejs
with version 14.x or abovevar logger = require('logzio-nodejs').createLogger({
token: '__YOUR_ACCOUNT_TOKEN__',
type: 'YourLogType' // OPTIONAL (If none is set, it will be 'nodejs')
});
// sending text
logger.log('This is a log message');
// sending an object
var obj = {
message: 'Some log message',
param1: 'val1',
param2: 'val2'
};
logger.log(obj);
Note: If logzio-js is used as part of a serverless service (AWS Lambda, Azure Functions, Google Cloud Functions, etc.), add logger.sendAndClose()
at the end of the run. For example sync Lambda and async Lambda
http
, https
or udp
. Default: http
listener.logz.io
udp
default port is 5050
, for http
is 8070
and 8071
is for https
2000
(2 sec)100
.3
false
callback()
callback(error)
where error
is the Error object.@timestamp_nano
Default: false
false
extraFields : { field_1: "val_1", field_2: "val_2" , ... }
.trace_id
, span_id
, service_name
fields to logs when opentelemetry context is available. Default: true
A few notes are worth mentioning regarding the use of the UDP protocol:
bufferSize
is slightly different in this case. The messages will still be sent separately, but the logger will wait for the buffer to reach the size specified before sending out all the messages. If you want each message to be sent out immediately, then set bufferSize = 1
.The callback
option allows you to handle errors and successful transmissions when logging messages. The callback function can be used to handle different scenarios such as logging errors or confirming successful log transmissions.
var logger = require('logzio-nodejs').createLogger({
token: '__YOUR_ACCOUNT_TOKEN__',
type: 'YourLogType',
callback: function(err) {
if (err) {
console.error('Error sending log:', err);
} else {
console.log('Log sent successfully');
}
}
});
// Sending a log message
logger.log('This is a log message');
_defaultCallback(err) {
if (err && !this.supressErrors) {
this.internalLogger.log(`logzio-logger error: ${err}`, err);
}
}
If you're sending traces with OpenTelemetry instrumentation (auto or manual), you can correlate your logs with the trace context. That way, your logs will have traces data in it, such as service name, span id and trace id (version >= 2.2.0
). This feature is enabled by default, To disable it, set the AddOtelContext
param in your handler configuration to false
, like in this example:
var logger = require('logzio-nodejs').createLogger({
token: 'token',
type: 'no-otel-context',
addOtelContext: false
});
git clone https://github.com/logzio/logzio-nodejs.git
cd logzio-nodejs
npm install
npm test
2.2.0
addOtelContext
configuration option:
trace_id
, span_id
, service_name
fields to logs when opentelemetry context is available.2.1.8
User-Agent
not optional and add the version to it.2.1.7
axios
to v1.6.4
(contributed by @gcagle3)2.1.6
14-20
axios
to v1.6.0
(contributed by @gcagle3)2.1.5
2.1.4
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.0.4 - 1.0.6
1.0.3
1.0.2
1.0.1
0.4.14
0.4.12
0.4.6
0.4.4
@timestamp
and @timestamp_nano
will no longer be overriden given a custom value by the user.0.4.3
@timestamp
field to the logs on the client's machine (and not when it reaches the server)0.4.1
request
dependency to 2.75.00.4.0
0.3.10
0.3.9
0.3.8
sendAndClose()
method which immediately sends the queued messages and clears the global timer0.3.6
0.3.5
0.3.4
jsonToString()
was throwing an error in the catch()block0.3.2
0.3.1
log
with a string parameter, the object isn't constructed properly.FAQs
A nodejs implementation for sending logs to Logz.IO cloud service Copy of logzio-nodejs
The npm package logzio-nodejs receives a total of 35,591 weekly downloads. As such, logzio-nodejs popularity was classified as popular.
We found that logzio-nodejs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.