nginxparser

Parse Nginx log files

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
nginxparser
6122.1.06 years ago11 years agoMinified + gzip package size for nginxparser in KB

Readme

nginx-parser parse nginx log files in node.js

Installation

$ npm install nginxparser

Usage

To read a log file
var NginxParser = require('nginxparser');

var parser = new NginxParser('$remote_addr - $remote_user [$time_local] '
		+ '"$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"');

parser.read(path, function (row) {
    console.log(row);
}, function (err) {
    if (err) throw err;
    console.log('Done!')
});

To read from stdin, pass - as the path.
To tail a log file (equivalent to tail -F)
parser.read(path, { tail: true }, function (row) {
    //...
});