0.3.2 • Published 7 years ago

json-log-stream v0.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

json-log-stream

NPM Version Build Status

JSON log stream processor

A JSON log is called newline-delimited JSON and used for structured logs.

Install

$ npm install -g json-log-stream

How to Use

Create proc.js

exports.process = async (item) => {
  // filter
  if (item.target === 'my_require') {
    return item;
  }
}

// Optional
exports.finalize = async function(items) {
  // sort
  return this.sortBy(items, 'age')
}

exports.before = async function(cliArg1, cliArg2) {
  // const anotherLogs = await this.readJSONLogFile('./another.log')
  // const userMap = this.keyBy(anotherLogs, 'user.name')
  // await startServer()
}

exports.after = async function(items) {
  // await shutdownServer()
}

Run command

$ gunzip -c application-json.log.gz | jls proc.js > output_json.log

License

MIT

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago