Giter VIP home page Giter VIP logo

log2splunk's Introduction

log2splunk

Log to Splunk

Build Status codecov npm version

Usage

const Log2Splunk = require('log2splunk');

const logger = new Log2Splunk({
  token: "your-token",
  host: "splunk-hec.example.com"
});

// Send string
logger.send("Hello World");

// Send json
logger.send({
  message: "Hello World";
});

// Send with metadata
logger.send("Hello World", {
  source: 'my-app',
  sourcetype: '_raw'
})


// Send Raw
logger.sendRaw("Hello World");

Options

Name Description Type Default
token The Splunk HEC token, required String null
protocol The Splunk HEC protocol http || https https
host The Splunk HEC host String localhost
port The Splunk HEC port Number 8088
path The Splunk HEC path String /services/collector
source Then event source String log2splunk
index The event index String Extend your HEC token info
https The https config, more info in https options Object null

Metadata

Name Description Type Default
time The event time in epoch time, in the format \<sec\>.\<ms\>. For example, 1433188255.500 indicates 1433188255 seconds and 500 milliseconds after epoch, or Monday, June 1, 2015, at 7:50:55 PM GMT. Number now
host The host value to assign to the event data. This is typically the hostname of the client from which you're sending data. String
source The source value to assign to the event data. For example, if you're sending data from an app you're developing, you could set this key to the name of the app. String
sourcetype The sourcetype value to assign to the event data. String httpevent
index The name of the index by which the event data is to be indexed. The index you specify here must be within the list of allowed indexes if the token has the indexes parameter set. String
fields (Not applicable to raw data.) Specifies a JSON object that contains explicit custom fields to be defined at index time. Requests containing the "fields" property must be sent to the /collector/event endpoint, or they will not be indexed. For more information, see Indexed field extractions. String or Object<String, String | Array<String>>

Async/Await

(async () => {
  await logger.send('Hello async/await');
})();

Reference

HTTP Event Collector Examples

log2splunk's People

Contributors

kunyan avatar renovate-bot avatar renovate[bot] avatar

Watchers

 avatar  avatar  avatar

log2splunk's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency prettier to v3
  • chore(deps): update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • fix(deps): update dependency got to v14
  • fix(deps): update dependency uuid to v9 (uuid, @types/uuid)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v2
  • actions/setup-node v2
  • codecov/codecov-action v2.1.0
.github/workflows/release.yml
  • actions/checkout v2
  • actions/setup-node v2
npm
package.json
  • got ^11.8.0
  • uuid ^8.3.2
  • @types/chai 4.3.16
  • @types/mocha 9.1.1
  • @types/uuid 8.3.4
  • @typescript-eslint/eslint-plugin 5.30.0
  • @typescript-eslint/parser 5.30.0
  • chai 4.4.1
  • eslint 7.32.0
  • eslint-config-prettier 8.10.0
  • husky 7.0.4
  • lint-staged 12.5.0
  • mocha 9.2.2
  • nock 13.5.4
  • nyc 15.1.0
  • prettier 2.8.8
  • rimraf 3.0.2
  • ts-node 10.9.2
  • typescript 4.9.5

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

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.