Comments (5)
Nice find. Might want to take a closer look at the events winston listens to. I'll come back at you, but you're welcome to submit a solution if you find one :)
from winston-loki.
It is a bit weird though, if the logged
event firing is the culprit. The index.js
structure is based on https://github.com/winstonjs/winston/blob/bc6a363ec9164d03f266cab7c918d92208d2ec73/examples/custom-transport.js, that's why the logged event gets fired before the transport. Are you using batching or sending out logs as they come? Does changing that option change things?
from winston-loki.
#51 might have fixed this?
from winston-loki.
Hi, We see this issue where the logs are not completely shipped.
For reference here is the setup.
logger = winston.createLogger({
level,
transports: [
new LokiTransport({
host: lokiHost,
batching: false,
format: json(),
onConnectionError: (err) => console.error(err),
}),
]
});
export default logger;
Usage in lambda
import log from "logger";
export const handler = async (event: S3ObjectEvent) => {
log.info("Received S3 Notification event");
// And other log events
}
We have noticed that not all the log statements are being sent, especially the ones at the end. We think this happens because the handler shuts down after the response.
Version info
"node_modules/winston-loki": {
"version": "6.0.6",
"resolved": "https://registry.npmjs.org/winston-loki/-/winston-loki-6.0.6.tgz",
...
from winston-loki.
I'm encountering this issue as well. I'm using this for scripts run by ts-node, so my workaround has been to wait for 5 seconds at the end of the script before process.exit(0)
. I'm not sure what to do for an API endpoint for instance yet. I see there are some options to pass in to the LokiTransport
constructor like timeout
and gracefulShutdown
, as well as flush()
available from the class, but I've not tested a combo that solves this issue.
from winston-loki.
Related Issues (20)
- use Symbol.for('level') when extracting label HOT 1
- useCustomFormat is broken
- Race condition in batching leading to lost logs HOT 1
- QUESTION: How many log levels are supported? HOT 2
- Feature Request: awaitable finishRequests method
- TypeError: winston_loki_1.default is not a constructor HOT 2
- Remote Loki HOT 1
- Possible to quit the batcher loop ASAP when closing? HOT 1
- [patch] A method to wait until all the logs are physically sent to winston HOT 3
- Docs: Add a section to explain how to make it work with nextjs and/or webpack HOT 5
- Snappy optionalDependency upgrade breaks build HOT 2
- CVE-2023-36665 protobufjs Dependency HOT 3
- Childlogger with additional labels
- NodeJS crash when batching is enabled
- Segmentation fault with swc & vitest in github action ubuntu-latest when using version 6.0.7
- Documentation improvement ideas
- logfmt syntax error with Grafana cloud
- push log to grafana cloud having logs lost
- Module parse failed error on Next.js 14 HOT 2
- Add support for structured metadata HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winston-loki.