CentOSLinuxTutorials

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 a 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 the step-by-step installation Log.io on CentOS 7.

Prerequisites

  • A server running one of the following operating systems: CentOS 7.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

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 the EPEL repo to 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 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!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button