Home > front end >  Best efficient way to store logs
Best efficient way to store logs

Time:10-17

I was thinking to store my node app's log in a database in an efficient way for future study. Can anyone suggest me easy to learn database that I can store my logs in it? I am expecting more than a thousand queries per hour. I am a bit concerned to use Mongo cause it's 16mb limit ber doc.

Is there any easy-to-learn database with drivers for node app?

CodePudding user response:

I would rather suggest that you look at something like elastic stack for logs. Using a database makes your logs opaque, unless you use some full text search feature of the DB. In short, log information is a different class of information to your application data, it has different persistance requirements, performance requirements etc. A relational, or non relational data store isn't the ideal place to keep log data.

Instead there are products like Elastic Search, Solr, InfluxDb etc that are designed to quickly store log info, process it and make it searchable. These products usually have a UI partner that allows you to make visualizations on top of your log data, so you can start to see the big picture. They also bring to the table he concept of "structured logging" which allows you to define some semantic data in your logs, making them even more useful.

There are probably plenty of structured loggers available for nodejs (such as winston) that integrate to elastic search and provide you with a ready API that will allow you to do powerful searches and aggregations on you log data. You could run elastic stack either hosted or via docker :

Elastic stack docker guide

Node js structured logging with winston to Elastic

CodePudding user response:

Hello again :) This is an answer to the question you asked in my first answer:

 Thanks. But I think they are more "search engine" rather than database...right            
  • Related