Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Parse nginx logs
JavaScript
branch: master

1.2.0

latest commit f9756a93bc
@chriso authored
Failed to load latest commit information.
.gitignore Adding some old stuff
LICENSE Adding some old stuff
README.md Add end end callback
index.js Add end end callback
package.json 1.2.0

README.md

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) {
    //...
});
Something went wrong with that request. Please try again.