From f152b7f5d1205e9d3a4a9d924bb5f969dcbed0e7 Mon Sep 17 00:00:00 2001 From: David Brodski <129956+kammerjaeger@users.noreply.github.com> Date: Sun, 4 Jul 2021 05:54:19 -0400 Subject: [PATCH] Fix usage of steam, added logging of json errors (#88) --- cli.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli.js b/cli.js index 39c1405..b93aedf 100755 --- a/cli.js +++ b/cli.js @@ -35,6 +35,9 @@ function start (opts) { const stream = pinoElasticSearch(opts) + stream.on('unknown', (line, error) => { + console.error('Elasticsearch client json error in line:\n' + line + '\nError:', error) + }) stream.on('error', (error) => { console.error('Elasticsearch client error:', error) }) @@ -45,7 +48,7 @@ function start (opts) { if (opts.rejectUnauthorized) { opts.rejectUnauthorized = opts.rejectUnauthorized !== 'false' } - pump(process.stdin, pinoElasticSearch(opts)) + pump(process.stdin, stream) } const flags = minimist(process.argv.slice(2), {