Logger for a nodejs server application

Viewed 32

I'm looking for a way to store console.log messages, and be able to access them fast and search through them by keyword fast.

currently im using a simple text file, but when the file becomes large there is some lag because i have to load the whole file in memory.

2 Answers

Take a look at Elastic Stack.

Basically, you dump your log data into an database (Elasticsearch) and query it with a tool (Kibana) that can display nice reports for you.

You can still keep a local rotating log file, in the event you lose your connectivity to Elasticsearch.

Use Winston. You can make custom transports (file, memory, console, network, etc) or put limits on file sizes and many other details.

Related