Giter Site home page Giter Site logo

timegrep's Introduction

timegrep

Utility to grep log between two dates or tail last lines to time ago similar dategrep or dateutils.

Examples

Grep last minute from current nginx access log (binary search):

$ timegrep --format=nginx --minutes=1 /var/log/nginx/access.log

Grep datetime interval from archive log (sequential read data from stdin):

$ zcat archive.log.gz | timegrep --start='2017:09:01 15:23:00' --stop='2017:09:01 16:32:00'

Download / Install

$ git clone https://github.com/abbat/timegrep.git
$ make && sudo make install

Usage

timegrep [options] [files]

Options

  • --help, -? - print help message and named datetime formats;
  • --version, -v - print program version and exit;
  • --format, -e - datetime format (default: 'default');
  • --start, -f - datetime to start search (default: now);
  • --stop, -t - datetime to stop search (default: now);
  • --seconds, -s - seconds to substract from --start (default: 0);
  • --minutes, -m - minutes to substract from --start (default: 0);
  • --hours, -h - hours to substract from --start (default: 0).

See strptime(3) for format details. See --help for list of format aliases.

Exit code

  • 0 - successful completion;
  • 1 - nothing found;
  • 2 - general application error.

How to help

  • Translate this document or man page to your native language;
  • Proofreading README.md or man page with your native language;
  • Share, Like, RT to your friends;
  • Send PRs if you are developer.

timegrep's People

Contributors

abbat avatar

Watchers

James Cloos avatar arstercz avatar

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.