UNPKG

pino-splunk-events

Version:
42 lines (32 loc) 1.32 kB
#!/usr/bin/env node "use strict"; var _command = require("@oclif/command"); var _errors = require("@oclif/errors"); var _createSplunkEventsStream = require("./node/createSplunkEventsStream"); var _getSplunk = require("./core/getSplunk"); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } class PinoSplunkEvents extends _command.Command { async run() { const parsed = this.parse(PinoSplunkEvents); const splunk = (0, _getSplunk.getSplunk)(parsed.flags); const writeStream = (0, _createSplunkEventsStream.createSplunkEventsStream)(splunk); process.stdin.pipe(process.stdout); process.stdin.pipe(writeStream); } } _defineProperty(PinoSplunkEvents, "description", 'Log events to splunk'); _defineProperty(PinoSplunkEvents, "flags", { endpoint: _command.flags.string({ description: 'Endpoint of your Splunk server', required: true }), token: _command.flags.string({ description: 'Token used to authenticate with the Splunk server', required: true }), debug: _command.flags.boolean({ description: 'Enable debugging mode', default: false }) }); PinoSplunkEvents.run().then(null, _errors.handle);