GithubHelp home page GithubHelp logo

anton0 / sumocli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sumologic-labs/sumocli

0.0 0.0 0.0 20.12 MB

Sumocli is a CLI application written in Go that allows you to manage your Sumo Logic tenancy from the command line.

License: Apache License 2.0

Shell 1.63% Go 98.36% Dockerfile 0.01%

sumocli's Introduction

sumocli

A CLI application that lets you manage/automate your Sumo Logic tenancy.

Sumocli is currently in development so there could be bugs/incomplete functionality. GA will be v1.0.0 which I am expecting to be ready for release in Q1 2022.

Installation

Container Image

Container images for sumocli are hosted in GitHub Packages and can be pulled with the following command:

docker pull ghcr.io/sumologic-labs/sumocli:$VERSION-$ARCHITECTURE

Linux

You can install sumocli via apt on debian based linux distributions by running the following commands:

apt-key adv --fetch-keys https://apt.sumocli.app/public.key
add-apt-repository "deb https://apt.sumocli.app/ stable main"
apt-get update
apt-get install sumocli

macOS

You can install sumocli via homebrew on macOS by running the following commands:

brew tap sumologic-labs/homebrew-tap
brew install sumologic-labs/tap/sumocli

Windows

You can download a signed binary file from the specific release you want.

Build Yourself

You can build the sumocli application for your platform by performing the following steps:

Clone the sumocli repo

git clone https://github.com/SumoLogic-Labs/sumocli

The repo is using Go modules so you can run go build:

go build ./cmd/sumocli

Authentication

Sumocli uses two authentication methods;

  • Environment variables
  • Credentials file

When you run a command in sumocli it will first check to see if a credentials file exists, if it can't find one then it will fall back to environment variables. This is to ensure that sumocli can run in CI/CD pipelines. The sections below explain the requirements for each authentication type.

Environment Variables

Environment variable authentication is useful when running sumocli in a CI/CD pipeline or when using the Docker image. The following environment variables need to be set to allow for proper authentication.

SUMO_ACCESS_ID: abcefghi

SUMO_ACCESS_KEY: AbCeFG123

SUMO_ENDPOINT: https://api.<regioncode>.sumologic.com/api

For a full list of Sumo Logic regions to API endpoints see this page: https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security

Credentials File

The credentials file stores the same information as the environment variables however, it can be generated interactively using sumocli login. The Sumo Logic Access ID and Access Key are encrypted (using AES-256) before being written to the credentials file to reduce the risk of the credentials being used outside of Sumocli.

Encryption of the Sumo Logic Access ID and Access Key was added in v0.9.0 of Sumocli, if you are running an earlier version of Sumocli you will need to regenerate your credentials file by running sumocli login if you want to leverage encryption at rest. If you need to know which Access ID sumocli is configured to use you can run sumocli login --showAccessId and the plaintext access ID will be displayed.

The credential file is stored in the following locations depending on your operating system.

Windows: C:\Users\<username>\.sumocli\credentials\creds.json

Macos: /User/<username>/.sumocli/credentials/creds.json

Linux: /Usr/<username>/.sumocli/credentials/creds.json

The contents of the credential file is as follows:

{
  "version": "v1",
  "accessid": "abcefghi",
  "accesskey": "AbCeFG123",
  "region": "<regioncode>",
  "endpoint": "https://api.<regioncode>.sumologic.com/api"
}

Documentation

Documentation for each command can be found by using sumocli <command> --help

You can find a list of API endpoints and sources that Sumocli supports in the supported capabilities documentation.

Contributing

Clone or fork the repo, make your changes and create a pull request. I will then review it and all things looking good it gets merged!

If there is something in the code that you don't understand please feel free to email at [email protected].

sumocli's People

Contributors

actions-user avatar jburger avatar wizedkyle 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.