syslog-parse
v2.0.0
Published
Parse syslog-formatted messages
Downloads
6,995
Readme
syslog-parse
Parse syslog-formatted messages.
Installation
$ npm install --save syslog-parse
Usage
import parse from 'syslog-parse';
const log = parse(
'<38>Feb 05 01:02:03 abc system[253]: Listening at 0.0.0.0:3000',
);
/*
log = {
priority: 38,
facilityCode: 4,
facility: 'auth',
severityCode: 6,
severity: 'info',
time: Thu Feb 05 2015 01:02:03 GMT+0100 (CET),
host: 'abc',
process: 'system',
pid: 253,
message: 'Listening at 0.0.0.0:3000'
}
*/
API
parse(input)
If input
can't be parsed, it returns undefined
. Otherwise it returns an object.
input
Type: string
Log string.