In this article we will be going over a quick example on how to use goaccess to analyse the apache access.log in a production Acquia Cloud Platform environment.
Make sure to replace content in []
with your specific use case
On ACE production environments there are two or more instances which means that we first need to copy the access.logs
you would like to analyse on a shared location.
Create a folder named goaccess-logs
in the shared location /home/[example]/prod
:
example@ded-123:~/prod$ mkdir goaccess-logs
example@ded-123:~/prod$ cd ~/prod/goaccess-logs
Now copy the access.logs
you would like to analyse and rename them for the first instance (you can narrow down your selection by replacing [datestring]
for exampleaccess.log-2020*
will grab all available logs for 2020):
example@ded-123:~/prod/goaccess-logs$ cp /var/log/sites/[example].[env]/logs/[ded-123]/access.log-[datestring]* ~/prod/goaccess-logs/
example@ded-123:~/prod/goaccess-logs$ for f in access.log-[datestring]* ; do mv -- "$f" "$(hostname -a).$f" ; done
Repeat the above for all the production web instances you want to include in your analysis
Now you can use goaccess
to analyse the prod access.logs
:
example@ded-123:~/prod/goaccess-logs$ zcat [web-*/ded-*] | goaccess --log-format=COMBINED -o ~/report.html
The report is now available for you to download using the same methods described here but with the location being /home/[example]/report.html
instead.
Note that you can actually place the report.html
to a location which is served by your sites like /var/www/html/example.env/docroot/sites/default/files
by modifying the above command and then view the result from your browser. Be careful you may want to add http authentication to that as it will be publicly available !