logagent-js
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -105,2 +105,5 @@ #!/usr/bin/env node | ||
console.error(duration + ' ms ' + count + ' lines parsed. ' + throughput.toFixed(0) + ' lines/s ' + throughputBytes.toFixed(3) + ' MB/s - empty lines: ' + emptyLines) | ||
console.error('Heap Used: ' + (process.memoryUsage().heapUsed / (1024 * 1024)) + ' MB') | ||
console.error('Heap Total: ' + (process.memoryUsage().heapTotal / (1024 * 1024)) + ' MB') | ||
console.error('Memory RSS: ' + (process.memoryUsage().rss / (1024 * 1024)) + ' MB') | ||
} | ||
@@ -107,0 +110,0 @@ process.exit() |
@@ -14,2 +14,3 @@ /* | ||
var moment = require('moment') | ||
var crypto = require('crypto') | ||
@@ -26,2 +27,3 @@ function LogParser (fileName, options) { | ||
this.cfg = yaml.load(fs.readFileSync(name, 'utf8')) | ||
console.log('Hashing field content enabled for field names: ' + this.cfg.autohash) | ||
// console.log(this.cfg) | ||
@@ -76,2 +78,7 @@ this.patterns = this.cfg.patterns | ||
}, | ||
hash: function hash (input) { | ||
var sha1 = crypto.createHash('sha1') | ||
sha1.update(input.toString()) | ||
return sha1.digest('hex') | ||
}, | ||
parseDate: function (strDate, dateFormat) { | ||
@@ -99,2 +106,7 @@ var d = null | ||
} | ||
if (this.cfg.autohash && this.cfg.autohash.test(p.fields[i])) | ||
{ | ||
value = this.hash(value) | ||
// p.hash = this.hash | ||
} | ||
parsed[p.fields[i]] = value | ||
@@ -101,0 +113,0 @@ } |
{ | ||
"name": "logagent-js", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Smart log parser written in Node", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,2 +9,3 @@ # logagent-js | ||
- extract fields using regex | ||
- if 'autohash' is enabled, sensitive data is replaced with its sha1 hash code | ||
- parse dates and detect date format | ||
@@ -42,2 +43,7 @@ (use 'ts' field for date and time combined) | ||
``` | ||
# Sensitive data can be replaced with a hascode (sha1) | ||
# for all fields matching this field names by a regular expression | ||
# this function is not optimized (yet) and might take 10-15% of performance | ||
# autohash: !!js/regexp /user|client_ip|password|email|credit_card_number|payment_info/i | ||
patterns: | ||
@@ -44,0 +50,0 @@ - # APACHE Web Logs |
Sorry, the diff of this file is not supported yet
40155
320
212