How To Install Log.io on CentOS 7

Install Log.io on CentOS 7

In this tutorial, we will show you how to install Log.io on CentOS 7. For those of you who didn’t know, Log.io is the real-time monitoring tool, powered by node.js and socket.io. Log.io offers a simple web interface for monitoring the server logs.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation Log.io on CentOS 7.

Install Log.io on CentOS 7

Step 1. First, you need to enable the EPEL repository on your system.

## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -ivh epel-release-7-5.noarch.rpm

After you added EPEL repo on your system, do a system upgrade by running the following command:

yum -y update

Step 2. Install npm and node.js packages.

yum install nodejs npm

Step 3. Install Log.io.

Log.io application must be installed on your system through NPM by specifying a valid local system user, through which the installation must take place:

npm install -g log.io --user "root"

Step 4. Configure Log.io.

Log.io’s Installed directory is ~/.log.io which is a hidden directory in the home directory of the user, used in the previous step for the installation, it has three configuration files that control its working nature. In this case, to access the configuration files you need to navigate to the ‘~/.log.io/’ directory using the following command:

cd ~/.log.io/

There are three configuration files:

harvester.conf
log_server.conf
web_server.conf

In most cases, you will have to edit the harvester.conf. In this configuration file, you can specify which log files need to be monitored for changes. You can edit the file using your favorite text editor.

### nano harvester.conf
exports.config = {
nodeName: "idroot_server", # Node Name
logStreams: {
apache: [
"/var/log/httpd/access_log",  # Monitoring Apache Logs
"/var/log/httpd/error_log"
],
messages:
[
"/var/log/messages" # Monitoring Messages file
],
},
server: {
host: '192.168.1.1',  # Sends the file to remote server, Set to 127.0.0.1 for local Log.io server
port: 28777
}
}
### nano ~/.log.io/log_server.conf
exports.config = {
host: '0.0.0.0',  # Listens on all ip for receving logs
port: 28777
}
### nano  ~/.log.io/web_server.conf
exports.config = {
host: '0.0.0.0',  # Listens all ip adress to recive the web interface requests
port: 28778,
/*
// Enable HTTP Basic Authentication
auth: {
user: "admin",
pass: "1234"
},
*/

/*
// Enable HTTPS/SSL
ssl: {
key: '/path/to/privatekey.pem',
cert: '/path/to/certificate.pem'
},
*/

/*
// Restrict access to websocket (socket.io)
// Uses socket.io 'origins' syntax
restrictSocket: '*:*',
*/

/*
// Restrict access to http server (express)
restrictHTTP: [
"192.168.1.46",
"10.0.*"
]
*/

}

When you are done, you can save the file and close it. Then, you can start the Log.io services in the background using the following commands:

log.io-server &
log.io-harvester &

To stop the Log.io application run the following command:

pkill node

Step 5. Setup firewall rule for Log.io

firewall-cmd --add-port=28778/tcp --permanent
firewall-cmd --reload

Step 6. Accessing Log.io.

Log.io will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com:28778 or http://your-server-ip:28778. If you are using a firewall, please open port 80 to enable access to the control panel.

Congratulations! You have successfully installed Log.io. Thanks for using this tutorial for installing Log.io monitor server logs on CentOS 7 system. For additional help or useful information, we recommend you to check the official Log.io website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!