Giter Club home page Giter Club logo

logtop's Introduction

For copyright information, please see the file COPYRIGHT in this
directory or in the files of the source tree.

This project was initiated on 2010-06-29 by Palard Julien
See http://julien.palard.fr or ask me questions at :
julien at palard in fr

Compile dependencies :
    You will need :
    Package: libncurses5-dev
      Version: 5.7+20100313-1
    $ aptitude install libncurses5-dev uthash-dev

    Then, to compile just type :
    $ make

Run :
    You will need :
    $ aptitude install libncurses5
    $ ./logtop

Python module compile dependencies :
    You will need :
    $ aptitude install python-dev swig

    Then, to compile :
    $ make python-module
    $ python setup.py install


Usage :
  logtop displays real-time count of strings received in standard input.
  I's useful for some cases, like getting the IP flooding your server :
  $ tail -f /var/log/apache2/access.log | cut -d' ' -f1 | logtop

  Or the top buzzing article of your blog :
  $ tail -f /var/log/apache2/access.log | cut -d' ' -f7 | grep article | logtop


Development :
  I use a hashtable to store strings and an AVL tree to store frequencies,
  so I can fetch by string or fetch ordered by frequency to display the
  top-strings.

C API :

  Logtop can be used by your C programs, you may to compile against
  logtop's sources (src/{avl.c,history.c,logtop.c,libavl/avl.c}) or
  against liblogtop, obtained using 'make liblogtop`.

  C API is exposed in logtop.h, you need :

  - struct logtop *new_logtop(size_t history_size);
  - void delete_logtop(struct logtop *this);
  - void logtop_feed(struct logtop *this, char *line);
  - struct logtop_state *logtop_get(struct logtop *this, size_t qte);
  - double logtop_timespan(struct logtop *this);
  - unsigned int logtop_qte_of_elements(struct logtop *this);

  You can find an example of using the C API in examples/example1.c

Python API :
  logtop module exposes a logtop class containing :
    logtop.__init__(history_size) to build a new logtop keeping
                                  at most history_size lines.
    logtop.feed(line) to feed a new line in logtop.
    logtop.get(qte_of_elements) to get the top qte_of_elements lines.
    logtop.qte_of_elements() to get the current total number of lines.
    logtop.timespan() to get the duration from the oldest line to now.

  timespan may be less than the runtime, as logtop drop old lines,
  to keep, at most, history_size lines, given in the constructor of
  the logtop class.

About libavl:
  The libavl used here is the Ben Pfaff's one, statically build with logtop, as
  Ben want it to be (see INSTALL file and here :
  http://lists.debian.org/debian-devel/2001/07/msg01303.html)
  So this libavl is NOT packaged as a library for Debian, the libavl you'll
  found in Debian repositories is the Wessel Dankers's one.

logtop's People

Contributors

julienpalard avatar methodmissing avatar salty-horse avatar

Watchers

Eric Entzel avatar James Cloos avatar  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.