{"id":4007,"date":"2019-08-18T00:50:43","date_gmt":"2019-08-17T21:50:43","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4007"},"modified":"2019-08-18T10:56:59","modified_gmt":"2019-08-18T07:56:59","slug":"install-goaccess-on-ubuntu-18-04-debian-10-buster","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-goaccess-on-ubuntu-18-04-debian-10-buster\/","title":{"rendered":"Install GoAccess on Ubuntu 18.04\/Debian 10 Buster"},"content":{"rendered":"\n
\"Install<\/a><\/figure>\n\n\n\n

In this guide, we are going to learn how to install GoAccess on Ubuntu 18.04\/Debian 10 Buster. GoAccess<\/a> is an open-source real-time web log analyzer and interactive viewer that runs in a terminal and on web browsers in Linux\/Unix systems.<\/p>\n\n\n\n

Install GoAccess on Ubuntu 18.04\/Debian 10 Buster<\/h2>\n\n\n\n

GoAccess is available on the default Bionic or Buster repositories. However, the available versions may be not be the latest versions. You can confirm this by running the command below;<\/p>\n\n\n\n

apt-cache policy goaccess<\/code><\/pre>\n\n\n\n
goaccess:\n  Installed: (none)\n  Candidate: 1:1.2-4+b10\n  Version table:\n     1:1.2-4+b10 500\n        500 http:\/\/deb.debian.org\/debian buster\/main amd64 Packages<\/code><\/pre>\n\n\n\n

GoAccess v1.3 is the latest stable release as of this writing. To install the latest version, you need to add GoAccess repository.<\/p>\n\n\n\n

Install GoAccess APT Repository<\/h3>\n\n\n\n

Run the command below to install the GoAccess APT repository on both Bionic and Buster.<\/p>\n\n\n\n

echo \"deb http:\/\/deb.goaccess.io\/ $(lsb_release -cs) main\" | sudo tee -a \/etc\/apt\/sources.list.d\/goaccess.list<\/code><\/pre>\n\n\n\n

Next, install the GoAccess repository signing key.<\/p>\n\n\n\n

wget -O - https:\/\/deb.goaccess.io\/gnugpg.key | sudo apt-key add -<\/code><\/pre>\n\n\n\n

On Debian 10 Buster, you might need to install gnupg2 just in case you encounter the error, Cannot write to \u2018-\u2019 (Broken pipe)<\/strong>.<\/p>\n\n\n\n

apt install gnupg2<\/code><\/pre>\n\n\n\n

Once that is done, run system update to resynchronize packages to their latest versions.<\/p>\n\n\n\n

apt update<\/code><\/pre>\n\n\n\n

You can now verify that GoAccess v1.3 is available for download.<\/p>\n\n\n\n

apt-cache policy goaccess<\/code><\/pre>\n\n\n\n
goaccess:\n  Installed: (none)\n  Candidate: 1:1.3-1\n  Version table:\n     1:1.3-1 500\n        500 http:\/\/deb.goaccess.io buster\/main amd64 Packages\n     1:1.2-4+b10 500\n        500 http:\/\/deb.debian.org\/debian buster\/main amd64 Packages<\/code><\/pre>\n\n\n\n

Install Required Dependencies<\/h3>\n\n\n\n

The only mandatory dependency for GoAccess is NCurses<\/strong> (libncursesw5-dev) which is installed automatically if you install GoAccess from APT. However, the command below installs ncurses and other optional dependencies.<\/p>\n\n\n\n

apt install libncursesw5-dev libgeoip-dev libmaxminddb-dev libtokyocabinet-dev libssl-dev<\/code><\/pre>\n\n\n\n

Install GoAccess on Ubuntu 18.04\/Debian 10<\/h3>\n\n\n\n

Now that you have the GoAccess repos in place, run the command below to install it.<\/p>\n\n\n\n

apt install goaccess<\/code><\/pre>\n\n\n\n

GoAccess is compiled with support for libssl1.0.2<\/strong>. However, Debian 10 Buster installs libssl1.1 which doesn’t meet GoAccess dependency issue. Hence, if you get the error;<\/p>\n\n\n\n

The following packages have unmet dependencies:\n goaccess : Depends: libssl1.0.2 (>= 1.0.2) but it is not installable\nE: Unable to correct problems, you have held broken packages.<\/code><\/pre>\n\n\n\n

Simply download libssl1.0.2<\/strong> and install it.<\/p>\n\n\n\n

wget http:\/\/ftp.br.debian.org\/debian\/pool\/main\/o\/openssl1.0\/libssl1.0.2_1.0.2r-1~deb9u1_amd64.deb\napt install .\/libssl1.0.2_1.0.2r-1~deb9u1_amd64.deb<\/code><\/pre>\n\n\n\n

Then proceed to install GoAccess on Debian 10.<\/p>\n\n\n\n

apt install goaccess<\/code><\/pre>\n\n\n\n

Run GoAccess<\/h2>\n\n\n\n

To obtain goaccess<\/strong> command line usage, run;<\/p>\n\n\n\n

goaccess --help<\/code><\/pre>\n\n\n\n

The most basic usage is to pass the log to analyse to GoAccess. For example;<\/p>\n\n\n\n

goaccess \/var\/log\/apache2\/access.log<\/code><\/pre>\n\n\n\n

This will open a Log, date and time format configuration prompt.<\/p>\n\n\n\n

\"Install<\/a><\/figure>\n\n\n\n

Press space bar to select the format and press Enter to analyze the logs. The log analysis dashboard is presented on the terminal.<\/p>\n\n\n\n

\"GoAccess<\/a><\/figure>\n\n\n\n

Scroll up and down to view dashboards.<\/p>\n\n\n\n

If the logs being analyzed doesn't support the default log formats for GoAccess, you can specify your log format, date and time format with the options, --log-format<\/strong>, --date-format<\/strong> and --time-format<\/strong>.<\/p>\n\n\n\n

For example, if you have squid logs with the EPOCH timestamp;<\/p>\n\n\n\n

goaccess \/var\/squid\/logs\/access.log --log-format='%x.%^ %~ %L %h %^\/%s %b %m %U %^' --date-format=%s --time-format=%s<\/code><\/pre>\n\n\n\n
\"GoAccess<\/a><\/figure>\n\n\n\n

If you need to display the analysis on a web format, save the output of a log file into an HTML file on your web root directory. In this case, you need to have a web server installed, we are using Apache in this guide,<\/p>\n\n\n\n

apt install apache2<\/code><\/pre>\n\n\n\n

To generate a web report, for Apache Access logs;<\/p>\n\n\n\n

goaccess \/var\/log\/apache2\/access.log --log-format=COMBINED -a -o \/var\/www\/html\/analysis.html<\/code><\/pre>\n\n\n\n

If you access your browser via http:\/\/<server-IP>\/analysis.html<\/strong> you should be able to see your GoAccess analytic dashboards.<\/p>\n\n\n\n

\"GoAccess<\/a><\/figure>\n\n\n\n

For analyzing squid logs with custom format;<\/p>\n\n\n\n

goaccess \/var\/squid\/logs\/access.log --log-format='%x.%^ %~ %L %h %^\/%s %b %m %U %^' --date-format=%s --time-format=%s -a -o \/var\/www\/html\/analysis.html<\/code><\/pre>\n\n\n\n

Access the report via http:\/\/<server-IP>\/analysis.html<\/strong>.<\/p>\n\n\n\n

\"Goaccess<\/a><\/figure>\n\n\n\n

To parse the logs and display the stats in a real-time HTML report, use the --real-time-html<\/strong> option.<\/p>\n\n\n\n

goaccess access.log --log-format=COMBINED -a -o \/var\/www\/html\/report.html --real-time-html<\/code><\/pre>\n\n\n\n

You can as well monitor logs on a remote server without having to install GoAccess on those servers via SSH. For example, read remote Apache logs line by line and pass it to GoAccess;<\/p>\n\n\n\n

ssh root@192.168.43.62 'while IFS= read -r line; do echo \"$line\" && sleep 1 ; done < \/root\/access.log' | goaccess --log-format=COMBINED -a -o \/var\/www\/html\/remote.html --real-time-html -<\/code><\/pre>\n\n\n\n

The report for the remote server is then available under http:\/\/<server-IP>\/remote.html<\/strong>.<\/p>\n\n\n\n

Well that is just it on how to install GoAccess on Ubuntu 18.04\/Debian 10 Buster. To learn more about GoAccess, read the GoAccess manual page, https:\/\/goaccess.io\/man<\/a>.<\/p>\n\n\n\n

Other Monitoring Tutorials<\/h4>\n\n\n\n

Integrate Prometheus with Grafana for Monitoring<\/a><\/p>\n\n\n\n

Install Grafana 6.2.x on Ubuntu 18.04\/Debian 9<\/a><\/p>\n\n\n\n

Install Grafana Metrics Monitoring Tool on Debian 9<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

In this guide, we are going to learn how to install GoAccess on Ubuntu 18.04\/Debian 10 Buster. GoAccess is an open-source real-time web log analyzer<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[1083,121,72],"tags":[1039,1084,1085,74,67],"class_list":["post-4007","post","type-post","status-publish","format-standard","hentry","category-goaccess","category-howtos","category-monitoring","tag-debian-10-buster","tag-goaccess","tag-log-analyzers","tag-monitoring","tag-ubuntu-18-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4007"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=4007"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4007\/revisions"}],"predecessor-version":[{"id":4021,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4007\/revisions\/4021"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=4007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=4007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=4007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}