log real-time log monitoring

Foreword:

    Since the project has just been launched and there are many bugs, developers need to come and check the diary frequently, which seriously affects the work efficiency of our operation and maintenance personnel. Sometimes, it feels annoying. . Do you guys feel it! ! ! I found some tools for dealing with diaries before, but none of them are real-time, so they have not been adopted. I just found the tool log.io and recommend it to everyone! ! This tool is enough to solve the problem now.

 


Software introduction:

   log.io is a real-time log monitoring tool, developed with node.js + socket.io, accessed through a browser, and can process more than 5,000 log change messages per second. One thing to point out is that log.io only monitors log changes and does not store logs. Like other monitoring tools, log.io also uses a server-client model. log.io consists of two parts: server and harvester, server runs on machine A (server) to monitor and record log messages sent by other machines; log harvester runs on machine B (client) to monitor and collect machine B log changes on and send the changes to machine A, each machine that needs to record the log needs a harvester.

Working principle diagram:

wKioL1NMztrgZzKSAADBTWqbHTo533.jpg

 

With the above introduction, I believe that everyone already has an understanding of log.io, let's install and configure it.j_0018.gif


 

Install on both machines A and B at the same time (steps 1 to 4)

1. Install dependency packages

 
yum install gcc gcc-c++ openssl-devel  pkgconfig -y

2. Download the node.js source code, compile and install:

 
wget http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz
tar xf node-v0.8.14/
./configure
make
make install

3. Install NPM

 
wget https://npmjs.org/install.sh && sh install.shsi

Fourth, install log.io (including log server and log harvester)

 

 
npm config set unsafe-perm true
npm install -g --prefix=/usr/local log.io

Note: The installation time of the second part is longer (download the software package based on the network), please be patient! !

5. Start the server on the server (node ​​A)

 
cd node-v0.8.14
log.io-server start

6. Configuration on the client (node ​​B)

 

 
vim /root/.log.io/harvester.conf
exports.config = {
  nodeName: "nodeB", ####Modify the node name (custom)
  logStreams: {
    nginx_access: [ ####Log service name (custom)
      "/var/log/nginx/access.log", ###log storage path
    ], 
    nginx_error: [ ####Log service name (custom)
       "/var/log/nginx/error.log" ###Log storage path
    ]
  },
  server: {
    host: '10 .10.0.2', #### log.io Server Simple IP
    port: 28777 ####log.io server port (default port)
  }
}

 

7. Start the service on the client (node ​​B)

 
cd node-v0.8.14
log.io-harvester start

8. View the real-time information of the diary through the browser

wKiom1NM9NWA8s64AARe-58eMBE985.jpg

 

Since this software installation is complete! If there are any deficiencies, please advise.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327103847&siteId=291194637