datalust / bunyan-seq Goto Github PK
View Code? Open in Web Editor NEWA Bunyan stream to send events to Seq
Home Page: https://datalust.co/seq
License: Apache License 2.0
A Bunyan stream to send events to Seq
Home Page: https://datalust.co/seq
License: Apache License 2.0
This issue has crashed my server and set me back a few hours.
The function you pass into onError
property of SeqConfig (createStream method argument) gets called on an error, but at the same time another error is being emitted by the SeqStream which is not handled.
To alleviate that, you need to setup your logger as follows:
const streams = []
const seqStream = bunyanSeq.createStream({
serverUrl: 'http://X.Y.Z.W',
level: 'info',
apiKey: 'ABCDE',
onError: (e: Error) => {
console.trace('Logging failed:', e);
}
})
seqStream.stream.on('error', (e) => console.trace('Now this is what I call error!',e)) // This is the important line
streams.push(seqStream)
let log: any = bunyan.createLogger({
name: 'myAwesomeLogger',
streams: streams
})
If you don't do that, any error that arises from stream misconfiguration or (as happened to me) from an outage of the logging server, will crash your app.
Hi,
Is there any chance to have the published packages be in ES5 instead of ES6?
The reason being that UglifyJs doesn't support ES6 yet, and being in a TS project we find bringing in Babel just to compile a dependency a bit too much.
Thanks
Currently, batches of log events that cannot be sent to Seq for any reason will be dropped.
If the returned status code from the HTTP request indicates that the server is down (0) or unavailable (503) then some number of retries should be attempted.
I get a TS build error with index.d.ts file in library. "npm run build" command
"index.d.ts:11:12 - error TS2503: Cannot find namespace 'config'."
"level: config.level;"
I resolved by adding a "// @ts-nocheck" at the top of file. Do you have or working on a better solution? Can you add this temp fix to library in Git?
Hi Nick
I've pushed some typescript definitions to DefinitelyTyped (as this repo is JS, not TS). Not really an issue, but informing you. If you'd like me to do anything or change anything, please let me know
Seq stream mutates event object thus event object cannot be used in following streams because it is missing required data.
File: bunyan-seq/seq_stream.js
Lines: 49-52
I suppose these lines must be removed. Is there any good reason to delete these properties?
Reproduce:
var log = bunyan.createLogger({
name: 'myapp',
streams: [
seq.createStream({
serverUrl: 'http://localhost:5341',
level: 'info'
}),
{
stream: process.stdout,
level: 'warn',
}
]
});
log.info('Hi!');
This does not log msg: "Hi" to stdout
Hi there
We're using bunyan and bunyan-seq in an electron renderer process (a Chromium browser window). Since this is electron, we are able to access node APIs. However, to reduce bundle sizes, we are Ugilfying.
However, we're tripped up in this library as it, and rightfully so, uses ES6 constructs like let
. This means that UgilfyJS doesn't work as it doesn't support ES6 yet.
I was wondering if anyone had some ideas, I'm not convinced this library should change because of other tool's deficiencies.
If for any reason an error occurs while shipping, all logging stops happening. This is because bunyan-seq, when constructing the logger, emits an 'error' event on the EventEmitter. If there are no subscribers to this by default, it just throws. Which stops everything else working.
loggerConfig.onError = (e) => {
this.emit('error', e);
onError(e);
};
Hi there
I've configured bunyan with three stream. A console stream, a file stream and a bunyan-seq stream. I'm seeing the console logs and the file stream log, but nothing is being logged to seq.
Nothing is being logged to the console for the onError handler, and no traffic is leaving the client (verified with Wireshark). What else can I do to debug this issue?
sample config:
seq.createStream({
serverUrl: 'http://seq:5432',
apiKey: 'APIKEY,
level: 'debug'
});
When using the createStream
method within Bunyan you get the error written above. Return type of the method should be Stream
.
If you have a fork or local clone from before 17 June 2020, you will need to run the following commands to update your forked/cloned repo.
git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
//if fork: git push -u origin main
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
You will also need to change your default branch in GitHub settings
And, finally, delete master
in /branches
:
When depending on this package, it seems to be pulling in npm
since it's listed as a dependency. It was added in commit dbc2241.
If it really is needed for the mocha
package, then it should be in the devDependencies
section. That way it won't be pulled in on packages that are just using bunyan-seq
.
Moving discussion from a closed PR to here.
Thanks @tjrobinson for pointing out that flush()
is no longer accessible, and that is causing issues to developers relying on that function and making them unable to upgrade.
This issue is to document an investigation into what it was used for, and whether or not it should be put back, or if we roll forward.
I have a background service that runs forever in a loop, while sleeping for x (10-20) seconds while there is nothing to be processed.
When logging something on each iteration, after some minutes (sometimes after seconds, depending on the sleep time), i get the warning:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 timeout listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
The warning does not appear when removing the seq stream and just using a local debug stream for example.
My question is, is this known/intended, or am I using something incorrectly?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.