sumo-api
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

What is this repository?

The goal of this repository is to build a Typescript/Javascript abstraction for the Sumo Logic API. It allows you to quickly accomplish tasks with many details hidden by the package.

import { SumoApi } from "sumo-api";

const accessId = ""
const accessKey = "";
const baseURL = "";

console.log(await (async () => {
    const api = new SumoApi({ accessId, accessKey, baseURL });

    const dashboard = await api.dashboard.get("<dashid>");

    if ("error" in dashboard) {
        return "error getting dashboard";
    }

    for (let panel of dashboard.panels) {
        if (panel.queries) {
            for (let query of panel?.queries) {
                const search = await api.search.getAll({
                    "query": query.queryString,
                    "from": "2023-01-01T12:00:00",
                    "to": "2023-01-02T12:15:00",
                    "timeZone": "PST",
                    "byReceiptTime": true
                });

                if ("error" in search) {
                    return "error starting search: " + search.error;
                }

                process.exit(0);
            }
        }
    }
})());

Dependents (0)

Package Sidebar

Install

npm i sumo-api

Weekly Downloads

0

Version

0.0.2

License

ISC

Unpacked Size

409 kB

Total Files

11

Last publish

Collaborators

  • oshoghi