Tree [cfee78] default tip /
History



File Date Author Commit
bin 2011-10-25 onukristo onukristo [cfee78] Fixed various problems with execution scripts, ...
lib 2011-10-23 onukristo onukristo [3d03e3] Added some unit tests.
resources 2011-10-22 onukristo onukristo [62518f] First working version.
src 2011-10-23 onukristo onukristo [3d03e3] Added some unit tests.
.hgignore 2011-10-22 onukristo onukristo [2b2a93] First working version.
README.txt 2011-10-25 onukristo onukristo [cfee78] Fixed various problems with execution scripts, ...
build.xml 2011-10-25 onukristo onukristo [cfee78] Fixed various problems with execution scripts, ...
version.properties 2011-10-25 onukristo onukristo [cfee78] Fixed various problems with execution scripts, ...

Read Me

Grep utility designed specifically for logfiles containing multi-line log entries.

INSTALLATION
------------
1. Unpack the zip.
2. Add bin directory to your PATH.
3. In Unix-like systems, give execution permissions to the shell script (bin/logsgrep). 

Advanced java users can use "java -jar" method and extract needed info from shell scripts.

USAGE
-----
LogsGrep is taking its input from standard input and writing its output to standard output. There are tons of advanced tools to get input from files, URL-s and so on, so there is no point of including that logic into this utility.

Output is written using system's default file encoding. For advanced users, it can be changed using Java-s standard procedure for this: -Dfile.encoding=<encoding>.
Input encoding can be changed using optional encoding argument.

Most common usage is: logsgrep <searchPattern> <firstLogRowPattern> [inputEncoding]

Patterns are based on Java regular expressions: http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html

Searchpattern is applied to the whole log entrie, which can have multiple lines (first row and stacktrace for example). So one can use \n as end of line marker in ones searchpatterns' or search from any line.

Lets say, our usual Log4J log row is something like:
2011-10-22 14:31:50,193 [192.168.40.45] DEBUG - web.MyWebController:132 - User 'onukristo' has requested a new ticket.

And lets say, we want to grep only log rows from requests made from my IP. Then you can write something like:
tail -f app.log | logsgrep 192.168.40.45 ^....-..-..

Or if you want to get all log entries which stack traces contain "NullPointerException", you can simply write
tail -f app.log | logsgrep NullPointerException ^....-..-..

And all log entries containing your search patterns will be displayed as a whole. No other log entries will be shown at all (which is not the case in common grep).

CHANGELOG
---------
0.0.3
.....
Unix execution script had DOS line-endings. Fixed to single LF line-endings. Also made sure, that DOS execution script has always right line-endings when packaged into distribution.
Added @echo off to DOS execution script.

Implemented compatibility with cygwin.