GithubHelp home page GithubHelp logo

weblogger's Introduction

WebLogger

Splunk logging for the web.

Core Features

  • Sends events directly to Splunk from within the browser.
  • Utilizes sendBeacon API for asynchronous event transmission.
  • Supports ECMAScript Modules.
  • Works with latest version of all major browsers and frameworks.
  • Small package size, light on resources, and free of external dependences.

Basic Usage

import WebLogger from "@splunk/weblogger";

const logger = new WebLogger({
  origin: "https://my.splunk.instance.com:8088",
  token: "11111111-2222-3333-4444-555555555555",
});

logger.debug({ event: "time_to_first_paint", duration: 172 });
logger.info({ action: "user_logged_in", username: "bob" });
logger.warn({ type: "violation", reason: "setTimeout handler took 82ms" });
logger.error({ message: "timeout while waiting for fetch", url: "/api/items" });

Advanced Configuration.

param Type Default Required Description
origin string undefined yes The origin of your Splunk instance.
token string undefined yes The Splunk access token provided by your HEC endpoint.
index string undefined no Overrides the default index of the HEC.
host string undefined no Overrides the default host of the HEC.
source string undefined no Overrides the default source of the HEC.
sourceType string undefined no Overrides the default sourcetype of the HEC.
bufferSize number 1024 no The max size of events you want to store before sending.
defaultMeta object {} no Default meta data you would like to append to each event.
levels array ['debug', 'info', 'warn', 'error'] no The log levels you want to support ascending by priority.
sendLevel string 'info' no The level at which you want to start sending events to Splunk.

Doesn't splunk-javascript-logging already do this?

Yes however there a few issues with this package.

  • No official Splunk support.
  • Not actively maintained.
  • Dependancies have been marked as deprecated.
  • Most importantly, it will not work in browsers.

weblogger's People

Contributors

kellengreen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.