Package: logsight-cli-py
Logsight Command Line InterfaceThe 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 analytics over logs such as verification.Commands available include:ObjectDescriptionApplicationsCreate and delete applicationsUsersRegister, activate and delete users (not yet available)Change and reset password (not yet available)LogsUpload log filesObtain tagsAnalyticsCompare logs
Detect incidents in logsUse CaseDescriptionYou have just developed a new version V2 of your applicationYou are not sure if the new version has major bugs that were undetected by your testsYou decide to compare the logs generated by your tests for versions V1 and V2Since manually comparing logs is an Herculean task, you submit the logs to logsight.ai for verificationlogsight.ai returns back a report with various metrics and a deployment risk scoreSince the risk score is high, you reject the deployment of the new applicationFor the impatientOnce you have an account withLogsight.ai, you can execute ourHello World.The risk of deployment is 23%. Thus, it is safe to deploy version v2 of the application.To replicate the previous execution in your environment, you can use the following code:$logsightapplicationcreate--namehadoop_name_nodeapp_id: a3de4ae5-a0be-42c5-a6d9-9e9c245831f5#copythe<app_id>returnedtonextcommand$exportLOGSIGHT_APP_ID=a3de4ae5-a0be-42c5-a6d9-9e9c245831f5$logsightloguploadsamples/hadoop_name_node_v1--tagv1$logsightloguploadsamples/hadoop_name_node_v2--tagv2flush_id: cd7bb237-f6b6-4124-925d-9419eca75a48#copy<flush_id>returnedtonextcommand$logsightcomparelog--tagsv1v2--flush_idcd7bb237-f6b6-4124-925d-9419eca75a48+---------------------------------+--------------------------------------+
| KEY                             | VALUE                                |
+---------------------------------+--------------------------------------+
...
| risk                            | 23                                   |
| totalLogCount                   | 8332                                 |
| baselineLogCount                | 4166                                 |
...
+---------------------------------+--------------------------------------+InstallationThe installation has been tested with Mac and Linux operating systems.PrerequisiteYou have aLogsight.aiaccount withEMAILandPASSWORDYou have installedPythonversion >=3.8$python--versionPython 3.8.10Install packageThe CLI can can installed using pip from PyPI.$pipinstalllogsight-cli-pyTo verify your CLI installation, use the logsight –version command:$logsight--versionlogsight/0.0.28The output looks like logsight/x.y.z.
If you don’t see that output, and installed the Logsight CLI, check if you have an old logsight package on your system.
Uninstall it with these instructionsuninstallation.Configuring Logsight CLIThere 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 ConfigYou can create a.logsightconfig file to set up your configuration with Logsight server.
The file should be placed in your home directory and contains variables suchEMAIL,PASSWORD,APP_ID, etc.$cat~/.logsight[DEFAULT]
EMAIL = john.miller@zmail.com
PASSWORD = sawhUz-hanpe4-zaqtyr
APP_ID = 14082ca2-3e35-4a76-a37c-0d1a48931a19
DEBUG = False
JSON = FalseSetting the variable APP_ID with a default value is useful if you frequently use the same application and want to avoid passing the Id as a parameter for each command invoked.Using Environment VariablesYou can also set the variables using your environment.
Environment variables take precedence over config variables.$exportLOGSIGHT_EMAIL=john.miller@zmail.com$exportLOGSIGHT_PASSWORD=sawhUz-hanpe4-zaqtyr$exportLOGSIGHT_APP_ID=07402355-e74e-4115-b21d-4cbf453490d1$exportLOGSIGHT_DEBUG=False$exportLOGSIGHT_JSON=FalseAn executable file which can be used to set these environment variables is also available.
You can update it and, afterwards, source it:$sourceconfig/logsightrc.shPassing OptionsIf 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.$logsight--emailjohn.miller@zmail.com--passwordsawhUz-hanpe4-zaqtyrapplicationslsExamplesThe following list provides examples of useful commands:$logsightconfig+----------+--------------------------------------+---------------------------+
| OPTION   | VALUE                                | SOURCE                    |
+----------+--------------------------------------+---------------------------+
| EMAIL    | john.miller@gmail.com                | Environment               |
| PASSWORD | sawhUz-hanpe4-zaqtyr                 | Environment               |
| APP_ID   | 14082ca2-3e35-4a76-a37c-0d1a48931a19 | /Users/jmiller/.logsight  |
| DEBUG    | True                                 | /Users/jmiller/.logsight  |
| JSON     | False                                | /Users/jmiller/.logsight  |
+----------+--------------------------------------+---------------------------+$logsightapplicationls+--------------------------------------+------------------+
| APPLICATION ID                       | NAME             |
+--------------------------------------+------------------+
| 7bc44909-a132-40e0-a4e7-1e3caf5b7f45 | hdfs_node        |
| cb92e882-fd26-41c4-80f0-ff56a8722b8c | node_manager     |
| 71538838-0296-40fa-8bbc-d91e112a2aab | resource_manager |
| 83a16a6f-6328-4ef9-b4cc-6afe31f70a91 | name_node        |
+--------------------------------------+------------------+$logsightapplicationcreate--name<appname>$logsightapplicationdelete--app_id<appid>$logsightapplicationrename--name<appname>--app_id<appid>[Underdevelopment]$logsightlogupload<file>--tagv1--app_id<appid>$logsightlogtagls--app_id<appid>[Underdevelopment]+-------+---------------------+---------------------+
| TAG   | PERIOD START        | PERIOD END          |
+-------+---------------------+---------------------+
| V1    | 2013-10-02T10:50:12 | 2013-10-11T11:12:31 |
| V2    | 2013-11-08T11:20:14 | 2013-12-02T07:02:09 |
+-------+---------------------+---------------------+$logsightlogstatus--flush_id--app_id<appid>[Underdevelopment]+-------+------------+---------------------+---------------------+
| TAG   | STATUS     | PERIOD START        | PERIOD END          |
+-------+------------+---------------------+---------------------+
| V1    | PENDING    | 2013-10-02T10:50:12 | 2013-10-11T11:12:31 |
+-------+------------+---------------------+---------------------+$logsightlogtail--tag<tag>-n2--app_id<appid>[Underdevelopment]2021-12-16 05:16:27,454 INFO org.apache.hadoop.hdfs.DFSUtil: Starting Web-server for hdfs at: http://0.0.0.0:9870
2021-12-16 05:16:30,464 INFO org.eclipse.jetty.util.log: Logging initialized @924ms to org.eclipse.jetty.util.log.Slf4jLog$logsightcomparelog--app_id<appid>--tags<tagv1><tagv2>--flush_id<flushid>$logsightincidentlog--app_id<appid>--tag<tag>$logsightqualitylog--tags<tag>--app_id<appsid>[Underdevelopment]UninstallationUninstall logsight package:$pipuninstalllogsightAvailabilityThe Logsight CLI Python package is deployed to the following external platforms:Test Python Package Index (TestPyPI):Test PyPIPython Package Index (PyPI):PyPIDocumentation:docs