incava.org

Name

apercu — Summarizes web traffic based on Apache log files

Synopsis

apercu [--format =FORMAT ] [--users =FILTER ] [--hits =INTERVAL ] [--referrers =FILTER ] [--resources =FILTER ] [--time =PERIOD ] [--lookup-ips] [--sort-by-name] [--quiet] [--verbose =LEVEL ] [[--version] | [-v]] [ logfile ]

Description

apercu is an application that extracts information from Apache log files and summarizes it, showing activities and profiles of individuals (users), numbers of requests and referrers, and hit counts over time. By default, apercu displays, in order, users, hit counts, referrers, and resources.

Options

--format =FORMAT

The format of the log file. The default is:

%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"

--users =FILTER

Display user history. The optional filter narrows the users displayed to only those with matching IP addresses. Regular expression escape sequences can be used.

--hits =INTERVAL

Display hit counts, using the given time interval, which by default is "hour". Other valid intervals are "year", "mon", "day", "hour", "min", and "sec".

--referrers =FILTER

Display referrers, optionally showing only those matching the filter, which is a regular expression.

--resources =FILTER

Display resources, optionally showing only those matching the filter, a regular expression.

--time =FILTER

Display hits by time, the optional filter narrows the hits to the given time, in the format DD/MMM/YYYY: HH:MM:SS (or whatever matches the format in the log file). Regular expression escape sequences can also be used.

Time filter aliases exist: "today", "yesterday", "thisweek", "thismonth", and "thisyear". Unless the interval has been explicitly set (via --hits, these result in the interval being set to "hour", "hour", "day", "day", and "mon", respectively.

--lookup-ips

Display IP names instead of addresses, when used with the --users option. This adds significant processing time.

--sort-by-name

Sort resources and referrers by name instead of by count.

--quiet

Run with minimal output.

--verbose =LEVEL

Run with debugging output.

--version -v

Display the version and exit.

logfile

The log file to process. If not specified, standard input is used as input.

Examples

To view the hit counts for January 2006:

% apercu --time=\d+/Jan/2006 --hits /var/log/apache2/access_log

To view the user profiles and activity for today, showing IP addresses:

% apercu --time=today --users --lookup-ips /var/log/apache2/access_log

To view RPM resources for this month:

% apercu --time=thismonth --resources='GET.*\.rpm.*' /var/log/apache2/access_log

To view Google Spain referrers this month:

% apercu --time=thismonth --referrers='http://www.google.es\S*' /var/log/apache2/access_log

Configuration

$HOME/.apercu

The run-control (configuration) file, of the form:

format:       %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i
lookup-ips:   true
sort-by-name: true
quiet:        true
         

The given parameters match the --format, --lookup-ips, --sort-by-name, and --quiet options.

Author

Jeff Pace .

The Apercu web site is at http://www.incava.org/projects/apercu.

Bugs

Bugs and issues should be emailed to the author: Jeff Pace

Copyright

Copyright (c) 2006, Jeff Pace.

All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Apache License

Valid HTML 4.01!

Valid CSS!