syslog-parse
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

syslog-parse Build Status

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.

Readme

Keywords

none

Package Sidebar

Install

npm i syslog-parse

Weekly Downloads

835

Version

2.0.0

License

MIT

Unpacked Size

5.8 kB

Total Files

5

Last publish

Collaborators

  • vdemedes