Skip to content

iNem0o/nginx_parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx_parser parse nginx log files in node.js

Installation

$ npm install nginxparser

Usage

To read a log file

var NginxParser = require('nginx_parser');

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);
});

To read from stdin, pass - as the path.

To tail a log file (equivalent to tail -F)

parser.read(path, { tail: true }, function (row) {
    //...
});

To use a callback after reading

parser.read(path, { onEnd: function(parser){
    //...
} }, function (row) {
    //...
});

About

An nginx log parser for node

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%