{"id":2218,"date":"2016-07-13T17:21:12","date_gmt":"2016-07-13T21:21:12","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2218"},"modified":"2018-01-12T14:05:52","modified_gmt":"2018-01-12T19:05:52","slug":"goaccess-analyze-apache-logfiles-linux","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/","title":{"rendered":"Use and Install GoAccess to analyze Apache logfiles on Linux"},"content":{"rendered":"<h1>Use and Install GoAccess to analyze Apache logfiles on Linux<\/h1>\n<p>GoAccess is a real time web log analyzer and visualizer for Linux and Unix operating systems. It runs as an interactive program in the terminal, and later versions also provide an HTML report that can be conveniently viewed in the browser. GoAccess is open source and uses the MIT license. <\/p>\n<h2>Getting Started<\/h2>\n<p>To complete this guide, you will need the following:<br \/>\n\u2022 1 Node (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>) with any Linux distribution installed.<br \/>\n\u2022 All commands should be run as the root user<\/p>\n<h2>Tutorial<\/h2>\n<p>First, install GoAccess on your machine. You&#8217;ll most likely be able to find it in your distribution&#8217;s default package repositories.<\/p>\n<p>On CentOS 6 or CentOS 7, you can use this command to install GoAccess:<\/p>\n<p><code>yum -y install goaccess<\/code><\/p>\n<p>If on Ubuntu 14 through 16, or if using Debian 7 or Debian 8, use this command instead:<\/p>\n<p><code>apt-get -y install goaccess<\/code><\/p>\n<p>Another option is to add the GoAccess official repository and install it from there. This is useful in case your distribution does not have the latest version of the software.<\/p>\n<p><code>echo \"deb http:\/\/deb.goaccess.io\/ $(lsb_release -cs) main\" | sudo tee -a \/etc\/apt\/sources.list.d\/goaccess.list<br \/>\nwget -O - https:\/\/deb.goaccess.io\/gnugpg.key | sudo apt-key add -<br \/>\napt-get update<br \/>\napt-get install goaccess<\/code><\/p>\n<p>If using another operating system, you can search for pre-compiled binaries at the official website. If none are available for your system, then a final option is to compile GoAccess from source:<\/p>\n<p><code>wget http:\/\/tar.goaccess.io\/goaccess-1.0.1.tar.gz<br \/>\ntar -xzvf goaccess-1.0.1.tar.gz<br \/>\ncd goaccess-1.0.1\/<br \/>\n.\/configure --enable-geoip --enable-utf8<br \/>\nmake<br \/>\nmake install<\/code><\/p>\n<p><strong>Using GoAccess<\/strong><\/p>\n<p>After installation, find the access logfiles for Apache. This can change from machine to machine. For the purpose of these instructions we will assume that they are in the default location.<\/p>\n<p>You may have multiple access logfiles. In that case, make sure to run GoAccess on the most recent, active logfile with the following flags: -f which will allow you to specify the path of the logfile location, and -a which is the option to see all stats available.<\/p>\n<p><code>goaccess -f \/var\/log\/httpd\/access_log -a<\/code><\/p>\n<p>You will be prompted to select the log format. If you are using a default server with the standard log file output, select the NCSA combined log format.<\/p>\n<p><a href=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png\" alt=\"goaccess\" width=\"509\" height=\"372\" class=\"aligncenter size-full wp-image-2219\" \/><\/a><\/p>\n<p>Press the Enter key and GoAccess will begin to analyze your log file. Once it is fully parsed, you will be redirected to the following command line interface. (Local IP addresses are being used for the purpose of this KB article.)<\/p>\n<p><a href=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess2.png\" alt=\"goaccess2\" width=\"1601\" height=\"914\" class=\"aligncenter size-full wp-image-2220\" \/><\/a><\/p>\n<p>This visual interface will aid you in analyzing your logfiles for bottlenecks and inefficiencies. If you have selected an active logfile as directed to above, GoAccess will continue to analyzing logs as they are populated.<\/p>\n<p><strong>GoAccess live reporting in HTML format<\/strong><\/p>\n<p>Recent versions of GoAccess allow the user to generate a live HTML report that can be viewed through the web browser. In order to do so, some additonal setup is required.<\/p>\n<p><strong>Configure unattended startup<\/strong><\/p>\n<p>Find the GoAccess configuration file. It will be located at \/usr\/local\/etc\/goaccess.conf if you are using CentOS 6 with a compiled version of GoAccess. Otherwise, the program locate is invaluable in determining the location of the configuration file.<\/p>\n<p>In each of the 4 sections of the file, find the parameters that correspond to your log format and uncomment them. For Standardized NGINX and Apache log formats, uncomment the following lines:<\/p>\n<p><code>nano \/usr\/local\/etc\/goaccess.conf<\/code><br \/>\n<code class=\"gris\">time-format %H:%M:%S<br \/>\ndate-format %d\/%b\/%Y<br \/>\nlog-format %h %^[%d:%t %^] \"%r\" %s %b \"%R\" \"%u\"<\/code><\/p>\n<p>Once the lines above are uncommented, you will be able to launch GoAccess in &#8220;unattended&#8221; mode without having to select those log formats from the prompt as specified above.<\/p>\n<p><strong>Start GoAccess with HTML Generation<\/strong><\/p>\n<p>To enable live reporting, simply issue the following command. This will output report.html at the root of the \/var\/www\/html directory. You may output it in any folder served by your Apache instance so that you can view the HTML file:<\/p>\n<p><code>goaccess -f \/var\/log\/httpd\/access_log -o \/var\/www\/html\/report.html --real-time-html<\/code><\/p>\n<p>In order to view the generated HTML report, simply navigate to report.html using your web browser.<\/p>\n<p>See the screenshot below for an example of that report:<\/p>\n<p><a href=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess34.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess34.png\" alt=\"goaccess34\" width=\"1905\" height=\"906\" class=\"aligncenter size-full wp-image-2221\" \/><\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>Congratulations! Now you know how to install and use GoAccess to analyze Apache logfiles. If this guide was helpful to you, kindly share it with others who may also be interested.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Use and Install GoAccess to analyze Apache logfiles on Linux GoAccess is a real time web log analyzer and visualizer for Linux and Unix operating systems. It runs as an interactive program in the terminal, and later versions also provide an HTML report that can be conveniently viewed in the browser. GoAccess is open source<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[],"class_list":["post-2218","post","type-post","status-publish","format-standard","hentry","category-monitoring","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Use and Install GoAccess to analyze Apache logfiles on Linux - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to install GoAccess to analyse Apache logfiles on your Linux server. Read now &amp; Learn the benefits of GoAccess!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Use and Install GoAccess to analyze Apache logfiles on Linux - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to install GoAccess to analyse Apache logfiles on your Linux server. Read now &amp; Learn the benefits of GoAccess!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-13T21:21:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-12T19:05:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/\",\"name\":\"Use and Install GoAccess to analyze Apache logfiles on Linux - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png\",\"datePublished\":\"2016-07-13T21:21:12+00:00\",\"dateModified\":\"2018-01-12T19:05:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to install GoAccess to analyse Apache logfiles on your Linux server. Read now & Learn the benefits of GoAccess!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#primaryimage\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png\",\"contentUrl\":\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.globo.tech\/learning-center\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Use and Install GoAccess to analyze Apache logfiles on Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\/\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Use and Install GoAccess to analyze Apache logfiles on Linux - Globo.Tech","description":"This tutorial will show you how to install GoAccess to analyse Apache logfiles on your Linux server. Read now & Learn the benefits of GoAccess!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/","og_locale":"en_US","og_type":"article","og_title":"Use and Install GoAccess to analyze Apache logfiles on Linux - Globo.Tech","og_description":"This tutorial will show you how to install GoAccess to analyse Apache logfiles on your Linux server. Read now & Learn the benefits of GoAccess!","og_url":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/","og_site_name":"Globo.Tech","article_published_time":"2016-07-13T21:21:12+00:00","article_modified_time":"2018-01-12T19:05:52+00:00","og_image":[{"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png","type":"","width":"","height":""}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/","url":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/","name":"Use and Install GoAccess to analyze Apache logfiles on Linux - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#primaryimage"},"image":{"@id":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png","datePublished":"2016-07-13T21:21:12+00:00","dateModified":"2018-01-12T19:05:52+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to install GoAccess to analyse Apache logfiles on your Linux server. Read now & Learn the benefits of GoAccess!","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#primaryimage","url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png","contentUrl":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/07\/goaccess1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/goaccess-analyze-apache-logfiles-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"Use and Install GoAccess to analyze Apache logfiles on Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2218"}],"version-history":[{"count":7,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2218\/revisions"}],"predecessor-version":[{"id":4082,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2218\/revisions\/4082"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}