Git Product home page Git Product logo

nginx-parser's People

Contributors

chriso avatar heisice avatar inem0o avatar jgoyon avatar samhaing avatar thegp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-parser's Issues

"list" argument must be an Array of Buffers

I called method with parser.read(_path, function(row){}). and then go in

Parser.prototype.stream = function (stream, iterator, callback) {
    var self = this, overflow = new Buffer(0), complete = false;
    stream.on('data', function (data) {
        var buffer = Buffer.concat(overflow, data), newline = 0;
        for (var i = 0, len = buffer.length; i < len; i++) {
            if (buffer[i] === 10) {
                self.parseLine(buffer.slice(newline, i), iterator);
                newline = i + 1;
            }
        }
        overflow = buffer.slice(newline);
    });
    ...

showed me a error message:
"list" argument must be an Array of Buffers。

The overflow wasn't setted value. data was an array.
Could you answer my question?
Thank you very much.

IPv6 support

Hello, I'm from the future. I'd like to parse ipv6 addresses for store and nginx_parser currently fails at this task.

Example code is wrong

Example code:

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"');

first, nginx_parser is nginxparser

...then, with the example string:

node_modules/nginxparser/index.js:30
    this.parser = new RegExp(this.parser);
                  ^
SyntaxError: Invalid regular expression: /([^ ]+) - ([^ ]+) [([^ ]+) "([^ ]+) ([^ ]+) ([^ ]+) "([^ ]+) "(.+)$/: Unmatched ')'
    at new RegExp (unknown source)
    at new module.exports (node_modules/nginxparser/index.js:30:19)
    at Object.<anonymous> (feynman-ui/fetcher.js:11:14)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

To avoid forking this project it'd be cool if measures to address the following were added

So the regular expression generated from the log format gets pinned to the end of the line (looks like the following line of code does it index.js:32 - regex = '(.+)$';). It'd be convenient if the module made it configurable whether to lock to EOL or SOL.

The parser produces a lossy result ie. the result that can't be taken to generate the original input. In particular I'm referring to the translation of dashes/hypens to null (looks like the following line of code does it index.js:170 - if (row[key] === '-') {). Adding this change admittedly wouldn't mean the original line could be generated from the parsed result as we're not tracking the amount of whitespace between each item but. For this change I assume other users of the module are depending on dashes being parsed out as null so when constructing the parser object in addition to providing the format, optional parameters of whether to maintain dashes and whether to pin the regex to end or start of the line could be added.

time_iso8601 in format object breaks it

Something in the regex doesn't like $time_8601 format.

for example
new NginxParser('$remote_addr - $remote_user [$time_8601] ' + '"$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"');

fails to match any lines.

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.