Skip to content

HOWTO devops log_analysis

steveoro edited this page Apr 26, 2021 · 2 revisions

HOWTO: analyze existing log files

Synopsis:

To quickly analyze existing log files, mainly the access.log of the web server and the production.log from the app server, we use a couple of command line tools that need to be launched from the Bash shell after having copied the log files locally.

References:

Some tools:

Explanation:

request-log-analyzer is a gem dedicated to quickly analyze Rails environment log files.

GoAccess works almost instantly with the standard Apache2 access.log file and it's dedicated to the anaysis of web servers'access log files.

We haven't tested LogStash with our current configuration yet, although is highly customizable.

Copy the log files: (local)

Copy the log files locally with:

  $ scp root@<SERVER_IP>:/var/www/goggles.org/shared/log/*.log .

GoAccess: (local)

Requires the dev packages for ncurses and the geo-ip location library (which must be installed previously via package manager).

  $ wget http://tar.goaccess.io/goaccess-1.1.1.tar.gz
  $ tar -xzvf goaccess-1.1.1.tar.gz
  $ cd goaccess-1.1.1/
  $ ./configure --enable-geoip --enable-utf8
  $ make
  $ su
  # make install

Execute from bash to get an interactive report:

  $ goaccess -f access.log

Most of the times (depending on current locale) it is required to select the time format at the beginning (first choice from the menu -> SPACE bar to select - > ENTER to start the log parsing)

The report is divided in sections and easily browsable using TAB or the cursor keys.

request-log-analyzer: (local)

Install (out of the project bundle):

  $ gem install request-log-analyzer

Execute and get a quick report on the Bash shell:

  $ request-log-analyzer production.log

Science, bitch!

Clone this wiki locally