Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
allinurl committed Mar 2, 2016
1 parent b96d08b commit 2bbdee0
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,24 +232,23 @@ to be used without prepending `--`.
| `--xmmap=<number>` | Set the size in bytes of the extra mapped memory. [0] |

## Usage ##
#### Different Outputs ####

The simplest and fastest usage would be:
To output to a terminal and generate an interactive report:

# goaccess -f access.log
That will generate an interactive text-only output.

To generate full statistics we can run GoAccess as:

# goaccess -f access.log -a
To generate an HTML report:

# goaccess -f access.log -a > report.html
To generate a JSON file:

To generate a JSON report:

# goaccess -f access.log -a -d -o json > report.json

To generate a CSV file:

# goaccess -f access.log -o csv > report.csv
# goaccess -f access.log --no-csv-summary -o csv > report.csv

The `-a` flag indicates that we want to process an agent-list for every host
parsed.
Expand All @@ -261,17 +260,21 @@ queries.)
The `-c` flag will prompt the date and log format configuration window. Only
when curses is initialized.

#### Multiple Log Files ####

Filtering can be done through the use of pipes. For instance, using grep to
filter specific data and then pipe the output into GoAccess. This adds a great
amount of flexibility to what GoAccess can display. For example:

If we would like to process all `access.log.*.gz` we can do:
If we would like to process all `access.log.*.gz` we can do one of the following:

# zcat access.log.*.gz | goaccess
OR

# zcat -f access.log* | goaccess

(On Mac OS X, use `gunzip -c` instead of `zcat`).
Note: On Mac OS X, use gunzip -c instead of zcat.

#### Working with Dates ####

Another useful pipe would be filtering dates out of the web log

Expand All @@ -288,10 +291,23 @@ If we want to parse only a certain time-frame from DATE a to DATE b, we can do:

# sed -n '/5\/Nov\/2010/,/5\/Dec\/2010/ p' access.log | goaccess -a

#### Virtual Hosts ####

Assuming your log contains the virtual host field. For instance:

vhost.com:80 10.131.40.139 - - [02/Mar/2016:08:14:04 -0600] "GET /shop/bag-p-20 HTTP/1.1" 200 6715 "-" "Apache (internal dummy connection)"

And you would like to append the virtual host to the request in order to see
which virtual host the top urls belong to

awk '$8=$1$8' access.log | goaccess -a

To exclude a list of virtual hosts you can do the following:

# grep -v "`cat exclude_vhost_list_file`" vhost_access.log | goaccess

#### Files & Status Codes ####

To parse specific pages, e.g., page views, `html`, `htm`, `php`, etc. within a
request:

Expand All @@ -308,8 +324,17 @@ Or to parse a specific status code, e.g., 500 (Internal Server Error):

# awk '$9~/500/' access.log | goaccess

For more examples, please check GoAccess' man page:
http://goaccess.io/man
#### Server ####

Also, it is worth pointing out that if we want to run GoAccess at lower
priority, we can run it as:

# nice -n 19 goaccess -f access.log -a

and if you don't want to install it on your server, you can still run it
from your local machine:

# ssh root@server 'cat /var/log/apache2/access.log' | goaccess -a

## Contributing ##

Expand Down

0 comments on commit 2bbdee0

Please sign in to comment.