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 | |
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
|
Step 1: Configure Python environment variables
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
Create the
.bash_profile
file.NoteIf 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, usevim ~/.bash_profile
to edit it directly.touch ~/.bash_profile vim ~/.bash_profile
Check the Python installation directory.
which python3
Configure the
.bash_profile
file.export PATH=$PATH:/usr/local/python3/bin
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.
Locate the Python installation path.
Right-click This PC on the desktop and choose Properties > Advanced system settings > Environment Variables.
Under User variables, check the Path to find the Python environment variables.
Add the Python environment variables.
Right-click This PC on the desktop and choose Properties > Advanced system settings > Environment Variables.
Under User variables, select Path and click New. Add the environment variables. For example, if the path found in step 1 is
D:\dev\python\python37\
, addD:\dev\python\python37\bin
.
Step 2: Install Simple Log Service CLI
Install Simple Log Service CLI in Linux
Log on to a Linux server.
Run the following command to install the CLI:
pip3 install aliyun-log-python-sdk aliyun-log-cli -U --no-cache
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
Log on to a Windows server..
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.
Run the following command to install the CLI:
pip3 install aliyun-log-python-sdk aliyun-log-cli -U --no-cache
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