All Products
Search
Document Center

Simple Log Service:Install Simple Log Service CLI

Last Updated:Jun 18, 2024

You can use Simple Log Service CLI to perform various operations in Simple Log Service. For example, you can manage projects, manage Logstores, query logs, enable automatic pagination, and replicate data across multiple regions and accounts. This topic describes how to install Simple Log Service CLI.

Read before installation

Simple Log Service CLI is developed based on Python. You must install Python before you can use Simple Log Service CLI. For more information, visit the official Python website.

Item

Description

Current CLI version

0.2.7

Note

You can run the installation command to upgrade the CLI. We recommend that you upgrade the CLI to the latest version.

Source code

Aliyun Log CLI

Supported Python versions

Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, and 3.9

Supported operating systems

Windows, Linux, and macOS

Dependent components

After Python is installed, we recommend that you run the pip install package_name command to install the following dependent components:

  • docopt

  • aliyun-log-python-sdk

  • jmespath

  • aliyun-python-sdk-core

  • aliyun-python-sdk-sts

  • requests

Step 1: Configure Python environment variables

Important

To ensure that the aliyunlog commands run correctly, you need to configure the environment variables. After configuring the environment variables, you may need to restart your development tools (such as IDE) or services to apply the new settings properly.

Configure Python environment variables in Linux or macOS

  1. Create the .bash_profile file.

    Note

    If you set the environment variables for the first time, you can create a configuration file using touch ~/.bash_profile. If the configuration file already exists, use vim ~/.bash_profile to edit it directly.

    touch ~/.bash_profile
    vim ~/.bash_profile
  2. Check the Python installation directory.

    which python3
  3. Configure the .bash_profile file.

    export PATH=$PATH:/usr/local/python3/bin
  4. Use the .bash_profile file.

    # Apply the configuration file.
    source ~/.bash_profile

Configure Python environment variables in Windows

Below are the steps to set environment variables using the graphical user interface in Windows 10.

  1. Locate the Python installation path.

    1. Right-click This PC on the desktop and choose Properties > Advanced system settings > Environment Variables.

    2. Under User variables, check the Path to find the Python environment variables.

  2. Add the Python environment variables.

    1. Right-click This PC on the desktop and choose Properties > Advanced system settings > Environment Variables.

    2. Under User variables, select Path and click New. Add the environment variables. For example, if the path found in step 1 isD:\dev\python\python37\, addD:\dev\python\python37\bin.

Step 2: Install Simple Log Service CLI

Install Simple Log Service CLI in Linux

  1. Log on to a Linux server.

  2. Run the following command to install the CLI:

    pip3 install aliyun-log-python-sdk aliyun-log-cli -U --no-cache
  3. Verify the installation result.

    Run the following command:

    aliyunlog --version

    If a corresponding output is returned, Simple Log Service CLI is installed.

Install Simple Log Service CLI in Windows

  1. Log on to a Windows server..

  2. Open Command Prompt.

    If you configured Python environment variables, you can skip this step and directly run the installation command. If the pip3 installation command cannot be identified, the required Python environment variables are not configured. You can run the cd command to navigate to the Python installation path and then run the installation command.

  3. Run the following command to install the CLI:

    pip3 install aliyun-log-python-sdk aliyun-log-cli -U --no-cache
  4. Verify the installation result.

    Run the following command:

    aliyunlog --version

    If a corresponding output is returned, Simple Log Service CLI is installed.

Install Simple Log Service CLI in macOS

We recommend that you use the pip3 installation command to install Simple Log Service CLI. Sample command:

pip3 install -U aliyun-log-cli --no-cache

Upgrade Simple Log Service CLI

You can run the installation command to upgrade the CLI. We recommend that you upgrade the CLI to the latest version.

Uninstall Simple Log Service CLI

If you no longer require Simple Log Service CLI, you can uninstall Simple Log Service CLI. You can run the following command to uninstall Simple Log Service CLI:

pip3 uninstall aliyun-log-cli