# cl

Analytics for `HTTP` logs in Common Log Format

## Install

On a Linux or BSD machine, in a terminal, run:

	mkdir -p ~/src
	cd ~/src
	wget -qO - https://adi.onl/cl/cl@1.0.0.tgz | tar -xzvf -
	cd cl
	make install PREFIX=$HOME

## Uninstall

	cd ~/src/cl
	make uninstall PREFIX=$HOME

## Usage

The package provides 6 scripts `clp`, `clu`, `clv` and `clvp`, `clvu`
and `clvv`.

The **cl** prefix stands for _Common Log_ and the suffixes stand for
_**p**ages_, _**u**nique_ and _**v**iews_.

The middle **v** in the second set stands for _virtual host_. The second
set of 3 scripts is for the Common Log with virtual hosts format. It's
identical to the normal Common Log except the name of the virtual host
is prepended to each line.

Use the appropriate script for the statistic and for the log format:

### Pages

	$ clp /var/www/access.log
	/docs.html 641
	/ 3227

Use `sort -nrk 2` to sort on second column:

	$ clp /var/www/access.log | sort -nrk 2
	/ 3227
	/docs.html 641

### Uniques and Visits

Uniques and visits scripts output the actual unique and visit requests
by default. Use `wc -l` to count:

	$ clu /var/www/access.log | wc -l
	    2000

The scripts operate on `GET` requests to paths with no extension or
ending in `.html` that returned a 200 HTTP response status code.

	https://example.com/docs
	https://example.com/docs/
	https://examples.com/docs.html