Skip to content

Purrrrrr/haywire

Repository files navigation

- Haywire -

A small ncurses program written in C to display and search apache+php error logs in real time.

---------
Features:
---------

* Opens and parses an error log file to display a list of different error messages 
* Configurable log formats (The default one is "[%t] [%l] [client\\ %a] %M% ,\\ referer:\\ %{referer}i",
  newer apache versions seem to use a newer one. See the section on the configuration file for more details.)
* Scrollable list with last date, count and filename information
* Different types of errors are displayed in different colors
* Follows the log file in real time
* Press enter to open the source of the error in vim (Editor configuration is yet to be done)
* Rings the terminal bell when new errors occur (This can be turned off)
* Logs can be filtered by keyword

-------------------
Keyboard shortcuts:
-------------------

j,down key        Scroll down one entry
k,up key          Scroll up
space, page down  Scroll down one screen
page up           Scroll up one screen

B                 Toggle between bell modes
b                 Change the severity of errors to cause bell ringing

o                 Toggle between sorting criteria
O                 Reverse sort

/                 Filter log entries by keyword, press enter to escape 
                  filter edit modes
d                 Remove the selected entry from the list

i,f               Toggle log line information display
enter, v          Open the file referenced by the selected entry in the 
                  default editor (or vim if the EDITOR environment variable 
                  is not specified)
c                 Clear the display and forget all previous log entries
q                 Exit Haywire

------------------
Configuration file
------------------

Haywire tries to read the file .haywirerc in your home directory 
for the following directives:

read-file: filename   <- Read a file without following it
follow-file: filename <- Read a file and follow it
linecount: number|all <- How many lines are read from the file being 
                         followed, either a number or the keyword all
                         to read the whole file
log-format: string    <- The format of the log files in the same format as 
                         an Apache ErrorLogFormat directive.
                         Can be specified multiple times for different files,
                         but needs to be specified before the file it applies to,
                         otherwise file reading may not work properly.

Any file not begginning with a directive is ignored, by convention
lines begginning with the hash sign # are used for comments.

The follow-file and linecount options can be overridden by 
command line parameters.

Example file:
#Use the newer Apache log format:
log-format: [%t] [%l] [pid %P] %F: %E: [client %a] %M% ,\ referer:\ %{referer}i
linecount: 100
follow-file: /var/log/apache2/error.log

-----
TODO:
-----

Support for terminals without color
An installation script

------------------------------
Extensions and libraries used:
------------------------------
CMake for compilation
ncurses
GNU getline extensions
libghthash 0.6.2; Basic source included in the misc folder. 
  For the whole package see:
  http://www.bth.se/people/ska/sim_home/libghthash.html)

Compilation on a fairly recent ubuntu should be straightforward:
sudo apt-get install libncurses5-dev
cmake .
make

About

A tool to analyze and track apache+php error logs in real time. Written in C.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published