Inteligante apache/nginx log analyzer.

Howdy m8s.

In next article i want to show you how to make an easy statistical view for an web page only by using one simple tool called goaccess.

As they say to their site, this tool can provide a various information for your web site just by scanning log files from apache / nginx logs.

 -General Statistics, Bandwidth etc.
 -Top Visitors
 -Requested files
 -Requested static files, images, swf, js, etc.
 -Referrers URLs
 -404 or Not Found
 -Operating Systems
 -Browsers and Spiders
 -Hosts, Reverse DNS, IP Location
 -HTTP Status Codes
 -Referring Sites
 -Unlimited log file size

For this review i’ll use VirtualBox image with Debian wheezey net-install with xfce.

Install methods:

1. debian package manager installer

If you install goaccess via debian wheezy installer it will put all packages needed for that tool and it will be ready for use.
But in that way you can’t use utf8 or geoip support.

sudo aptitude install goaccess

and you will have Version: 0.5-1

If you dont really need utf8/geoip the install part for you end with this simple command.

2. Manually compile

Here we shall install goaccess tool with fully support of utf8/geoip

Download it to your work my case this is /root/Downloads/

you need to install this libs

libglib2.0-dev libgeoip-dev  libncursesw5-dev libncurses5-dev

Than you have to follow the exact instructions from the site:

tar -xzvf goaccess-0.6.tar.gz
cd goaccess-0.6/
./configure --enable-geoip --enable-utf8 
make install

After compile is done you can use it on the fly by typing

goaccess -f /var/log/apache2/access.log -a -c

the “-c” options if for log/date configuration window.
In this window to show correctly apache log files you need to choose “NCSA Combined Log Format”

And this is all…now in console you can see in real time how log statistics is changing πŸ™‚

Goaccess main window

Customize external keyboard layout for Android

Hello Fellows πŸ™‚

Using an external keyboard with an Android device sometimes can be tricky because not all keyboards feature all of the basic Android buttons. For example I use a Bluetooth keyboard that lacks the context menu key which acts like a menu button for Android. Luckily if you have root access to your device you can customize the key mappings of your keyboard.

The first thing you need to do is to check the vendor and the product identification codes of your keyboard. You can find them if you do:

cat /proc/bus/input/devices

and explore the output in the terminal of your Android device (the keyboard has to be connected).

Check the names of the devices that are listed and you should easily identify your keyboard.

I: Bus=0005 Vendor=0a5c Product=8502 Version=011b

N: Name="Broadcom Bluetooth HID"

My Bluetooth keyboard is from vendor with id 0a5c and the product id is 8502. Now that you know the vendor and the product ids of your keyboard you can create a copy of the file /system/usr/keylayout/Generic.kl in the same location, give it a proper name and start customizing it. The name of the file should follow the pattern:


For example Vendor_0a5c_Product_8502.kl is the name of the file for my Bluetooth keyboard. The next time you connect your keyboard it should load it’s key mappings from this file instead of the generic one.

What I did to get the functionality of the menu button was to change these lines in my custom .kl file

key 126 META_RIGHT
key 127 MENU

Β to

key 126 MENU
key 127 META_RIGHT

This way I turned the right meta key (windows logo) into a menu button. The right meta key has a scan code of 126 and the context menu key has a scan code of 127 and swapping the actions that are mapped to them in the file did the job for me.

One thing that you have to be careful about is not to assign different actions to the same scan code which will cause you trouble. Each scan code must be present only once in the file.

If you want to find out the scan code of a key on your keyboard you can use the application “KeyEvent Display” which is free in the Play Store.

I hope this will be of some help.

Fixing Ubuntu soft lockup – CPU error

We have some strange issue with an Ubuntu 12.04 System. It takes a lot of time for booting to the login screen. It was approximately 4 minutes, which is definitely not normal. When we read log files, we found real problem:

kernel: BUG: soft lockup - CPU#1 stuck for 23s

We have made hardware tests: CPU stability, Memory test, Hard disk check. There is no hardware problem on it, so it was software issue. Most recent solutions that we found was to make system boot with no ACPI. Way to do it is to edit /etc/default/grub and change GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” with: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash acpi=off”

After this change you have to make update-grub and grub-install commands to take effect. When we reboot the system it takes no more than minute to load from grub to login screen. But when we checked the system, we found that it isn’t a good solution, because when you shut down it freezes (without powering off the PC). We tried with other options in grub, but nothing helps for real, so we made it as it was : GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

Real solutions for us came when we installed this package “amd64-microcode”(Processor microcode firmware for AMD CPUs). Our system runs with AMD CPU, so if it happens on Intel system, the proper package is: intel-microcode.

sudo apt-get install amd64-microcode # For AMD CPUs


sudo apt-get install intel-microcode # For Intel CPUs

In that way system runs as it should be – fast loading at boot and normal shutdown, without problems for all used services and applications.
Hope that helps πŸ™‚