-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
my script ends and i'm missing some messages on graylog #16
Comments
Doing this for now: setTimeout(function() { //sleep for graylog to get last messages
callback(null);
}, 10); |
How does your script finish? Do you call process.exit()? |
Hmm... not really sure. my code runs on AWS Lambda and I create a handler function which is then runned. Don't really now how they implemented it. If it helps function definition looks like this: exports.handler = function(event, context, callback) more docs: http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html |
Can you show me a more complete example of what you're running? |
I do think I understand the reason though. Our log functions don't have callback arguments, but they do asynchronous work. If you bail out (in your case, calling your callback which may kill a process in that tick) there are 2 things that won't have had a chance to complete: gzip compressing of your log message, UDP-send of your message. This is a fundamental issue in this module. We need to work on this. |
Well really nothing special. Here is my log.write function from log module:
and my main program function:
trough the rest of the code i just call log.write. |
There is no sync way to call functions that do UDP, but we need to allow callbacks to wait for gzipping and sending to complete (although iirc the callback on UDP sends is really a callback post-DNS-resolve). |
Hello, I have this exact issue on my code right now. I need to wait for the logs to finish processing, but my app exits before that. I see you are working on a new implementation. Is there any ETA? |
Hi,
When my script executes, few last messages are not pushed to graylog. i.e. last message "All done" is never delivered.
What can I do to fix this?
The text was updated successfully, but these errors were encountered: