Skip to content
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

When logstash is down, and goes back up, stream never reconnects #7

Open
winaterion opened this issue Oct 24, 2019 · 0 comments
Open

Comments

@winaterion
Copy link

winaterion commented Oct 24, 2019

Hi,
I'm using latest stable version of bunyan 1.8.12 and bunyan-logstash-tcp ^0.3.5

I bring down logstash when the app is running, then, the logstash stream try to connect using retries.
I wait about 10 seconds, and then bring back logstash again.
the stream will no longer be available, or try to reconnect to logstash.
Any idea if there is a solution for that? I can only see 2 solutions:

  1. restart the server (very bad)
  2. keep track on logstash myself, and also keep track on all of my loggers and reconfigure them to use the stream again. (note I also write to file, and it still works because it's unrelated to logstash).

here is my stream initialization (without the file stream which is obvious):

const  logger = bunyan.createLogger({
            name: category,
            streams: [
            {
                name: 'logstash_stream',
                level: 'debug',
                type: "raw",
                reemitErrorEvents: true,
                stream: bunyantcp.createStream({
                    host: options.logstashHost ? options.logstashHost : 'localhost',
                    port: options.logstashPort ? options.logstashPort : 5400,
                }),
            },
        ],
        });
        logger.on('error', function (err, stream) {
            console.log("ho no, logstash probably down again...");
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant