good-json-schema-filter
A Good log object transform stream which filters via json-schema
Installation:
npm i good-json-schema-filter --save
What problem does this solve?
This library allows you to omit keys or entire log objects matched via json-schema syntax.
Example
const Stream = const SafeJson = SafeJsonconst GoodJsonSchemaFilter = const mockLogStream = objectMode: truemockLogStream {} const transform = rules: name: 'omit-log-object-keys-example-rule' test: properties: type: enum: 'filtered-type-omitted-keys' required: 'type' action: // omit's the foo and bar property omit: 'foo' 'bar' name: 'omit-log-object-example-rule' test: properties: type: enum: 'this-will-not-make-it-through' required: 'type' action: // omits the entire object omit: true mockLogStream mockLogStreammockLogStreammockLogStream
This prints:
"type":"filtered-type-omitted-keys""type":"this-will-be-passed-through""foo":"bar""baz":"bar"