nsyslog-parser
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "nsyslog-parser", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Syslog Parser. Accepts RFC 3164 (BSD) and RFC 5424 formats", | ||
@@ -5,0 +5,0 @@ "author": "David Gómez Matarrodona <solzimer@gmail.com>", |
@@ -33,2 +33,6 @@ const moment = require("moment"); | ||
} | ||
else { | ||
entry.pri = ""; | ||
entry.prival = NaN; | ||
} | ||
@@ -35,0 +39,0 @@ //Split message |
@@ -9,39 +9,42 @@ # nsyslog-parser | ||
**Use** | ||
```javascript | ||
const parser = require("nsyslog-parser"); | ||
const parser = require("nsyslog-parser"); | ||
var bsdLine = "<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8"; | ||
var ietfLine = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8"; | ||
console.log(parser(bsdLine); | ||
console.log(parser(ietfLine); | ||
var bsdLine = "<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8"; | ||
var ietfLine = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8"; | ||
console.log(parser(bsdLine); | ||
console.log(parser(ietfLine); | ||
``` | ||
**Result** | ||
{ | ||
originalMessage: '<34>Oct 11 22:14:15 mymachine su: \'su root\' failed for lonvick on /dev/pts/8', | ||
pri: '<34>', | ||
prival: 34, | ||
type: 'BSD', | ||
ts: 2017-10-11T20:14:15.000Z, | ||
host: 'mymachine', | ||
appName: 'su', | ||
message: '\'su root\' failed for lonvick on /dev/pts/8', | ||
fields: [], | ||
header: '<34>Oct 11 22:14:15 mymachine su: ' | ||
} | ||
{ | ||
originalMessage: '<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM\'su root\' failed for lonvick on /dev/pts/8', | ||
pri: '<34>', | ||
prival: 34, | ||
version: 1, | ||
type: 'RFC5424', | ||
ts: 2003-10-11T22:14:15.003Z, | ||
host: 'mymachine.example.com', | ||
appName: 'su', | ||
pid: '-', | ||
messageid: 'ID47', | ||
structuredData: '-', | ||
message: 'BOM\'su root\' failed for lonvick on /dev/pts/8', | ||
fields: [], | ||
header: '<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - ' | ||
} | ||
```javascript | ||
{ | ||
originalMessage: '<34>Oct 11 22:14:15 mymachine su: \'su root\' failed for lonvick on /dev/pts/8', | ||
pri: '<34>', | ||
prival: 34, | ||
type: 'BSD', | ||
ts: '2017-10-11T20:14:15.000Z', | ||
host: 'mymachine', | ||
appName: 'su', | ||
message: '\'su root\' failed for lonvick on /dev/pts/8', | ||
fields: [], | ||
header: '<34>Oct 11 22:14:15 mymachine su: ' | ||
} | ||
{ | ||
originalMessage: '<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM\'su root\' failed for lonvick on /dev/pts/8', | ||
pri: '<34>', | ||
prival: 34, | ||
version: 1, | ||
type: 'RFC5424', | ||
ts: '2003-10-11T22:14:15.003Z', | ||
host: 'mymachine.example.com', | ||
appName: 'su', | ||
pid: '-', | ||
messageid: 'ID47', | ||
structuredData: '-', | ||
message: 'BOM\'su root\' failed for lonvick on /dev/pts/8', | ||
fields: [], | ||
header: '<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - ' | ||
} | ||
``` |
const parser = require("./parser.js"); | ||
console.log(parser("<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8")); | ||
console.log(parser("<34>Oct 11 caca mymachine su: 'su root' failed for lonvick on /dev/pts/8")); | ||
console.log(parser("<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8")); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5350
107
50