Search code examples
node.jsloggingwinston

Querying Winston Logs


I am using winston for logging in a node.js application.

I see there are options to query it.

The example shows how to use options from and to.

My question is

  1. What are the other options ?
  2. How do I specify what file should be queried ?

Solution

  • I ran into this same problem.

    At least some of the options can be found in Winston's transport.js in the function Transport.prototype.normalizeQuery.

    Here's a quick summary:

    options.rows, options.limit = how many results to return. default is 10;

    options.start = starting row offset. default is 0

    options.from = date string or date object for starting limit. default is now -24 hours

    options.until = date string or date object for ending limit. default is now

    options.order = either 'asc' or 'desc' order. default is 'desc'

    options.fields = which fields to return. default is undefined (which returns all)