On RHEL/CentOS 6

Step 2: Install Node.js and NPM Packages

2. Node.js is a Javascript server-side programming platform which allows you to create network applications with backend functionality. NPM (Node Package Manager) is practically the package manager for Node.js. So, on the next step go ahead and install Node.js and NMP binaries on your system through YUM package manager by issuing the following commands.

3. 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. While you can use any valid system user to install Log.io, I personally recommend installing the application through root user or other system user with root privileges.

The reason for using this approach is that Log.io must have access to read locally log files and a user with non-privileges root privileges usually can’t access and read some important log files.

So, login with root account and install Log.io application through root account by issuing the following command (if you use other user replace root account with your system user accordingly).

# npm install -g log.io --user “root”

4. Now it’s time to configure Log.io to monitor local log files in real time. Let’s get an inside on how Log.io works.

[root@app .log.io]# ls
harvester.conf log_server.conf web_server.conf

The harvester file watches for changes in the specified local log files declared in its configuration and sends its output via socket.io TCP
protocol which further send the messages to Log.io local server or any other remote server declared with its IP Address ( 0.0.0.0 address specified on harvesters broadcasts to all log.io listening servers) – fileharvester.conf

Log.io server binds on all network interfaces (if not specified otherwise in log_server.conf file) and waits for messages from locally or remote harvesters nodes and sends their output to log.io Web server (0.0.0.0 means that it waits for messages from any local or remote harvesters) file log_server.conf

Log.io Web server binds on all network interfaces, listens for web clients connections on port 28778 and processes and outputs the messages that it receives internally from log.io server – file web_server.conf

First open harvester.conf file for editing, which by default only monitors Apache log files, and replace nodeNamestatement to match your hostname and define the logStreams statements with what internal log files you want to monitor (in this case I’m monitoring multiple log files such as audit, messages and secure logs). Use the below file excerpt as a guide.

Also if you don’t need harvester output to be sent to a remote Log.io server change the line host on serverstatement to only send its output locally by modifying 0.0.0.0 address with loopback address (127.0.0.1).

5. For security reasons, if you are not expecting remote harvesters output to your local Log.io server openlog_server.conf file and replace 0.0.0.0 address with loopback address (127.0.0.1).

exports.config = {
host: '127.0.0.1',
port: 28777
}

6. Other security features such as credentials login, HTTPS or restriction based on IPs to Log.io web server can be applied on web server-side. For this tutorial I will only use as a security measure just credential login.

So, open web_server.conf file, uncomment the entire auth statement by deleting all slashes and asterisks and replace user and pass directives accordingly as suggested on the bottom screenshot.

11. In order to use a command that manages Log.io application with three switches ( start, stop and status) create the following script named log.io on /usr/local/bin executable directory and append execution permissions to this script.