Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tail Log Output With Node.js

DZone's Guide to

Tail Log Output With Node.js

·
Free Resource
Need some tail look output for your metrics?  For Node.js, here's your solution, straight from Lance Pollard
// http://nodejs.org/api.html#_child_processes
var sys = require('sys')
var spawn = require('child_process').spawn;
var filename = process.ARGV[2];

if (!filename)
  return sys.puts("Usage: node 
   
   
    ");

var tail = spawn("tail", ["-f", filename]);
sys.puts("start tailing");

tail.stdout.on("data", function (data) {
  sys.puts(data);
});

// node tail.js development.log
   
  
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}