https://github.com/dalibo/logsaw
a log watcher remembering what it already parsed
https://github.com/dalibo/logsaw
Last synced: about 2 months ago
JSON representation
a log watcher remembering what it already parsed
- Host: GitHub
- URL: https://github.com/dalibo/logsaw
- Owner: dalibo
- License: other
- Created: 2011-02-15T19:11:17.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2014-05-23T07:20:11.000Z (about 12 years ago)
- Last Synced: 2025-03-05T17:40:46.631Z (over 1 year ago)
- Language: Perl
- Homepage:
- Size: 164 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
logsaw.pl
logsaw.pl - retrieve and filter your logs
Version 1.0
SYNOPSIS
logsaw.pl [-d|--debug] [-?|--help] [-H|--show-filename] [-n|--line-number] [--conf path_to_config_file]
DESCRIPTION
This program reads a bunch of log files generated by a program and sends
the interesting messages to stdout. It supports log files rotated and
optionnaly compressed by logrotate or another similar mecanism.
OPTIONS
-d, --debug: output some debug informations.
-?, --help: show this help page.
-H, --show-filename: show log filenames in the output.
-n, --line-number: show line number of the entrey in the logfile.
-f, --conf: configuration file. By default "$HOME/.logsaw".
CONFIGURATION
The configuration file can these entries :
* LOGFILES is a regular expression matching every filename we want to
scrutinize. They have to be in the same directory for instance :
postgresql-8.4-main-[0-9]{4}-[0-9]{2}.log". By default, match all
files.
* LOGDIR is the directory where the LOGFILES are located, eg.
"/var/log/postgres". By default './'.
* REGEX is a rule to match for a line to be kept in the result. The
rules are perl regular expressions. The configuration file can have as
many REGEX than rules needed. By default, match all line.
* NOTREGEX is a rule to match for a line to be ignored in the result.
The rules are perl regular expressions. The configuration file can have
as many REGEX than rules needed. By default, match all lines. If you put
REGEX and NOTREGEX at the time in the configuration, both are applied: a
line has to match a REGEX and not match any NOTREGEX to be displayed.
* PAGER give an arbitrary command to open and read log files if IO::Zlib
is not available. For instance "zcat -f" or "gzip -dfc".
The next parameters set where to start processing log files on the next
call of logsaw and are updated by itself. If not set, logsaw will parse
all matching log files from the begining.
* FILEID is the cheksum of the last seen file
* OFFSET is the position in this file
SAMPLE
The following configuration file will:
* match any line containing the FATAL, ERROR or WARNING strings
* against all files in the directory "/var/log/postgres"
* matching "postgresql\.log" (eg. postgresql.log, postgresql.log.1,
postgresql.log.2.gz, ...)
* using "zcat -f" to open files
LOGDIR=/var/log/postgres
LOGFILES=postgresql\.log
PAGER=zcat -f
REGEX=FATAL
REGEX=ERROR
REGEX=WARNING
Note that on a system with IO::Zlib installed, PAGER is not required.
AUTHORS
Dalibo's team. http://www.dalibo.org
LICENSING
This program is open source, licensed under the simplified BSD license.
For license terms, see the LICENSE provided with the sources.