Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

sumologic-api-client

bkon36ISC1.1.0TypeScript support: included

SumoLogic API client

readme

SumoLogic API client

Convenience wrapper (with typescript declarations) around the Search Job API.

See also: rx-sumologic-api-client - RxJS convenience wrapper.

Installation

Use npm or yarn:

npm install --save sumologic-api-client
yarn add sumologic-api-client

Usage

import * as moment from "moment";
import * as Sumo from "sumologic-api-client";

const client = Sumo.client({
  endpoint: "https://api.au.sumologic.com/api/v1",
  sumoApiId: "SUMO_API_ID",
  sumoApiKey: "SUMO_API_KEY"
});

client
  .job({
    query: "ERROR | count",
    from: moment().subtract(1, "day").format(),
    to: moment().format(),
    timeZone: "Australia/Sydney"
  })
  .then((data) => console.log("Created job: " + data.id));

const jobId = "SAMPLE JOB ID";

client
  .status(jobId)
  .then((data) => console.log("Status: " + JSON.stringify(data)));

client
  .messages(jobId)
  .then((data) => console.log("Messages: " + JSON.stringify(data)));

client
  .records(jobId)
  .then((data) => console.log("Records: " + JSON.stringify(data)));

client
  .delete(jobId);

What is the endpoint parameter?

See Sumo Logic Endpoints for the list of endpoints you can use.

changelog

Changelog

1.1.0

Changed

  • Typescrip Interface names were updated to starts with I (compliance with the default tslint config)
  • Pagination options are now optional to calls to messages and records

Fixed

  • @types dependencies have been moved to the devDependencies section. My bad.
  • Misleading samples in README were fixed to contain working code.