How to monitor your Apache web server logs with log.io
Jack Wallen shows you how to install Apache Realtime Log Monitor, log.io, on Ubuntu Server 16.04, and why it is a must have for any web server administrator.
As a web server administrator, one of your most important tasks is to be able to easily monitor the logs in real time. Having this ability can mean the difference between knowing what is going right and wrong with your web servers and how to fix problems quickly. But for some administrators, having to SSH into a server and then view various log files, through the terminal window, can be a frustrating exercise. Fortunately, there are plenty of tools out there that allow you to make this a lot easier. One of these tools is log.io. Log.io allows you to monitor log files in real time, for your Apache web server, with the convenience of a web browser. I want to show you how to install this incredibly useful tool on an Ubuntu LAMP (Linux Apache MySQL PHP) server.
What you will need
I’m assuming your LAMP server is already up and running. You will also need to access an account with sudo rights. With all of that in place, it’s time to install.
The installation of log.io is handled entirely through the command line. The first thing to do is update / upgrade. Keep in mind that if the upgrade includes the kernel, you will need to restart your system. So it’s always best to upgrade during off-peak hours. The update / upgrade is handled with the following two commands:
sudo apt update sudo apt upgrade
Once these are done and the server does not require a restart, you are good to go.
The first thing to do is to install both node.js and NPM. These can be installed with a single command:
sudo apt install nodejs npm
Enter your sudo password and validate the installation. Once this installation is complete, you are ready to continue.
We will display log.io on http (not https). For this reason, we have to silence an SSL certificate error with the command:
sudo npm config set strict-ssl false
Now we install log.io with the command:
sudo npm install -g log.io --user "root"
The installation will create a new directory in / root, called .log.io. To access this directory, you must first run the command sudo -s. Once you have successfully authenticated with your sudo password, navigate to the new directory with the command:
There are three files in this directory:
Open Harvester.conf with the nano Harvester.conf command and make sure the nodeName line is:
Save and close this file. Open web_server.conf. In that file you will see this section:
restrictHTTP: [ "192.168.1.162", "10.0.*" ]
If you want to restrict log.io to specific IP addresses, do so here. Save and close this file.
It’s time to start the log.io services. This is done with the following two commands:
log.io-server & log.io-harvester &
On a desktop computer that has access to the IP address of your log.io web server, point your default web browser to http: // SERVER_IP: 28778 (where SERVER_IP is the IP address of the log.io server). You should see the main log.io page (Figure A), already spitting out real-time log entries for your Apache web server. If you don’t see anything, be sure to select both Apache and Webserver in the left navigation (click on one and both will be automatically selected).
If the entries become too difficult to display, you can always place your cursor in the upper right corner of the window to display the search bar (Number B).
Welcome to easy, real-time Apache logs
Every Apache web administrator should consider log.io a must have, especially if you don’t want to have to browse text files in a terminal window. For easy, real-time Apache logs, you don’t need to look any further than log.io. Try log.io and see if it does not terminate your default Apache web server log monitor.