forked from allinurl/goaccess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
goaccess.1
518 lines (503 loc) · 16.3 KB
/
goaccess.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
.TH goaccess 1 "SEPTEMBER 2014" Linux "User Manuals"
.SH NAME
goaccess \- fast web log analyzer and interactive viewer.
.SH SYNOPSIS
.LP
.B goaccess [-f input-file][\-c][\-r][\-d][\-m][\-q][\-o][\-h][...]
.SH DESCRIPTION
.B goaccess
is a free (GPL) real-time web log analyzer and interactive viewer that runs in a
terminal in *nix systems. It provides fast and valuable HTTP statistics for
system administrators that require a visual server report on the fly. GoAccess
parses the specified web log file and outputs the data to the X terminal.
Features include:
.IP "General Statistics:"
Number of valid requests, number of invalid requests, time to analyze the data,
unique visitors, unique requested files, unique static files (css, ico, jpg, js,
swf, gif, png) unique HTTP referrers (URLs), unique 404s (not found), size of
the parsed log file, bandwidth consumption.
.IP "Unique visitors:"
HTTP requests having the same IP, same date and same agent will be considered a
unique visit. This includes crawlers.
.IP "Requested files"
Hit totals are based on total requests. This module will display hits, percent,
bandwidth [time served], [protocol] and [method].
.IP "Requested static files"
Hit totals are based on total requests. Includes files such as: jpg, css, swf,
js, gif, png etc. This module will display hits, percent, bandwidth, [time
served], [protocol] and [method].
.IP "404 or Not Found"
Hit totals are based on total requests. This module will display hits, percent,
bandwidth, [time served], [protocol] and [method].
.IP "Hosts"
Hit totals are based on total requests. This module will display hits, percent,
[bandwidth, time served]. The expanded module can display extra information such
as reverse DNS and country. If -a is enabled, a list of user agents will be
displayed by selecting the IP and hitting the return key.
.IP "Operating Systems"
Hit totals are based on unique visitors. This module will display hits and
percent. The expanded module shows all available versions of the parent node.
.IP "Browsers"
Hit totals are based on unique visitors. This module will display hits and
percent. The expanded module shows all available versions of the parent node.
.IP "Referrers URLs"
The URL where the request came from. Hit totals are based on total requests.
This module will display hits and percent.
.IP "Referring Sites"
This module will display only the host but not the whole URL. The URL where the
request came from. Hit totals are based on total requests. This module will
display hits and percent.
.IP "Keyphrases"
This module will report keyphrases used on Google search, Google cache, and
Google translate. Hit totals are based on total requests. This module will
display hits and percent.
.IP "Geo Location"
Determines where an IP address is geographically located. It outputs the
continent and country. If it's unable to determine the country, location will be
marked as unknown.
.IP "HTTP Status Codes"
The values of the numeric status code to HTTP requests. Hit totals are based on
total requests. This module will display hits and percent.
.SH STORAGE
.P
There are three storage options that can be used with GoAccess. Choosing one
will depend on your environment and needs.
.TP
GLib Hash Tables
By default GoAccess uses GLib Hash Tables. If your dataset can fit in memory,
then this will perform fine. It has average memory usage and pretty good
performance. For better performance with memory trade-off see Tokyo Cabinet
on-memory hash database.
.TP
Tokyo Cabinet On-Disk B+ Tree
Use this storage method for large datasets where is not possible to fit
everything in memory. The B+ tree database is slower than any of the hash
databases since it has to hit the disk. However, using an SSD greatly increases
the performance. You may also use this storage method if you need data
persistence to quickly load statistics at a later date.
.TP
Tokyo Cabinet On-Memory Hash Database
Although this may vary across different systems, in general the on-memory hash
database should perform slightly better than GLib Hash Tables.
.SH CONFIGURATION
.P
Multiple options can be used to configure GoAccess. For a complete up-to-date
list of configure options, run
.I ./configure --help
.TP
\fB\-\-enable-debug
Compile with debugging symbols and turn off compiler optimizations.
.TP
\fB\-\-enable-utf8
Compile with wide character support. Ncursesw is required.
.TP
\fB\-\-enable-geoip
Compile with GeoLocation support. MaxMind's GeoIP is required.
.TP
\fB\-\-enable-tcb=<memhash|btree>
Compile with Tokyo Cabinet storage support.
.I memhash
will utilize Tokyo Cabinet's on-memory hash database.
.I btree
will utilize Tokyo Cabinet's on-disk B+ Tree database.
.TP
\fB\-\-disable-zlib
Disable zlib compression on B+ Tree database.
.TP
\fB\-\-disable-bzip
Disable bzip2 compression on B+ Tree database.
.SH OPTIONS
.P
The following options can be supplied via the command line or the long options
through the configuration file.
.TP
\fB\-\-date-format=<dateformat>
The date_format variable followed by a space, specifies the log format date
containing any combination of regular characters and special format specifiers.
They all begin with a percentage (%) sign. See `man strftime`.
Note that there is no need to use time specifiers since they are not used by
GoAccess. It's recommended to use only date specifiers, i.e.,
.I %Y-%m-%d.
.TP
\fB\-\-log-format=<logformat>
The log_format variable followed by a space or
.I \\\\t
for tab-delimited, specifies the log format string.
Note that if there are spaces within the format, the string needs to be
enclosed in double quotes. Inner quotes need to be escaped.
.TP
\fB\-c \-\-config-dialog
Prompt log/date configuration window on program start.
.TP
\fB\-\-color-scheme<1|2>
Choose among color schemes.
.I 1
for the default grey scheme.
.I 2
for the green scheme.
.TP
\fB\-\-no-color
Turn off colored output. This is the default output on terminals that do not
support colors.
.TP
\fB\-f \-\-log-file=<logfile>
Specify the path to the input log file. If set in the config file, it will take
priority over -f from the command line.
.TP
\fB\-\-debug-file=<debugfile>
Send all debug messages to the specified file. Needs to be configured with
--enable-debug
.TP
\fB\-\-config-file=<configfile>
Specify a custom configuration file to use. If set, it will take priority over
the global configuration file (if any).
.TP
\fB\-\-no-global-config
Do not load the global configuration file. This directory should normally be
/usr/local/etc, unless specified with
.I --sysconfdir=/dir.
.TP
\fB\-e \-\-exclude-ip=<IP|IP-range>
Exclude one or multiple IPv4/6, includes IP ranges. i.e.,
192.168.0.1-192.168.0.10
.TP
\fB\-a \-\-agent-list
Enable a list of user-agents by host. For faster parsing, do not enable this
flag.
.TP
\fB\-M \-\-http-method
Include HTTP request method if found. This will create a request key containing
the request method + the actual request.
.TP
\fB\-H \-\-http-protocol
Include HTTP request protocol if found. This will create a request key
containing the request protocol + the actual request.
.TP
\fB\-q \-\-no-query-string
Ignore request's query string. i.e., www.google.com/page.htm?query =>
www.google.com/page.htm.
.I Note:
Removing the query string can greatly decrease memory consumption, especially on timestamped requests.
.TP
\fB\-r \-\-no-term-resolver
Disable IP resolver on terminal output.
.TP
\fB\-o \-\-output-format=<json|csv>
Write output to stdout given one of the following formats:
.I csv
: Comma-separated values (CSV)
.I json
: JSON (JavaScript Object Notation)
.TP
\fB\-\-real-os
Display real OS names. e.g, Windows XP, Snow Leopard.
.TP
\fB\-\-sort-view=<MOD,FIELD,ORDER>
Sort panel on initial load. e.g.:
.I --sort-view=VISITORS,BY_HITS,ASC
See manpage for a list of panels and fields.
.TP
\fB\-\-static-file=<extension>
Add static file extension. e.g.:
.I .mp3
Extensions are case sensitive.
.TP
\fB\-\-double-decode
Decode double-encoded values. This includes, user-agent, request, and referer.
.TP
\fB\-\-ignore-crawlers
Ignore crawlers.
.TP
\fB\-\-ignore-referer=<referer>
Ignore referers from being counted. Wildcards allowed. e.g.,
.I
*.domain.com
.I
ww?.domain.*
.TP
\fB\-\-444-as-404
Treat non-standard status code 444 as 404.
.TP
\fB\-\-4xx-to-unique-count
Add 4xx client errors to the unique visitors count.
.TP
\fB\-\-no-progress
Disable progress metrics [total requests/requests per second].
.TP
\fB\-m \-\-with-mouse
Enable mouse support on main dashboard.
.TP
\fB\-d \-\-with-output-resolver
Enable IP resolver on HTML|JSON output.
.TP
\fB\-g \-\-std-geoip
Standard GeoIP database for less memory usage.
.TP
\fB\-\-geoip-city-data=<geocityfile>
Specify path to GeoIP City database file. i.e., GeoLiteCity.dat. File needs to
be downloaded from maxmind.com.
.TP
\fB\-\-keep-db-files
Persist parsed data into disk. This should be set to the first dataset prior to
use `load-from-disk`. Setting it to false will delete all database files when
exiting the program.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-load-from-disk
Load previously stored data from disk. Database files need to exist. See
.I keep-db-files.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-db-path=<dir>
Path where the on-disk database files are stored. The default value is the
.I /tmp
directory.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-xmmap=<num>
Set the size in bytes of the extra mapped memory. The default value is 0.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-cache-lcnum=<num>
Specifies the maximum number of leaf nodes to be cached. If it is not more than
0, the default value is specified. The default value is 1024. Setting a larger
value will increase speed performance, however, memory consumption will
increase. Lower value will decrease memory consumption.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-cache-ncnum=<num>
Specifies the maximum number of non-leaf nodes to be cached. If it is not more
than 0, the default value is specified. The default value is 512.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-tune-lmemb=<num>
Specifies the number of members in each leaf page. If it is not more than 0,
the default value is specified. The default value is 128.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-tune-nmemb=<num>
Specifies the number of members in each non-leaf page. If it is not more than
0, the default value is specified. The default value is 256.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-tune-bnum=<num>
Specifies the number of elements of the bucket array. If it is not more than 0,
the default value is specified. The default value is 32749. Suggested size of
the bucket array is about from 1 to 4 times of the number of all pages to be
stored.
Only if configured with --enable-tcb=btree
.TP
\fB\-\-compression=<zlib|bz2>
Specifies that each page is compressed with ZLIB|BZ2 encoding.
Only if configured with --enable-tcb=btree
.TP
\fB\-h \-\-help
The help.
.TP
\fB\-V \-\-version
Display version information and exit.
.TP
\fB\-s \-\-storage
Display current storage method. i.e., B+ Tree, Hash.
.SH CUSTOM LOG/DATE FORMAT
GoAccess can parse virtually any web log format.
.P
Predefined options include, Common Log Format (CLF), Combined Log Format
(XLF/ELF), including virtual host, Amazon CloudFront (Download Distribution) and
W3C format (IIS).
.P
GoAccess allows any custom format string as well.
.P
There are two ways to configure the log format.
The easiest is to run GoAccess with
.I -c
to prompt a configuration window. Otherwise, it can be configured under
~/.goaccessrc.
.IP "date_format"
The
.I date_format
variable followed by a space, specifies the log format date containing any
combination of regular characters and special format specifiers. They all begin
with a percentage (%) sign. See http://linux.die.net/man/3/strftime
Note that there is no need to use time specifiers since they are not used by
GoAccess. It's recommended to use only date specifiers, i.e.,
.I %Y-%m-%d.
.IP "log_format"
The
.I log_format
variable followed by a space or
.I \\\\t
, specifies the log format string.
.IP %d
date field matching the
.I date_format
variable.
.IP %h
host (the client IP address, either IPv4 or IPv6)
.IP %r
The request line from the client. This requires specific delimiters around the
request (as single quotes, double quotes, or anything else) to be parsable. If
not, we have to use a combination of special format specifiers as %m %U %H.
.IP %m
The request method.
.IP %U
The URL path requested (including any query string).
.IP %H
The request protocol.
.IP %s
The status code that the server sends back to the client.
.IP %b
The size of the object returned to the client.
.IP %R
The "Referrer" HTTP request header.
.IP %u
The user-agent HTTP request header.
.IP %D
The time taken to serve the request, in microseconds.
.IP %T
The time taken to serve the request, in seconds or milliseconds.
.I Note:
%D will take priority over %T if both are used.
.IP %^
Ignore this field.
.P
GoAccess
.I requires
the following fields:
.IP
.I %h
a valid IPv4/6
.IP
.I %d
a valid date
.IP
.I %r
the request
.SH INTERACTIVE MENU
.IP "F1 or h"
Main help.
.IP "F5"
Redraw main window.
.IP "q"
Quit the program, current window or collapse active module
.IP "o or ENTER"
Expand selected module or open window
.IP "0-9 and Shift + 0"
Set selected module to active
.IP "j"
Scroll down within expanded module
.IP "k"
Scroll up within expanded module
.IP "c"
Set or change scheme color.
.IP "TAB"
Forward iteration of modules. Starts from current active module.
.IP "SHIFT + TAB"
Backward iteration of modules. Starts from current active module.
.IP "^ f"
Scroll forward one screen within an active module.
.IP "^ b"
Scroll backward one screen within an active module.
.IP "s"
Sort options for active module
.IP "/"
Search across all modules (regex allowed)
.IP "n"
Find the position of the next occurrence across all modules.
.IP "g"
Move to the first item or top of screen.
.IP "G"
Move to the last item or bottom of screen.
.SH EXAMPLES
The simplest and fastest usage would be:
.IP
# goaccess -f access.log
.P
That will generate an interactive text-only output.
.P
To generate full statistics we can run GoAccess as:
.IP
# goaccess -f access.log -a
.P
To generate an HTML report:
.IP
# goaccess -f access.log -a > report.html
.P
To generate a JSON file:
.IP
# goaccess -f access.log -a -d -o json > report.json
.P
To generate a CSV file:
.IP
# goaccess -f access.log -o csv > report.csv
.P
The
.I -a
flag indicates that we want to process an agent-list for every host parsed.
.P
The
.I -d
flag indicates that we want to enable the IP resolver on the HTML | JSON output.
(It will take longer time to output since it has to resolve all queries.)
.P
The
.I -c
flag will prompt the date and log format configuration window. Only when
curses is initialized.
.P
Now if we want to add more flexibility to GoAccess, we can do a series of pipes.
For instance:
.P
If we would like to process all
.I access.log.*.gz
we can do:
.IP
# zcat access.log.*.gz | goaccess
.P
OR
.IP
# zcat -f access.log* | goaccess
.P
Another useful pipe would be filtering dates out of the web log
.P
The following will get all HTTP requests starting on 05/Dec/2010 until
the end of the file.
.IP
# sed -n '/05\\/Dec\\/2010/,$ p' access.log | goaccess -a
.P
If we want to parse only a certain time-frame from DATE a to DATE b, we can do:
.IP
sed -n '/5\\/Nov\\/2010/,/5\\/Dec\\/2010/ p' access.log | goaccess -a
.P
.I Note that this could take longer time to parse depending on the speed of sed.
.P
To exclude a list of virtual hosts you can do the following:
.IP
grep -v "`cat exclude_vhost_list_file`" vhost_access.log | goaccess
.P
.B Also,
it is worth pointing out that if we want to run GoAccess at lower priority, we
can run it as:
.IP
# nice -n 19 goaccess -f access.log -a
.P
and if you don't want to install it on your server, you can still run it
from your local machine:
.IP
# ssh root@server 'cat /var/log/apache2/access.log' | goaccess -a
.P
.SH NOTES
For now, each active window has a total of 300 items. Eventually this will be
customizable.
.P
Piping a log to GoAccess will disable the real-time functionality. This is due
to the portability issue on determining the actual size of STDIN. However, a
future release *might* include this feature.
.SH BUGS
If you think you have found a bug, please send me an email to
or use the issue tracker in https://github.com/allinurl/goaccess/issues
.SH AUTHOR
Gerardo Orellana <[email protected]>
For more details about it, or new releases, please visit
http://goaccess.prosoftcorp.com