GoAccess
Goaccess is een snelle, laagdrempellige applicatie om je access-logfiles mee te analyseren. Je kan de analyse doen via een web-interface of de commandline. Wij hebben GoAccess beschikbaar op upload-(test)sites, maar je kunt het ook lokaal gebruiken. Out of the box werkt GoAccess nog niet met ons log-format, hier vind je de juiste settings om GoAccess te laten werken binnen onze hostingsomgeving.
Nginx
Om onze stijl nginx-log files te kunnen parsen heb je de volgende config-file nodig. Verander .txt in .conf en je kunt hem gebruiken.
Onderstaande uitleg is voor als je zelf een configuratie-file wilt maken of als je de bestaande file wilt aanpassen.
| nginx | SPECIFIERS | Goaccess docs |
|---|---|---|
| '$http_host | %v | The server name according to the canonical name setting (Server Blocks or Virtual Host). |
| $remote_addr | %h | host (the client IP address, either IPv4 or IPv6) |
| $request_time | %L | The time taken to serve the request, in milliseconds as a decimal number. |
| $upstream_cache_status | %^ | ignore; wordt niet ondersteund |
| [$time_local] | %d/%b/%Y | zie:config-file |
| “$request” | “%r” | The request line from the client. |
| “$http_referer” | “%R” | The “Referer” HTTP request header. |
| “$http_user_agent” | “%u” | The user-agent HTTP request header. |
| $status | %s | The status code that the server sends back to the client. |
Config file: Haal de volgende boilerplate config file op:
wget https://raw.githubusercontent.com/allinurl/goaccess/master/config/goaccess.conf ~/.goaccess
Uncomment de volgende regels:
time-format %H:%M:%S date-format %d/%b/%Y
Voeg dit toe onder log-format:
#Custom Nginx Format: log-format %v %h %L %^ [%d:%t %^] - "%r" "%R" "%u" %s %b
Apache
Voor front-proxy instanties kies je deze configuratie-file config-file . Voor php-instanties gebruik je deze file config-file . Verander .txt in .conf en je kunt hem gebruiken.
Onderstaande uitleg is voor als je zelf een configuratie-file wilt maken of als je de bestaande file wilt aanpassen.
Backend/apache-php-workers
LogFormat “%{Host}i %h %D %{X-ProxyInstancename}i %t %X \”%{X-Forwarded-For}i\“ \”%r\“ \”%{Referer}i\“ \”%{User-Agent}i\“ %>s %b” workerlog
| Apache config | SPECIFIERS | Goaccess docs |
|---|---|---|
| '%{Host} | %v | The server name according to the canonical name setting (Server Blocks or Virtual Host). |
| %h | %h | host (the client IP address, either IPv4 or IPv6) |
| %D | %T | The time taken to serve the request, in seconds with milliseconds resolution.. |
| [ %t | %d/%b/%Y | datum-tijd. zie:config-file |
| %X | %^ | connection status, ignore; wordt niet ondersteund |
| \“%{X-Forwarded-For}i\” | %^ | ignore; wordt niet ondersteund |
| %r | “%m %q” | The request method. The query string. |
| %{Referer} | “%R” | The “Referer” HTTP request header. |
| %{User-Agent} | “%u” | The user-agent HTTP request header. |
| %s | %s | The status code that the server sends back to the client. |
| %b | %b | The size of the object returned to the client. |
Apache-php backends:
Zelfde als bovenstaand voor nginx behalve log-format, voeg in plaats daarvan dit toe onder log-format:
log-format %%v %h %D %e [%d:%t %z] %^ "%^" "%m %U %H" "%R" "%u" %s %b
Proxy-log:
log-format %v %h %D %e [%d:%t %z] %^ "%m %q" "%U" "%u" %R "-" %s %b
| $upstream_cache_status | %^ | ignore; wordt niet ondersteund |
Log files door goaccess jagen
-o $pagina.html voor een web pagina als output
goaccess -p $config-file $accesslog