Coder Social home page Coder Social logo

add filtering based on time about node-bunyan HOT 3 OPEN

trentm avatar trentm commented on August 21, 2024 1
add filtering based on time

from node-bunyan.

Comments (3)

trentm avatar trentm commented on August 21, 2024

Heh, I had these (in separate places) in my notes:

bunyan -s|--start 5m     # start 5 min ago
bunayn -s time=5m

The idea with the latter one is a more generic "start" option that would potentially eventually allow something like this:

bunyan -s req_id=$uuid

That would scan back through the log file(s) looking for the first record with that req_id field (with some max time/num-records/size back as a guard).

Anyway, that is vapourware, so ignoring.

your proposal

bunyan -t 5s
bunayn -t 5     # presumption is 5 *seconds*

What about this to get the last N lines:

bunyan -t 5l     # that's a lowercase "L"; last 5 *lines*

RobG recently added napictl lastlog to get the last N logs, so there is a valid use case there I think. And if we did add support for this, what about (a) the mnemonic is not "time", but "tail", and (b) the default would be lines. The "l" is weird as a suffix, so I'd just drop that.

bunyan --tail     # last 10 lines (where by "lines" I mean log records)
bunyan -t          # ditto
bunyan -t 5       # last 5 lines
bunyan -t 5s     # last 5 seconds
bunyan -t 5m    # last 5 minutes

Thoughts?

Also, your patch was clipped at 80 columns, cutting off some of your usage text. Can you resubmit that?

from node-bunyan.

chakrit avatar chakrit commented on August 21, 2024

FWIW I made this little utility for myself: https://github.com/chakrit/bunyan-reltime

from node-bunyan.

trentm avatar trentm commented on August 21, 2024

@chakrit Nice! Thanks for the note.

from node-bunyan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.