# cbl

Analytics for `HTTP` logs in Combined Log Format

## Install

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

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

## Uninstall

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

## Usage

The package provides 8 scripts `cblp`, `cblu`, `cblv`, `cblr` and
`cblvp`, `cblvu` , `cblvv` and `cblvr`.

The **cbl** prefix stands for _Combined Log_ and the suffixes stand for
_**p**ages_, _**u**nique_, _**v**iews_ and _**r**eferrers_.

The middle **v** in the second set stands for _virtual host_. The second
set of 4 scripts is for the Combined Log with virtual hosts format. It's
identical to the normal Combined 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
	$ cblp /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:

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

### Referrers

	$ cblr /var/www/access.log
	none 865
	https://example.com 1222

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

	$ cblr /var/www/access.log | sort -nrk 2
	https://example.com 1222
	none 865

We recommend using [cblfb](http://adi.onl/cblfb.html) for
filtering bots.

	$ cblr /var/www/access.log | cblfb
	none 821
	https://example.com 1212

Also, it's a good idea to enable log rotation.

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