feathers-splunk

    1.0.3 • Public • Published

    feathers-splunk

    Dependency Status Download Status

    Installation

    npm install feathers-splunk --save
    

    Documentation

    Complete Example

    Here's an example of a Feathers server that uses feathers-splunk.

    app.js

    const feathers = require("@feathersjs/feathers");
    const { splunk } = require("feathers-splunk");
     
    // Initialize the application
    const app = feathers();
     
    // Initialize the plugin
    app.configure(
      splunk({
        token: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        url: "<SPLUNK_URL>" // usually have the port of 8088
      })
    );

    xx.hooks.js

    const { splunkHooks } = require("feathers-splunk");
     
    // Add it to the hooks of services
     
    module.exports = {
      before: {
        all: [splunkHooks()], // for logging data when before hook called
        find: [],
        get: [],
        create: [],
        update: [],
        patch: [],
        remove: []
      },
     
      after: {
        all: [splunkHooks()], // for logging data when after hook called
        find: [],
        get: [],
        create: [],
        update: [],
        patch: [],
        remove: []
      },
     
      error: {
        all: [splunkHooks()], // For logging errors
        find: [],
        get: [],
        create: [],
        update: [],
        patch: [],
        remove: []
      }
    };

    Customization

    For creating custom index for splunk
    1. Create New Index in settings/Indexes (splunk)
    2. Link the created indexes into settings/indexes (HTTP Event Collector)
    3. Modify the app.js configuration to the below
      app.configure(
        splunk({
          token: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          url: "<SPLUNK_URL>" // usually have the port of 8088,
          index: 'senthil'
        })
      );
    Changing the metadata of the splunk logging
    1. Modify the xx.hooks.js to the metadata below
      before: {
        all: [
          splunkHooks({
            source: "/message",
            sourcetype: "rest-call",
            index: "senthil",
            host: "http://localhost",
            port: "3000"
          })
        ], // for logging data when before hook called
        find: [],
        get: [],
        create: [],
        update: [],
        patch: [],
        remove: []
      }

    License

    Copyright (c) 2018

    Licensed under the MIT license.

    Author

    Senthil Kumar Bhaskaran

    Install

    npm i feathers-splunk

    DownloadsWeekly Downloads

    5

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    8.01 kB

    Total Files

    6

    Last publish

    Collaborators

    • senthiljruby