Node.js use Log.io in the browser to monitor the log in real time (equivalent to tail-f command) _node.js

Source: Internet
Author: User

Today, took the time to browse the next node.js, haha, read a primer article (http://www.nodebeginner.org/index-zh-cn.html), the sense of self is getting started, but inside a sentence, quite has the sentiment:

Copy Code code as follows:

These are, after all, front-end technologies, although it always makes sense to use jquery when you want to enhance the page, but in the end, you're the most JavaScript user, not the JavaScript developer. And then, there's the Node.js, the service-side JavaScript, how cool is that? So you think it's time to pick up the familiar and unfamiliar JavaScript. But don't worry, writing node.js apps is one thing; understanding why they write in the way they write means-you have to understand JavaScript. It's a real game this time.
It's a drop, this time it's going to be real.

To say, to see a good thing Log.io, the official explanation is that:

Copy Code code as follows:

Real-time log monitoring in your browser
Powered by Node.js + Socket.io

Real-time log monitoring, we may think of Linux under the Tail-f, Log.io is also roughly this meaning, but more powerful than the TAIL-F function. This thing is also C/s structure of OH.

The following is a practical demonstration:

1, installation

This thing, rely on Nodejs, we first put Nodejs, refer to the official installation method: (http://nodejs.org/download/)

I'm using the Mac Brew installation method here:

Copy Code code as follows:

Brew Install Nodejs

or use Yum:

Copy Code code as follows:

Yum Install Nodejs

Then we can use NPM to install Log.io.

Copy Code code as follows:

NPM install-g log.io--user "Chenqing"

After installation, start the server (no configuration required):

Copy Code code as follows:

Log.io-server

Configure the client after

Copy Code code as follows:

Vim ~/.log.io/harvester.conf

Exports.config = {
NodeName: "Application_server",
Logstreams: {
Test: [
"/users/chenqing/test.log"
]
},
Server: {
Host: ' 0.0.0.0 ',
port:28777
}
}

Start client: Log.io-harvester

Let's test this out:

First at the command line

Copy Code code as follows:

[chenqing@qing ~] for i in {1..1000};d o echo ' Date ' >> test.log;d One

Open Browser: http://localhost:28778/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.