Socket
Socket
Sign inDemoInstall

@mapbox/sumo

Package Overview
Dependencies
65
Maintainers
117
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/sumo

A Node.js SDK for Sumo Logic's Search Job API


Version published
Maintainers
117
Weekly downloads
2
decreased by-33.33%

Weekly downloads

Readme

Source

sumo

A Node.js SDK for Sumo Logic's Search Job API

API

createReadStream

Create a readable stream of messages or records that result from a Sumo Logic search. Messages are the raw log messages, records are the result of a search with some form of aggregation (e.g. count by _sourceCategory). Credentials can be provided explicitly, or read from environment variables: SUMO_LOGIC_ACCESS_ID and SUMO_LOGIC_ACCESS_KEY.

Parameters

  • type string one of messages or records
  • search object Sumo Logic search parameters
    • search.query string the query string
    • search.from number the starting timestamp in ms
    • search.to number the ending timestamp in ms
    • search.auth object? Sumo Logic credentials
      • search.auth.accessId string? Sumo Logic access ID
      • search.auth.accessKey string? Sumo Logic access key
  • options object readable stream options

Examples

const sumo = require('@mapbox/sumo');
const search = {
  query: '"error" | count by _sourceCategory',
  from: 1487733054071,
  to: 1487733356114,
  auth: {
    accessId: xxx,
    accessKey: xxxx
  }
};
const messages = sumo.createReadStream('messages', search);
messages.on('data', (msg) => console.log(msg));

Returns object a readable stream of messages or records

Perform a search limited to less that 100 results. This will return both raw messages and aggregate records where applicable. Credentials can be provided explicitly, or read from environment variables: SUMO_LOGIC_ACCESS_ID and SUMO_LOGIC_ACCESS_KEY.

Parameters

  • search object Sumo Logic search parameters
    • search.query string the query string
    • search.from number the starting timestamp in ms
    • search.to number the ending timestamp in ms
    • search.limit number? the maximum number of messages/records (optional, default 100)
    • search.auth object? Sumo Logic credentials
      • search.auth.accessId string? Sumo Logic access ID
      • search.auth.accessKey string? Sumo Logic access key
  • callback function? a function to call with the results

Examples

const sumo = require('@mapbox/sumo');
const search = {
  query: '"error" | count by _sourceCategory',
  from: 1487733054071,
  to: 1487733356114,
  auth: {
    accessId: xxx,
    accessKey: xxxx
  }
};
sumo.search(search, (err, data) => {
  if (err) throw err;
  data.messages.forEach((msg) => console.log(msg));
  data.records.forEach((rec) => console.log(rec));
});

Returns promise resolves with the results, an object with two properties, each of which are an array: .messages and .records

FAQs

Last updated on 04 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc