Preface:
As the project has just been launched and many bugs have emerged, developers often need to come and view the diary, which seriously affects the efficiency of our O & M personnel. It may take a long time to get bored .. Have you heard of this !!! Some tools used to process diaries are not real-time, so they are not accepted. I just found that log. io is a tool recommended for everyone !! This tool is enough to solve the current problem.
Software introduction:
Log. io is a real-time log monitoring tool. It is developed using node. js + socket. io and accessed through a browser. It can process more than 5000 log change messages per second. One thing to note is that log. io only monitors log Changes and does not store logs. Like other monitoring tools, log. io also adopts the server-client mode. Log. io consists of two parts: server and harvester. The server runs on machine A to monitor and record the log messages sent from other machines; log harvester runs on machine B (client) to listen for and collect log changes on machine B, and send the changes to machine A. Each machine that needs to record the logs needs A harvester.
Working principle diagram:
I believe you have an understanding of log. io. Let's install the configuration.
Install on both machines A and B (step 1 to step 4)
1. Install the dependency package
Yum install gcc-c ++ openssl-devel pkgconfig-y
2. Download the node. js source code, compile and install it:
Wget http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gztar xf node-v0.8.14/./configuremakemake install
3. Install NPM
Wget https://npmjs.org/install.sh & sh install. shsi
4. Install log. io (including log server and log harvester)
Npm config set unsafe-perm truenpm install-g -- prefix =/usr/local log. io
Note: The installation of the second part takes a long time (download the software package based on the network). Please wait !!
5. Start server on server (node)
Cd node-v0.8.14log.io-server start
6. Configure on the client (Node B)
Vim/root /. log. io/harvester. confexports. 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 IPport: 28777 #### log. io Server port (default port )}}
7. Start the service on the client (Node B)
Cd node-v0.8.14log.io-harvester start
8. view Real-time log information through the browser
This software has been installed! If you have any shortcomings, please give me more advice.