Code Monkey home page Code Monkey logo

lucidtail's Introduction

A real-time zero-configuration web-based tail. It broadcasts events such as new lines added to any monitored files, new UDP messages, and those emitted by other EventEmitters to your browser.

The lucidtail Command

The lucidtail command listens to specified sources and displays them in a pretty little web application (see demo).

To quickly be able to view your logs at http://localhost:8080:

lucidtail *.log

Installation

After having nodejs installed:

Method: Simple

To install lucidtail globally with npm:

npm install lucidtail -g

This allows you to use the lucidtail command. You may need root/Administrator access, if you don't have it you can alternately get lucidtail from the git repository.

Method: From GIT

Clone lucidtail:

git clone git://github.com/davidnqd/lucidtail.git

You should now be able to use ./index.js or node index.js within the cloned directory instead of lucidtail.

Examples

lucidtail will use it's default http port (8080) when running.

For more information: lucidtail --help

Monitor

Monitor all files ending with '.log':

lucidtail *.log

Monitor UDP messages on syslog port 5144:

lucidtail -u 5144
# TIP: If you want to test:
nc -w0 -u localhost 5144 <<< "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8"

Publish

On port 8081:

lucidtail *.log -u 514 -p 8081

lucidtail npm package

Install lucidtail as a dependency in your package.json:

cd example
npm init
npm install lucidtail --save

Monitor a test emitter (which sends a test message every second) and publish events on the default port (port 8080):

require('lucidtail')()
	.use('test');

Monitors UDP messages on port 5000:

require('lucidtail')()
	.use('udp4', 5000);

syslog

The following will display inbound syslog messages (UDP port 514) on HTTP port 80:

Notes:

  • This example uses lazy which is on npm.
  • Port 80 and 514 may require root/Administrator privileges to bind to.

Example:

var lucidtail = require('lucidtail'),
	lazy = require('lazy');

// Use a simple regex to parse out the values in the message
// Not even RFC 3164, but this is just an example.
var regex = /(<\d+>)?(\w{3} +\d+ \d{2}:\d{2}:\d{2})?( \w+)?( \w+\[?\d*\]?)?: (.*)/;
var syslog = lazy(lucidtail.emitter('udp4', 514))
	.map(function(data) {
		var matches = data.data.match(regex);
		if (matches) {
			if (matches[1])
				data.pri = matches[1].replace(/[<>]/g, '');
			if (matches[2])
				data.date = matches[2];
			if (matches[3])
				data.host = matches[3].substring(1);
			if (matches[4])
				data.application = matches[4].substring(1);
			if (matches[5])
				data.msg = matches[5];
		}
		return data;
	});

// Create aggregate emitter
var emitter = lucidtail(80)
	// Listen to a test emitter
	.listen(syslog);

lucidtail's People

Contributors

davidnqd avatar

Watchers

Andrew Gerst avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.