apachegrep

 

NAME

apachegrep - like grep, but for apache logs  

SYNOPSIS

apachegrep [FIELDS [field options] PATTERN] [-c | -o fields] [FILE...]  

DESCRIPTION

Apachegrep 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 given FIELD.

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).  

FIELDS

-h
host
-u
user
-t
timestamp
-r
request
-s
status code
-b
bytes transferred
-R
referrer
-U
user agent
-x
extra user field

 

FIELD OPTIONS

-v
Invert the sense of matching, to select non-matching lines.
-i
Ignore case distinctions in both the PATTERN and the input files.
 

OUTPUT OPTIONS

-c
suppress normal output; instead print a count of matching lines for each input file. Incompatible with '-o'.
-o
specify which fields to output and in what order; uses same letters as input format for each field. Incompatible with '-c'.

 

EXAMPLES

Count the number of lines containing 'index.html' appear, case
insensitively:

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  

REGULAR EXPRESSIONS

Apachegrep presumes a working knowledge of PCREs. For a good tutorial on Regular Expressions, go to http://tk.  

AUTHOR

Scott Klein and Felix Sheng

Email bug reports, feature requests, and code submissions to apachegrep (at) deasil.com


 

Index

NAME
SYNOPSIS
DESCRIPTION
FIELDS
FIELD OPTIONS
OUTPUT OPTIONS
EXAMPLES
REGULAR EXPRESSIONS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 20:33:36 GMT, September 29, 2005