ass6
ass6

Reputation: 21

Logger for a nodejs server application

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.

Upvotes: 2

Views: 86

Answers (2)

Keivan
Keivan

Reputation: 483

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

Upvotes: 1

Brad
Brad

Reputation: 163548

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.

Upvotes: 1

Related Questions