Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ginx

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ginx - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

12

demo.js

@@ -34,3 +34,3 @@ /**

// turning that to False will impact performance positevly as well, but of course everything depends on what you're trying to do with the logs,
var parser = new Ginx({'persistent': true, 'fieldsToObjects': false});
var parser = new Ginx('$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time', {'persistent': true, 'fieldsToObjects': false});

@@ -40,3 +40,3 @@

//(you can test them together, it's just if you're parsing a mutual file, it's record will get overwritten by the last occurence and you will get the its rowCallbacks twice)
///*
/*
parser.parseDir(path.join(__dirname, "/./test/tmplogs"),

@@ -79,4 +79,4 @@ function (err, row) {

//UNCOMMENT THIS BLOCK, COMMENT THE ONE ABOVE, to try out parseFile() alone
/* // IF YOU WANT TO ONLY RUN THIS TEST parseFile (a single file) change the first param in setupTest to 0 - so you won't have to wait for it to create mock files
parser.parseFile(path.join(__dirname, "/./test/logs/nginx_prod-small.log"),
// IF YOU WANT TO ONLY RUN THIS TEST parseFile (a single file) change the first param in setupTest to 0 - so you won't have to wait for it to create mock files
parser.parseFile(path.join(__dirname, "/./test/logs/nginx_prod-tiny.log"),
//parser.parseFile("/Users/akhoury/.Trash/nginx_prod-enourmous.log",

@@ -89,3 +89,3 @@ function (err, row) {

//console.log("[GINX-DEBUG-DEMO] " + JSON.stringify(row));
console.log("[GINX-DEBUG-DEMO] " + JSON.stringify(row));
},

@@ -96,4 +96,4 @@ function(err, file){

);
*/
// */
/// BLOCK ENDS HERE
});

@@ -17,2 +17,3 @@

path = require('path'),
EOL = require('os').EOL,
cp = require('child_process'),

@@ -47,2 +48,5 @@ //caches memory

this.attrs = stripStringArray(this.format.match(/\$\w+/g), '$');
if (this.delimeters.length < this.attrs.length) {
this.delimeters.push(EOL);
}
this.fieldsToObjects = options && typeof options.fieldsToObjects === "boolean" ? options.fieldsToObjects : false;

@@ -74,2 +78,6 @@ this.originalText = options && typeof options.originalText === "boolean" ? options.originalText : false;

}, 200);
console.log('DELIM');
console.log(this.delimeters, this.attrs);
this.hardParseLine = generateParseLine(this, this.delimeters, this.attrs);

@@ -338,3 +346,3 @@ }

for (var i = 0; i < ln; i++) {
funcode += 'b=line.indexOf(\'' + delim[i] + '\',a);\n';
funcode += delim[i] == EOL ? 'b=line.length;\n' : 'b=line.indexOf(\'' + delim[i] + '\',a);\n';
funcode += 'if(b > 0) {\n\tresult["' + attrs[i] + '"] = ';

@@ -350,3 +358,3 @@ funcode += ctx.fieldsToObjects ? 'that.convertValue("' + attrs[i] + '", line.substring(a, b));' : 'line.substring(a, b);';

//for the sake of Maintenance, uncomment this log statement and run a demo to see how this function would look like based on your nginx_access log format
//console.log(funcode);
console.log('\n\nfunction generatedParseLineFunction () {\n\t' + funcode.split('\n').join('\n\t') + '\n}');
return Function.apply(ctx, [args, funcode]);

@@ -353,0 +361,0 @@ }

{
"name": "ginx",
"version": "0.0.3",
"version": "0.0.4",
"directories": {

@@ -5,0 +5,0 @@ "lib": "./lib"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc