blarsen / node-alpine

Alpine - the Apache Log Parser for Node.js
Apache License 2.0
16 stars 6 forks source link

Multiple fields within quotes not handled #1

Open jamienz opened 8 years ago

jamienz commented 8 years ago

Alpine successfully handles a log format with a single field inside quotes, e.g.

var alpine = new Alpine("\"%h\"");

However it doesn't like it if the log format has multiple fields inside the same set of quotes, e.g.

var alpine = new Alpine("\"%h %h\"");

I believe having multiple fields inside the same set of quotes is a valid scenario.

The stacktrace:

S:\dev\scratch\node_modules\alpine\alpine.js:110
            throw new Error("Field does not start with %: "+field);
            ^

Error: Field does not start with %: "%h
    at parseLogFormat (S:\dev\scratch\node_modules\alpine\alpine.js:110:19)
    at setLogFormat (S:\dev\scratch\node_modules\alpine\alpine.js:65:25)
    at new Alpine (S:\dev\scratch\node_modules\alpine\alpine.js:25:14)
    at Object.<anonymous> (S:\dev\scratch\selflog2sp.js:4:14)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:117:18)
musicin3d commented 5 years ago

+1 AWS ELB logs include method, url, and protocol within the same quotes.