1 2 Colortail 3 0.3 4 5 6------ 7This software is Copyright (C) 2009 by Joakim Andersson 8<ja@joakimandersson.se>. I accept no responsibility for any damage this 9software may or may not do to your system - you use it completely at your 10own risk. This software comes under the GPL license. See the COPYING file 11for full legal details. 12------ 13 14This file contains: 15 16 1. Overview 17 2. Background 18 3. Features 19 4. Installing 20 5. Usage 21 6. Standard disclaimer 22 7. Bugs 23 8. Thanks 24 25 261. OVERVIEW 27 28Colortail works like tail but can optionally read one or more config files 29where it's specified which patterns results in which colors. 30 31Colortail uses regular expressions (see regex(7)) to determine which lines and 32parts of lines to print in which colors. 33 34 352. BACKGROUND 36 37My thoughts about colortail started when I was running a 38tail -f -q /var/log/foo /var/log/bar in the background of my irc session and I 39wanted to quickly see if something strange was going on. I wanted different 40lines in different colors so it's easy to see what is happening. I searched on 41the internet but didn't find any program that did what I wanted. So I started 42to code on colortail. Version 0.1 didn't use regular expressions but instead 43had a somewhat DOSish config format with '*' and '?'. In 0.2 I changed to 44regular expressions. After 0.2 I didn't do much with colortail for a long 45while, but then I got a patch, that made it possible to print just parts of 46lines in a color, I got some new inspiration but because the code was a big 47mess I decided to do a rewrite in C++. I like the modularity that the C++ 48classes "forces" one to do. And because I've been brainwashed with Java in 49school I find the object view the most natural. 50 51 523. FEATURES 53 54OK, so what is this colortail thing good for? 55 56I can't say that colortail is a substitute for tail, not yet anyway. Right 57now colortail lacks some major features the tail has. But I'll add this 58features in the next releases. 59 60BUT, colortail has something that tail lacks. The ability to do colored output. 61How may this come in handy? Well, it's mostly useful then looking at log files 62(it's what I use it for anyway, it may very well be other uses for it as well, 63if you have found something that colortail is useful for please send a mail 64telling me of it). In the case of looking at log files I have configured 65colortail to do this: 66(standard log file made my syslog (/var/log/messages)): 67 68(I split the line) 69 70Aug 4 23:14:53 morrdusk kernel: Packet log: ppp-in DENY ppp0 PROTO=6 71[-1--] [--2---] [--3---] [--4--] [---5-----] [-----6--------] [--5--] 72 73xxx.xx.xxx.xxx:xxxxx xxx.xxx.x.xxx:xx L=44 S=0x00 I=58022 F=0x4000 T=53 74[-----7------][--5-] [------7-----][----------------5-----------------] 75 76The above is colorized as this: 77The [-1-] part is in magenta 78The [-2-] part is in cyan 79The [-3-] part is in green 80The [-4-] part is in yellow 81The [-5-] part is in brightblue 82The [-6-] part is in brightred 83The [-7-] part is in brightyellow 84 85 86It may be hard to imagine how it looks but I think it looks better than the 87all white output from tail. And I like to have all the more serious things 88colored in bright red color. It then only takes a glance to see that 89something has happened and one can take a closer look at that line. I also have 90all ip addresses in bright yellow so that they are easy to see. 91 92This is in no way hardcoded, all is controlled in the configuration files. 93That can be one configuration file for each tail file then tailing more than 94one file or if only one configuration file is given it's used as a global 95configuration file, affecting all the tail files. 96 97 984. INSTALLING 99 100Colortail should work on most unix system that have g++. I have developed it 101on a Redhat linux system. 102I have integrated a bsd patch I got for 0.2 but I may have added some 103strange code in the rewrite that bsd doesn't like. 104There shouldn't be a problem on other systems, but if you have to change 105something to get it to work on your system, please send me a patch. 106 107To install colortail this should be enough: 108From the toplevel colortail source tree directory: 109 ./configure 110 make 111 su 112 make install 113 114After that you may want to copy and edit the example config files to some 115other place. I have them in ~/.colortail/ 116 117If you don't have the GNU regex library, it can be found at 118ftp.funet.fi/pub/gnu/prep/regex/ 119 120 1215. USAGE 122 123Most options are easily understanded. The only somewhat strange option is 124the -k option that specifies the config files so colortail knows what should 125be printed in which color. 126 127If only one config file and one or more tail files is given the config file 128is treated as a global one, i.e. 129 130colortail -k conf.global file1 file2 file3 131 132Multiple config files are separated with a , and if one tail file shouldn't 133have a config file just leave it blank, i.e. 134 135colortail -k conf.file1,,conf.file3 file1 file2 file3 136 137 1386. STANDARD DISCLAIMER 139 140The author don't take any responsibility for any damage this program may do. 141I'm doing this in my spare time. If you don't like this program don't use it. 142 143 1447. BUGS 145 146Please read the BUGS file. There I describe a very annoying bug that exists 147in tail too. I haven't yet found anyway to fix this. 148It you have a solution to that problem or if you have found another bug, 149please send a mail to pt98jan@student.hk-r.se 150 151 1528. THANKS 153 154Thanks to: 155Joey Hess for multicolored lines patch. 156Nic Bellamy for FreeBSD and OpenBSD compatability patch. 157Edward Betts for making debian packages. 158Justin Piszcz for extensive 64-bit testning. 159 160