Giter Site home page Giter Site logo

signpost / splunk-javascript-logging Goto Github PK

View Code? Open in Web Editor NEW

This project forked from splunk/splunk-javascript-logging

0.0 1.0 0.0 265 KB

Splunk HTTP Event Collector logging interface for JavaScript

Home Page: http://dev.splunk.com/view/splunk-logging-javascript/SP-CAAAE63

License: Apache License 2.0

JavaScript 99.25% Makefile 0.63% Shell 0.12%

splunk-javascript-logging's Introduction

Splunk logging for JavaScript

Version 0.11.1

This project provides a simple JavaScript interface for logging to HTTP Event Collector in Splunk Enterprise and Splunk Cloud.

Requirements

  • Node.js v4 or later. Splunk logging for Javascript is tested with Node.js v10.0 and v14.0.
  • Splunk Enterprise 6.3.0 or later, or Splunk Cloud. Splunk logging for Javascript is tested with Splunk Enterprise 8.0 and 8.2.0.
  • An HTTP Event Collector token from your Splunk Enterprise server.

Installation

First, update npm to the latest version by running:

sudo npm install npm -g

Then run:

npm install --save splunk-logging

Usage

See the examples folder for usage examples:

  • all_batching.js: Shows how to configure a logger with the 3 batching settings: batchInterval, maxBatchCount, & maxBatchSize.
  • basic.js: Shows how to configure a logger and send a log message to Splunk.
  • custom_format.js: Shows how to configure a logger to log messages to Splunk using a custom format.
  • manual_batching.js: Shows how to queue log messages, and send them in batches by manually calling flush().
  • retry.js: Shows how to configure retries on errors.

SSL

Note: SSL certificate validation is disabled by default. To enable it, set requestOptions.strictSSL = true on your SplunkLogger instance:

var SplunkLogger = require("splunk-logging").Logger;

var config = {
    token: "your-token-here",
    url: "https://splunk.local:8088"
};

var Logger = new SplunkLogger(config);

// Enable SSL certificate validation
Logger.requestOptions.strictSSL = true;

Basic example

var SplunkLogger = require("splunk-logging").Logger;

var config = {
    token: "your-token-here",
    url: "https://splunk.local:8088"
};

var Logger = new SplunkLogger(config);

var payload = {
    // Message can be anything; doesn't have to be an object
    message: {
        temperature: "70F",
        chickenCount: 500
    }
};

console.log("Sending payload", payload);
Logger.send(payload, function(err, resp, body) {
    // If successful, body will be { text: 'Success', code: 0 }
    console.log("Response from Splunk", body);
});

Community

Stay connected with other developers building on Splunk software.

Email [email protected]
Issues https://github.com/splunk/splunk-javascript-logging/issues/
Answers http://answers.splunk.com/
Blog http://blogs.splunk.com/dev/
Twitter @splunkdev

Support

The Splunk logging library for JavaScript is community-supported.

  1. You can find help through our community on Splunk Answers (use the logging-library-javascript tag to identify your questions).
  2. File issues on GitHub.

Contact us

You can contact support if you have Splunk related questions.

You can reach the Dev Platform team at [email protected].

License

The Splunk Logging Library for JavaScript is licensed under the Apache License 2.0. Details can be found in the LICENSE file.

splunk-javascript-logging's People

Contributors

akaila-splunk avatar ashah-splunk avatar davidbaskin33 avatar dependabot[bot] avatar fantavlik avatar mtevenan-splunk avatar nickarnold avatar pking70 avatar shakeelmohamed avatar

Watchers

 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.