apachegrep - like grep, but for apache logs
apachegrep [FIELDS [field options] PATTERN] [-c | -o fields] [FILE...]
specializes in searching Apache's "combined" log
format. It allows the user to specify which fields within an
apache log to limit a search and which fields to be output
as a result.
It searches the named input FILEs (or standard input of no files
are named) for lines (or FIELDS if output limiters are defined)
containing a match to the given PATTERN, limiting the search to a
Multiple statements are ORed together. String together multiple
apachegrep instances to AND together statements. Use the -v FIELD
OPTION to NOT together conditions.
Apachegrep makes use of perl regular expressions (and allows the
use of perl compatible regexes in search patterns).
extra user field
Invert the sense of matching, to select non-matching lines.
Ignore case distinctions in both the PATTERN and the input files.
suppress normal output; instead print a count of matching lines for each input file. Incompatible with '-o'.
specify which fields to output and in what order; uses same letters as input format for each field. Incompatible with '-c'.
- Count the number of lines containing 'index.html' appear, case
apachegrep -c -ri 'index.html'
- Return the host field from every request except those
containing gif or jpg:
apachegrep -rv 'gif|jpg' -o -h
- Return a list of user-defined fields for every request that starts
with POST and returned 200:
apachegrep -s '200' | apachegrep -r '^POST' -o -x
Apachegrep presumes a working knowledge of PCREs. For a good
tutorial on Regular Expressions, go to http://tk.
Scott Klein and Felix Sheng
Email bug reports, feature requests, and code submissions to
apachegrep (at) deasil.com
- FIELD OPTIONS
- OUTPUT OPTIONS
- REGULAR EXPRESSIONS
This document was created by
using the manual pages.
Time: 20:33:36 GMT, September 29, 2005