Skip to main content

Logsight CLI Python

Project description

Build Package version https://img.shields.io/pypi/pyversions/logsight-cli-py.svg Documentation Status Weekly PyPI downloads logsight.ai on Twitter

Scope

How To Make Quality Gates in CI/CD with GitHub

Logsight Command Line Interface

The Logsight Command Line Interface (CLI) is a unified tool to manage your logs. With this tool, you can manage your logs, applications, tags and execute operations such as log verification.

Commands available include:

  • Applications
    • Create and delete applications

  • Users
    • Register, activate and delete users (not yet available)

    • Change and reset password (not yet available)

  • Analytics
    • Compare logs

    • Detect incidents in logs

Installation

The CLI can can installed using pip from PyPI. It has been tested with Mac and Linux operating systems.

$ pip install logsight-cli-py

Prerequisite

You have a Logsight account with EMAIL and PASSWORD.

Configuring Logsight CLI

There are several methods you can use to configure the settings that the Logsight CLI uses when interacting with Logsight.ai service, i.e. Logsight URL and account API keys. Account API keys can be created in API.

There is a specific load order for what will be used.

Using Logsight Config

You can create a .logsight config file to set up your configuration with Logsight server. The file should be placed in your home directory.

$ cat ~/.logsight
[DEFAULT]
EMAIL = john.miller@zmail.com
PASSWORD = sawhUz-hanpe4-zaqtyr
APP_ID = 07402355-e74e-4115-b21d-4cbf453490d1

Setting the variable APP_ID is optional. It can be set if you frequently use the same application and want to avoid passing the Id as a parameter for each command invoked.

Using Environment Variables

You can also set the variables using your environment, LOGSIGHT_EMAIL, LOGSIGHT_PASSWORD and LOGSIGHT_APP_ID. Environment variables take precedence over config variables.

$ export LOGSIGHT_EMAIL=john.miller@zmail.com
$ export LOGSIGHT_PASSWORD=sawhUz-hanpe4-zaqtyr
$ export LOGSIGHT_APP_ID=07402355-e74e-4115-b21d-4cbf453490d1

Alternatively, to set the required environment variables for the Logsight command-line client, you can create an environment file called an Logsight rc file, or logsightrc.sh file. A sample file is available at bin/logsightrc.sh. You can update it and, afterwards, source it:

$ source bin/logsightrc.sh

Passing Options

If you choose not to use the logsight config file or set environment variables, you can pass the same values as options as part of any logsight command.

$ python -m src.ls-cli --email john.miller@zmail.com --password sawhUz-hanpe4-zaqtyr applications ls

Examples

Single Commands

The following list provides examples of useful commands:

$ python -m src.ls-cli config
EMAIL: john.miller@zmail.com, PASSWD: sawhUz-hanpe4-zaqtyr, APP_ID: 07402355-e74e-4115-b21d-4cbf453490d1

$ python -m src.ls-cli application ls
+--------------------------------------+------------------+
|            APPLICATION Id            |       NAME       |
+--------------------------------------+------------------+
| 84c2ca94-e39c-498f-ad0d-0263434c71ac |    hdfs_node     |
| 8b6cd73b-299b-4f2b-8334-3b820434a23a |   node_manager   |
| 208d3b6d-15b7-402d-b53a-4c32c2eff623 | resource_manager |
| 7a858f4f-33f7-4bba-ac5e-bd5fec0bd9a2 |    name_node     |
+--------------------------------------+------------------+

$ python -m src.ls-cli application create --name <app name>
$ python -m src.ls-cli application delete --app_id <app id>

$ python -m src.ls-cli log upload <file> --tag v1 --app_id <app id>
$ python -m src.ls-cli log tag ls --app_id <app id>
$ [Under development] python -m src.ls-cli log status --flush_id --app_id <app id>

$ python -m src.ls-cli compare log --app_id <app id> --tags <tag v1> <tag v2> --flush_id <flush id>
$ python -m src.ls-cli incident log --app_id <app id> --tag <tag v1>
$ [Under development] python -m src.ls-cli quality log --app_id <app id> --tags <tag v1>

Comparing Logs

$ python -m src.ls-cli application create --name apache_srv2
$ # copy the <app_id> returned to next command
$ export LOGSIGHT_APP_ID=<app_id>
$ python -m src.ls-cli log upload hadoop_name_node_v1 --tag v1
$ python -m src.ls-cli log upload hadoop_name_node_v1 --tag v2
$ # copy <flush_id> returned to next command
$ python -m src.ls-cli compare log --tags v1 v2 --flush_id <flush_id>

Availability

The Logsight CLI Python package is deployed to the following external platforms:

  • Test Python Package Index (TestPyPI): Test PyPI

  • Python Package Index (PyPI): PyPI

  • Documentation: docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logsight-cli-py-0.0.2.tar.gz (91.3 kB view hashes)

Uploaded Source

Built Distribution

logsight_cli_py-0.0.2-py3-none-any.whl (12.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page