Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Filtering/Querying Winston Logs by String or Level #367

rturumella opened this Issue · 4 comments

6 participants



It looks like the Winston loggly-like query options only supports filtering Winston logs by timestamp. Is there some way to filter the logs by level or only show entries that contain a certain string in the loggly-like method?

Trying to avoid using grep.



I also vote for it.

If we talk about file transport then filtering by timestamp is not really important because it's more reasonable to change filename according to the current date so we have a separate file for each date (particularly daily-rotate-file transport). If we talk about DB then again every DB provides reach possibilities for querying on its own.

As far as I understand the only way to filter output is using grep for now.


quick solution if file transport :

var shelljs = require('shelljs');
var results = shelljs.grep("1393601626926", "path/to/error.log");

+1, no grep on Windows :'(


So, what would be required to move this forward?

Looking at the Loggly API, I think that would be extremely complex to implement.

Shooting from the hip, would the the following be reasonable to start moving this forward?

For logs not stored in JSON format options.filter could be just a regex.

For logs stored in JSON format options.filter could be an object, where each property of the filter can correspond to a field name in the JSON. It could be a string (in which case an exact match is made), or a regex. Having more than one property would be considered a logical AND.

Is that reasonable? I don't think that would be particularly hard to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.