question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

writing to elastic isnt working

See original GitHub issue

Hi, i would like to send my pino logs to elastic, we are using elastic 6 version with latest version of pino and pino-elastic and when i config the below for pino :

let pino = require('pino'),
    pinoElastic = require('pino-elasticsearch');

const streamToElastic = pinoElastic({
    index: `log-test-%{DATE}`,
    type: 'info',
    consistency: 'one',
    node: 'http://myuser:mypass@localhost:9200',
    'trace-level': 'info',
    'es-version': 6,
    'bulk-size': 1,
    ecs: true
});

and then

const logger = pino(pinoOptions, streamToElastic);
logger.info('test');

the app is running ok, but no logs is printed to console and no logs sent to elastic with no errors at all, am i missing something?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
JoHuangcommented, Jun 8, 2020

I found if I write more logs, it sends some of the logs. So I think it’s might be cause of the flushBytes.

If I set flushBytes to 10, all logs appears.

This might be an issue that the last few logs can not be flushed before node.js app terminated.

0reactions
delvedorcommented, Jun 9, 2020

If you run the main process and pipe this transport, it works automatically, as the stream from the main process and the transport ends.

node example.js | ./cli.js

If you pass this library directly to the pino options, and then kill the process, there is no guarantee that all the logs will be sent, as the process will be destroyed. As I was saying the next version will support a flush interval. We can also think about a force flush method.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elasticsearch not writing to logs on start - Elastic Discuss
I've been trying to trouble shoot an issue with my single ES node. issue was due to ES logs taking up space on...
Read more >
Error writing to Elasticsearch, some elements could not be ...
It means that you overwhelmed the request queue. Your queue was full and the nodes just started to ignore the new requests.
Read more >
Caching strategies - Amazon ElastiCache - AWS Documentation
Lazy loadingWrite-throughAdding TTLRelated topics ... A cache hit occurs when data is in the cache and isn't expired: Your application requests data from ......
Read more >
How To Install and Configure Elasticsearch on Ubuntu 22.04
Note: Elasticsearch's configuration file is in YAML format, which means that we need to maintain the indentation format. Be sure that you do...
Read more >
Elastic-Cloud Not Receiving Data from Serilog Sink - Reddit
Not sure it is in the docs, it's more of a common sense thing - you just need to know that if you're...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found