Coder Social home page Coder Social logo

logjammer's Introduction

logjammer

Tail and combine Apache access and error log

The problem

Ever needed to watch the Apache error log scroll by? Ever had trouble guessing which request an error message comes from? Looks like the best way to do that is using a request id, which you then need to match between the error and access logs. Not too convenient.

A solution

This piece of Python opens an access log and an error log, keeps reading whatever is added to the end of the file (tail -f in unix speak), and combines the output with the access log line first and any related error log output under it.

Configuration

  1. Configure your Apache logs to output the request id (%L in ErrorLogFormat and LogFormat. NB! Put the ID before any free-format fields, like the error message, as the logic here is geared towards space-separated lines.
  2. (for now) Edit the logjammer source, adjust the locations of the log files and places of the ID fields in them to match your logs.
  3. Run logjammer in a terminal of your choice.

Limitations

  • Only live log updates, no after-the-fact analysis. There are probably other tools to do that.
  • No filtering of lines, might add that at some point.
  • No filtering of fields, that might be useful as well.

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.