My favorites | Sign in
Logo
                
Search
for
Updated Apr 08, 2009 by jordilin
Labels: Featured
Manual  
This is a hands on guide to run log4tailer

Introduction

Log4tailer is a python tailer that aims to provide the basic functionalities of a tailer plus other advanced features, like the use of colors, log behaviour analysis and alerting, silence mode by daemonizing the tailer.

Running the tailer

./log4tail [-s] [-n nlines] [-t "regex1,regex2,..."] [-c configfile] [-i seconds] [--throttle seconds] pathToLogs

Basic execution

In order to run the tailer just type:

./log4tail pathtologs

This command will tail the log4j formatted logs in a multicolored way. The default colors work well with a white or clear terminal color background. If you want to provide your own colors, you can, just run:

./log4tail -c configfile.txt pathtologs

configfile is optional and defines the colors to be used for each level, namely:

pathtologs can be provided with command line globbing, except when you run it in silence (daemonized mode) when you need to provide the full path to the logs.

Throttling mode

If your application logs information very fast, you can slow down the information being printed in your terminal by providing the --throttle option.

./log4tail --throttle numberofsecs pathtologs

The information will be printed in intervals of numberofsecs one line at a time

Silent mode

In silent mode the tailer will send FATAL alerts to an email account and will run silently as a daemon in the server. At this very moment only uses SMTP, and it will ask your account details in start up mode. Like smtp host, username and password. In case of a FATAL log trace it will send an email to the account provided, and in case of multiple FATAL alerts in a row, it has a 5 seconds gap between alerts to avoid sending multiple emails consecutively. In order to run this mode, just type:

./log4tail -s FULLPATHtologs

It will interactively ask you for smtp account details. To stop the daemon just killed.

Other features and options

Target

The -t option will tail the logs and will emphasize in a red background color the line that complies with the regex specified in the -t option:

./log4tail -t "regex1,regex2,..." pathToLogs

Tail last n lines in log file

Self explanatory:

./log4tail -n nlines pathToLog

with the added feature that it will do it in colors :)


Sign in to add a comment
Hosted by Google Code