Install the Logtail client on each target server before you use a Simple Log Service project to collect server logs. This topic describes how to install, start, stop, upgrade, and uninstall Logtail in server environments and in container environments.
Overview
Logtail is used in one of the following two scenarios, depending on the type of target server:
for traditional computing environments such as physical servers and Elastic Compute Service (ECS) instances.
for workloads that are deployed on a Kubernetes container platform.
Choose the solution that matches the runtime environment of your servers. The procedure and the configuration requirements differ between the two scenarios. In a hybrid deployment, complete the installation and configuration for each environment separately.
Servers
Install Logtail
You can install Logtail in one of two ways: one-click installation or manual installation. Simple Log Service supports one-click installation only when you use ECS instances and the instances and the project belong to the same Alibaba Cloud account and reside in the same region. In all other cases, install Logtail manually.
One-click installation
Simple Log Service can install Logtail on an ECS instance with one click. The installation relies on the orchestration capability of CloudOps Orchestration Service (OOS), so you do not need to log on to the ECS instance and run the installation steps manually. If you log on with an Alibaba Cloud account, you have all required permissions by default and can perform the operations directly.
If you log on as a RAM user, ask the Alibaba Cloud account owner to grant you permissions to manage OOS resources. The account owner can use a system policy or a custom policy to create a RAM user and grant permissions to the RAM user:
System policies:
AliyunOOSFullAccess: grants full permissions to manage CloudOps Orchestration Service (OOS).AliyunECSFullAccess: grants permissions to manage ECS.
Custom policies: If you have strict data security requirements, you can create a custom policy for fine-grained authorization. The following policy grants permissions to manage OOS resources:
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecs:DescribeTagKeys",
"ecs:DescribeTags",
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:RunCommand",
"ecs:DescribeInvocations",
"ecs:InvokeCommand"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"oos:ListTemplates",
"oos:StartExecution",
"oos:ListExecutions",
"oos:GetExecutionTemplate",
"oos:ListExecutionLogs",
"oos:ListTaskExecutions"
],
"Resource": "*"
}
]
}To install Logtail on an ECS instance and create and configure a machine group at the same time, perform the following steps:
Log on to the Simple Log Service console. Click the project that manages your log resources to view the list of LogStores. Click the
icon before the name of the LogStore that stores the logs to expand it, click the
icon that appears after Data Collection, select a text log template in the dialog box, and then click Integrate Now.Simple Log Service provides multiple text log templates, such as regular expression, single-line, and multi-line templates. The templates differ only in their log parsing plug-ins. All other configurations are identical. You can also add or remove log parsing plug-ins in a template. Select a template based on the characteristics of the logs that you want to collect, or select any text log template and then configure the plug-ins based on the characteristics of your logs.
On the Machine Group Configurations page, select Servers and ECS as the installation environment, and then click Create Machine Group.
In the Create Machine Group panel, select one or more ECS instances that reside in the same region as the project, click Install and Create Machine Group, wait for the installation to finish, specify the Name of the machine group, and then click OK.
If the installation fails or remains in the waiting state, check whether the ECS instances reside in the same region as the project.
After the installation, go to the
Resources > Machine Groups page, click the machine group that you created, and check the Heartbeat status in the Machine Group Configurations > Machine Group Status section. A heartbeat status of OK indicates that the machine group was created.
Manual installation
Select a Logtail download method and installation method based on the operating system and the CPU architecture of your server.
In the sample code, ${region_id} is the region where the Simple Log Service project resides. Replace it with the actual region ID by referring to Supported regions. For example, the ${region_id} for China (Hangzhou) is cn-hangzhou.
Before you install Logtail, consider the following items:
Logtail 2.0 compatibility: If your machine has a low specification or runs an older operating system, Logtail 2.0 may cause compatibility issues that prevent the software from running properly. In this case, we recommend that you download version 1.8.7 from
https://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/1.8.7/logtail.shand run the./logtail.sh install ${region_id} -v 1.8.7command to install it.
Linux
The following versions of Linux x86-64 (64-bit) servers are supported. - Alibaba Cloud Linux 2 and 3
Anolis OS 7 and 8 - CentOS Linux 6, 7, and 8 - Debian GNU/Linux 8, 9, 10, 11, and 12
Red Hat Enterprise Linux 6, 7, 8, and 9
openSUSE 15.1, 15.2, and 42.3
SUSE Linux Enterprise Server 11, 12, and 15 - Ubuntu 14.04, 16.04, 18.04, 20.04, 22.04, and 24.0 - Other Linux operating systems that are based on glibc 2.5 or later. Logtail 2.0 or later requires glibc 2.6 or later.
The CPU must support the sse4_2 and avx instruction sets for Logtail 2.0 or later. - The following versions of Linux ARM (64-bit) servers are supported. - Alibaba Cloud Linux 3.2 for ARM - Anolis OS 8.2 for ARM or later - CentOS 8.4 for ARM
Debian 11.2 and 12.2 for ARM - Ubuntu 20.04, 22.04, and 24.04 for ARM
The minimum required CPU architecture is ARMv8.2-A for Logtail 2.0 or later.
Servers that can access the internet (ARM and x86-64)
For servers that can access the internet, download Logtail directly:
# Download over an internal network
wget http://logtail-release-${region_id}.oss-${region_id}-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh;
# Download over the internet
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh -O logtail.sh;Select an installation command based on your network conditions:
# Install over the internet.
chmod +x logtail.sh; ./logtail.sh install ${region_id}-internet
# If your servers are in on-premises data centers outside the Chinese mainland or are provided by cloud vendors outside the Chinese mainland, data transfer over the internet may cause high network latency and unstable transfer. We recommend that you use transfer acceleration to transfer data.
chmod +x logtail.sh; ./logtail.sh install ${region_id}-acceleration
# Install over an internal network. This method applies to on-premises data centers that are connected to an internal network.
chmod +x logtail.sh; ./logtail.sh install ${region_id}ARM servers that are offline
For offline servers, first download the installation script and the installation package on a server that can access the internet:
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh; wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/aarch64/logtail-linux64.tar.gzCopy the installation script and the installation package to the server on which you want to install Logtail, and then select an installation command based on your network conditions:
# Install over the internet.
chmod +x logtail.sh; ./logtail.sh install-local ${region_id}-internet
# If your servers are in on-premises data centers outside the Chinese mainland or are provided by cloud vendors outside the Chinese mainland, data transfer over the internet may cause high network latency and unstable transfer. We recommend that you use transfer acceleration to transfer data.
chmod +x logtail.sh; ./logtail.sh install-local ${region_id}-accelerationx86-64 servers that are offline
For offline servers, first download the installation script and the installation package on a server that can access the internet:
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh; wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail-linux64.tar.gzCopy the installation script and the installation package to the server on which you want to install Logtail, and then select an installation command based on your network conditions:
# Install over the internet.
chmod +x logtail.sh; ./logtail.sh install-local ${region_id}-internet
# If your servers are in on-premises data centers outside the Chinese mainland or are provided by cloud vendors outside the Chinese mainland, data transfer over the internet may cause high network latency and unstable transfer. We recommend that you use transfer acceleration to transfer data.
chmod +x logtail.sh; ./logtail.sh install-local ${region_id}-accelerationWindows
> - On Microsoft Windows Server 2008 and Microsoft Windows 7, you can install Logtail on the x86 or x86_64 version. > - On other Windows operating systems, you can install Logtail only on the x86_64 version.
The following Windows versions are supported: - Microsoft Windows Server 2008, 2012, 2016, 2019, 2022, and 2025 - Microsoft Windows 7 - Microsoft Windows 10 - Microsoft Windows Server Version 1909 - Microsoft Windows Server Version 2004
Download the installation package that matches the architecture of your server and the region of your project:
Architecture | Region of the project | Installation package |
32-bit | Regions in the Chinese mainland | Logtail 32-bit installation package: |
32-bit | Regions outside the Chinese mainland | Logtail 32-bit installation package: |
64-bit | Regions in the Chinese mainland | Logtail 64-bit installation package: |
64-bit | Regions outside the Chinese mainland | Logtail 64-bit installation package: |
Extract the installation package, run Windows PowerShell as an administrator, and go to the logtail_installer directory, which is the directory to which you extracted the installation package. Select an installation command based on your network conditions:
# Install over the internet.
.\logtail_installer.exe install ${region_id}-internet
# If your servers are in on-premises data centers outside the Chinese mainland or are provided by cloud vendors outside the Chinese mainland, data transfer over the internet may cause high network latency and unstable transfer. We recommend that you use transfer acceleration to transfer data.
.\logtail_installer.exe install ${region_id}-accelerationBatch install Logtail
You can install Logtail in batches in one of the following two ways:
OOS orchestration: applies to scenarios that have permission requirements. This method supports high concurrency and is suitable for large-scale batch operations. For more information, see Use OOS to install or upgrade Logtail in batches.
ECS Cloud Assistant: simple to use. You run a command to perform a one-time task.
To install Logtail in batches by using ECS Cloud Assistant, perform the following steps:
ECS console - Cloud Assistant,In the upper-left corner of the page, select a region and resource group.
In the Create Command panel, enter the installation command in the Command Content field. This example uses installation over the internet.
The following installation command is used in this example:
#!/bin/bash region_id='cn-hangzhou' wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh -O logtail.sh chmod +x logtail.sh ./logtail.sh install ${region_id}-internetIn the Select Instances section, confirm that the Agent status of the destination instances is Normal. If the status is abnormal, see Install the Cloud Assistant Agent to complete the Cloud Assistant installation. Select the destination instances and click Execute. The execution status then changes to Execution Succeeded. If the execution fails, see View execution results and troubleshoot common issues.
Start and stop Logtail
Linux
Start Logtail
sudo /etc/init.d/ilogtaild startStop Logtail
sudo /etc/init.d/ilogtaild stopWindows
Log on to the target server.
Choose Start > Control Panel > Tools > Service.
In the Service dialog box, find the required service.
For version 0.x.x.x, select the LogtailWorker service.
For version 1.0.0.0 or later, select the LogtailDaemon service.
Right-click the service and select the required operation, such as Start, Stop, or Restart.
Check Logtail status and version
Linux
Check the Logtail status on Linux
Run the sudo /etc/init.d/ilogtaild status command to check the Logtail status. If the system returns ilogtail is running, Logtail is installed. If Logtail is not running, uninstall it and then install it again.
Check the Logtail version on Linux
Logtail stores its version information in the logtail_version field of the /usr/local/ilogtail/app_info.json file. Run the following command to view the Logtail version information.
cat /usr/local/ilogtail/app_info.jsonThe following result is returned:
{
"logtail_version" : "0.16.30",
}Windows
Check the Logtail status on Windows
Check the Logtail status to determine whether Logtail is installed on the target server.
Open the Run window, enter
services.msc, and open the Services window.Check the running status of the LogtailDaemon service, which applies to Logtail 1.0.0.0 or later, or the LogtailWorker service, which applies to Logtail 0.x.x.x.
A status of Running indicates that Logtail is installed.
Check the Logtail version on Windows
You can check the Logtail version in the logtail_version field of the app_info.json file in the installation path.
For example, the following content indicates that the Logtail version is 1.0.0.0.
{
"logtail_version" : "1.0.0.0"
}Upgrade Logtail
Linux
Before you upgrade Logtail on a Linux server, consider the following items:
Upgrade command: To upgrade Logtail, use the
upgradecommand. If you use theinstallcommand, an overwrite installation is performed and the original configurations are lost.Service interruption: During the upgrade, Logtail stops for a short period of time. After the upgrade is complete, Logtail starts automatically and is registered as a startup item. The upgrade overwrites only the required files. Configuration files and checkpoint files are retained, which ensures that no logs are lost during the upgrade.
In the sample code,
${region_id}is the region where the Simple Log Service project resides. Replace it with the actual region ID by referring to Supported regions. For example, the${region_id}for China (Hangzhou) iscn-hangzhou.
Select a Logtail upgrade method from the following table:
Architecture | Download method | Upgrade method |
ARM and x86-64 | For servers that can access the internet: | After the download is complete, run the following upgrade command: |
ARM | For offline servers, first download the installation script and the installation package on a server that can access the internet: | Copy the installation script and the installation package to the server on which you want to upgrade Logtail, and then run the following upgrade command: |
x86-64 | For offline servers, first download the installation script and the installation package on a server that can access the internet: | Copy the installation script and the installation package to the server on which you want to upgrade Logtail, and then run the following upgrade command: |
The following information indicates that the upgrade is successful.
stop successfully
Stop logtail successfully.
Upgrading logtail files ...
Upgrade logtail files successfully.
Starting logtail ...
ilogtail is running
Upgrade logtail successfully.
{
"UUID" : "XXXXXXXX-XXXX",
"compiler" : "GCC 9.3.1",
"hostname" : "xxx",
"instance_id" : "XXXXXXXX-XXXX_172.16.0.75_1730950372",
"ip" : "172.16.0.75",
"logtail_version" : "2.0.8",
"os" : "Linux; 5.10.134-13.an8.x86_64; #1 SMP Mon Jan 9 10:39:46 CST 2023; x86_64",
"update_time" : "2024-11-07 11:32:52"
}Windows
The upgrade procedure is the same as the installation procedure. Download and extract the latest installation package, and then perform the installation steps.
An upgrade is equivalent to an automatic uninstallation and reinstallation. The content in the original installation directory is deleted. Back up your data before you perform the upgrade.
On a 64-bit Windows operating system, to upgrade a 32-bit Logtail to a 64-bit Logtail, you must first uninstall the 32-bit Logtail and then install the 64-bit Logtail.
Uninstall Logtail
Linux
Obtain the ${region_id} of the region where your Simple Log Serviceproject resides. Replace ${region_id} and then run the following command to uninstall Logtail.
For the ${region_id} of each region, see Supported regions. For example, the ${region_id} for China (Hangzhou) is cn-hangzhou.
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod +x logtail.sh; ./logtail.sh uninstallWindows
Run Windows PowerShell or cmd as an administrator, go to the logtail_installer directory, which is the directory to which you extracted the installation package, and then run the following command.
.\logtail_installer.exe uninstallAfter the uninstallation is complete, the Logtail installation directory is deleted, but some configurations are retained in the C:\LogtailData directory. You can delete them manually based on your requirements. The retained information includes:
checkpoint: stores the checkpoint information of all Logtail plug-ins. This file exists only after you use Logtail plug-ins.
user_config.d: the directory that stores local collection configurations. Files that have the .json extension are considered collection configurations. The format is similar to /usr/local/ilogtail/user_log_config.json.
logtail_check_point: stores the checkpoint information of the main Logtail component.
users: stores the user identifier files that you configured.
Container scenarios
Install the Logtail component
If you use an ACK cluster and the cluster belongs to the same Alibaba Cloud account as Simple Log Service, refer to the installation method for ACK clusters. If you use a self-managed cluster, or an ACK cluster that belongs to a different Alibaba Cloud account than Simple Log Service, refer to the installation method for self-managed clusters.
ACK clusters
This operation applies only to dedicated Kubernetes clusters and managed Kubernetes clusters.
Install the Logtail component for an existing ACK cluster
Log on to the Container Service Management Console
On the Clusters page, choose More > Operations > Add-ons in the rightmost column of the destination cluster.
On the Logs and Monitoring tab, find
logtail-dsand then click Install.After the installation is complete, Simple Log Service automatically creates a project named
k8s-log-${your_k8s_cluster_id}.
Install the Logtail component when you create an ACK cluster
Log on to the Container Service Management Console
In the left-side navigation pane, click Clusters.
On the Clusters page, click Create Cluster.
On the Component Configurations configuration step, select Enable Log Service.
This section describes only the key steps for enabling Simple Log Service. For more information about how to create a cluster, see Create an ACK managed cluster.
After you select Enable Log Service, a message that prompts you to create a project appears. For more information about how Simple Log Service organizes logs, see Project. You can create a project in one of the following two ways:
Select Project: You can select an existing project to manage the collected container logs.
Create Project: Simple Log Service automatically creates a project to manage the collected container logs.
ClusterIDis the unique identifier of the Kubernetes cluster that you create.In the Log Service section, select Enable Log Service. After you select Create a new project, the system automatically creates a project named
k8s-log-{ClusterID}.
After the installation is complete, the following Simple Log Service resources are automatically created in the selected project.
Resource type | Resource name | Description | Example |
Machine group | k8s-group-${your_k8s_cluster_id} | The machine group of | k8s-group-my-cluster-123 |
Machine group | k8s-group-${your_k8s_cluster_id}-statefulset | The machine group of | k8s-group-my-cluster-123-statefulset |
Machine group | k8s-group-${your_k8s_cluster_id}-singleton | A single-instance machine group, which is mainly used for some single-instance collection configurations. | k8s-group-my-cluster-123-singleton |
LogStore | config-operation-log | Stores the logs of alibaba-log-controller in the Logtail component. We recommend that you do not create collection configurations in this LogStore. You can delete this LogStore. After the LogStore is deleted, the operational logs of alibaba-log-controller are no longer collected. This LogStore is billed in the same way as a regular LogStore. For more information, see Pay-by-data-written billing. | config-operation-log |
Self-managed clusters
Log on to your Kubernetes cluster and select a command based on the region to download Logtail and its dependent components.
# Regions in the Chinese mainland wget https://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/kubernetes/0.5.5/alibaba-cloud-log-all.tgz; tar xvf alibaba-cloud-log-all.tgz; chmod 744 ./alibaba-cloud-log-all/k8s-custom-install.sh # Regions outside the Chinese mainland wget https://logtail-release-ap-southeast-1.oss-ap-southeast-1.aliyuncs.com/kubernetes/0.5.5/alibaba-cloud-log-all.tgz; tar xvf alibaba-cloud-log-all.tgz; chmod 744 ./alibaba-cloud-log-all/k8s-custom-install.shModify the
./alibaba-cloud-log-all/values.yamlconfiguration file.The configuration file contains the following parameters:
# ===================== Required content ===================== # The name of the destination project. SlsProjectName: # The region to which the project belongs. Region: # The ID of the Alibaba Cloud account to which the project belongs. Enclose the ID in double quotation marks (""). AliUid: "11099" # The AccessKey ID and AccessKey secret of the Alibaba Cloud account or the RAM user. The AliyunLogFullAccess permission is required. AccessKeyID: AccessKeySercret: # The custom cluster ID. The ID can contain only letters, digits, and hyphens (-). ClusterID: # ========================================================== # Specifies whether to enable the components related to metric collection. Valid values: true and false. Default value: true. SlsMonitoring: true # The network type. Valid values: Internet and Intranet. Default value: Internet. Net: Internet # Specifies whether the container runtime is containerd. Valid values: true and false. Default value: false. SLS_CONTAINERD_USED: trueParameter
Description
SlsProjectNameThe name of the project to which Logtail uploads logs.
RegionThe ID of the region where your project resides. For example, the region ID of China (Hangzhou) is
cn-hangzhou.AliUidThe ID of the Alibaba Cloud account to which the project belongs. The ID must be enclosed in double quotation marks (""), for example,
AliUid: "11**99".AccessKeyIDThe AccessKey ID of the Alibaba Cloud account to which the project belongs. We recommend that you use the AccessKey pair of a RAM user and grant the AliyunLogFullAccess permission to the RAM user.
AccessKeySercretThe AccessKey secret of the Alibaba Cloud account to which the project belongs. We recommend that you use the AccessKey pair of a RAM user and grant the AliyunLogFullAccess permission to the RAM user.
ClusterIDThe custom cluster ID. The ID can contain only letters, digits, and hyphens (-). This parameter corresponds to
${your_k8s_cluster_id}in the subsequent operations. Do not configure the same cluster ID for different Kubernetes clusters.SlsMonitoringSpecifies whether to enable cluster metric data collection. Valid values:
true(default), which enables cluster metric data collection, andfalse, which disables cluster metric data collection.NetThe network type that Logtail uses to transfer data. If your cluster is not connected to the Alibaba Cloud internal network, use the internet. Valid values:
Internet(default), which is the internet, andIntranet, which is an internal network.SLS_CONTAINERD_USEDSpecifies whether the container runtime is containerd. Valid values:
true, which indicates that the container runtime is containerd, andfalse(default), which indicates that the container runtime is not containerd. In a self-managed Kubernetes cluster that uses containerd as the container runtime, logs may not be collected by Logtail if this parameter is not enabled.Install Logtail and its dependent components.
You can run the
echo "$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)"command to query theOS-architectureof your host. Thek8s-custom-install.shscript supports the followingOS-architecturecombinations: linux-386, linux-amd64, linux-arm, linux-arm64, linux-ppc64le, linux-s390x, and darwin-amd64.bash k8s-custom-install.sh; kubectl apply -R -f resultvalues.yamlfile that you modified.
Resource type | Resource name | Description | Example |
Machine group | k8s-group-${your_k8s_cluster_id} | The machine group of | k8s-group-my-cluster-123 |
Machine group | k8s-group-${your_k8s_cluster_id}-statefulset | The machine group of | k8s-group-my-cluster-123-statefulset |
Machine group | k8s-group-${your_k8s_cluster_id}-singleton | A single-instance machine group, which is mainly used for some single-instance collection configurations. | k8s-group-my-cluster-123-singleton |
LogStore | config-operation-log | Stores the logs of alibaba-log-controller in the Logtail component. We recommend that you do not create collection configurations in this LogStore. You can delete this LogStore. After the LogStore is deleted, the operational logs of alibaba-log-controller are no longer collected. This LogStore is billed in the same way as a regular LogStore. For more information, see Pay-by-data-written billing. | N/A |
Logtail status, version, and IP address
Run the following command to check the Logtail status.
kubectl get po -n kube-system | grep logtailThe following result is returned:
NAME READY STATUS RESTARTS AGE
logtail-ds-gb92k 1/1 Running 0 2h
logtail-ds-wm7lw 1/1 Running 0 4dRun the following command to view information such as the version number and the IP address of Logtail.
kubectl exec logtail-ds-gb92k -n kube-system cat /usr/local/ilogtail/app_info.jsonThe following result is returned:
{
"hostname" : "logtail-ds-gb92k",
"instance_id" : "0EBB2B0E-0A3B-11E8-B0CE-0A58AC140402_172.20.4.2_1517810940",
"ip" : "192.0.2.0",
"logtail_version" : "0.16.2",
"os" : "Linux; 3.10.0-693.2.2.el7.x86_64; #1 SMP Tue Sep 12 22:26:13 UTC 2017; x86_64",
"update_time" : "2021-02-05 06:09:01"
}Upgrade and roll back Logtail
Before the upgrade, back up the description files of the Logtail component.
If significant collection latency already exists before the upgrade, the Logtail upgrade may cause a small amount of log data to be lost.
kubectl get ds -n kube-system logtail-ds -o yaml > logtail-ds.yaml kubectl get deployment -n kube-system alibaba-log-controller -o yaml > alibaba-log-controller.yaml kubectl get crd aliyunlogconfigs.log.alibabacloud.com -o yaml > aliyunlogconfigs-crd.yaml kubectl get cm -n kube-system alibaba-log-configuration -o yaml > alibaba-log-configuration.yaml kubectl get aliyunlogconfigs --all-namespaces -o yaml > aliyunlogconfigs-cr.yamlSelect a component upgrade method based on your cluster. If you use an ACK cluster and the cluster belongs to the same Alibaba Cloud account as Simple Log Service, refer to the upgrade method for ACK clusters. If you use a self-managed cluster, or an ACK cluster that belongs to a different Alibaba Cloud account than Simple Log Service, refer to the upgrade method for self-managed clusters.
ACK clusters
In most cases, we recommend that you use the automatic upgrade method. If you modified parameters, such as environment variables, in the DaemonSet of logtail-ds or in the Deployment of alibaba-log-controller, use the manual upgrade method to prevent your modifications from being reset.
Automatic upgrade
An automatic upgrade resets the configurations that you manually modified in logtail-ds and alibaba-log-controller.
Log on to the Container Service Management Consol.
On the Logs and Monitoring tab, find
logtail-dsand then click Upgrade.In the Update dialog box, click OK.
If you cannot upgrade to the latest version of Logtail, the version of your Kubernetes cluster is too early. Upgrade the Kubernetes cluster first, or use the manual upgrade method.
After you perform the upgrade, you can check the status of the logtail-ds pods in the Container Service management console. If all logtail-ds pods are in the Running state, the upgrade is successful.
Manual upgrade
A manual upgrade does not update your configurations based on the latest version of the Logtail component, so some feature optimizations may be unavailable.
A manual upgrade covers logtail-ds and alibaba-log-controller. In most cases, you only need to upgrade logtail-ds to obtain the collection capabilities of the new Logtail version. To obtain the collection capabilities provided by the new Logtail CRD, you must upgrade alibaba-log-controller. The following steps use logtail-ds as an example.
Log on to the Container Service Management Console
Choose Workloads > DaemonSets.
NoteTo upgrade alibaba-log-controller, choose Workloads > Deployments. Then, find alibaba-log-controller in the kube-system namespace and complete the upgrade.
Set Namespace to kube-system, and then click Edit for
logtail-ds.Check whether the following environment variables exist.
If the ALIYUN_LOGTAIL_CONFIG, ALIYUN_LOGTAIL_USER_ID, and ALIYUN_LOGTAIL_USER_DEFINED_ID environment variables do not exist, your Logtail version may be too early. Upgrade Logtail.
For Image Version, click Select Image Version.
In the Image Version dialog box, click the latest version, and then click OK.
On the right side of the page, click Update.
After you perform the upgrade, you can check the status of the
logtail-dspods in the Container Service management console. If alllogtail-dspods are in the Running state, the upgrade is successful.
Self-managed clusters
We recommend that you upgrade by installing the latest Logtail component. If you update only the image version number of some components, such as logtail-ds or alibaba-log-controller, the upgrade may fail.
To complete the automatic upgrade, install the Logtail component again.
To roll back to a specific version, perform the following steps.
The YAML files that you backed up before the upgrade contain redundant information. You must manually delete the redundant information before you can use the files to restore the Logtail configurations. You can use the kubectl-neat tool to perform this operation. The fields that you must delete are metadata.creationTimestamp, metadata.generation, metadata.resourceVersion, metadata.uid, and status.
Determine whether to retain the new Logtail configurations created after the upgrade based on your business requirements.
If you do not want to retain them, you can delete the new Logtail configurations created after the upgrade.
Delete the redundant information from the backup files.
cat logtail-ds.yaml | kubectl-neat > neat-logtail-ds.yaml cat alibaba-log-controller.yaml | kubectl-neat > neat-alibaba-log-controller.yaml cat aliyunlogconfigs-crd.yaml | kubectl-neat > neat-aliyunlogconfigs-crd.yaml cat alibaba-log-configuration.yaml | kubectl-neat > neat-alibaba-log-configuration.yaml cat aliyunlogconfigs-cr.yaml | kubectl-neat > neat-aliyunlogconfigs-cr.yamlApply the streamlined backup files to restore the Logtail configurations.
kubectl apply -f neat-logtail-ds.yaml kubectl apply -f neat-alibaba-log-controller.yaml kubectl apply -f neat-aliyunlogconfigs-crd.yaml kubectl apply -f neat-alibaba-log-configuration.yaml kubectl apply -f neat-aliyunlogconfigs-cr.yaml
Uninstall the Logtail component
Select a component uninstallation method based on your cluster. If you use an ACK cluster and the cluster belongs to the same Alibaba Cloud account as Simple Log Service, refer to the uninstallation method for ACK clusters. If you use a self-managed cluster, or an ACK cluster that belongs to a different Alibaba Cloud account than Simple Log Service, refer to the uninstallation method for self-managed clusters.
ACK clusters
Log on to the Container Service Management Console
On the Logs and Monitoring tab, find
logtail-dsand then click Uninstall.Follow the on-screen instructions to click OK and complete the uninstallation.
Self-managed clusters
Run the kubectl delete -R -f result command to uninstall installed components such as logtail-ds and alibaba-log-controller.
This command recursively deletes all resources in the result directory. Use it with caution if the directory contains other resources.
FAQ about clusters
How do multiple Kubernetes clusters share one Simple Log Service project?
If you want to collect container logs from multiple clusters to the same Simple Log Service project, keep the installation parameters the same as the parameters that you used when you installed the Simple Log Service component for the first cluster.
How do I view Logtail logs?
Logtail logs are stored in the /usr/local/ilogtail/ directory in the Logtail container. The file names are ilogtail.LOG and logtail_plugin.LOG.
The standard output of the Logtail container is not meaningful. Ignore the following standard output.
start umount useless mount points, /shm$|/merged$|/mqueue$
umount: /logtail_host/var/lib/docker/overlay2/3fd0043af174cb0273c3c7869500fbe2bdb95d13b1e110172ef57fe840c82155/merged: must be superuser to unmount
umount: /logtail_host/var/lib/docker/overlay2/d5b10aa19399992755de1f85d25009528daa749c1bf8c16edff44beab6e69718/merged: must be superuser to unmount
umount: /logtail_host/var/lib/docker/overlay2/5c3125daddacedec29df72ad0c52fac800cd56c6e880dc4e8a640b1e16c22dbe/merged: must be superuser to unmount
......
xargs: umount: exited with status 255; aborting
umount done
start logtail
ilogtail is running
logtail status:
ilogtail is runningHow do I check the status of the Simple Log Service components in a Kubernetes cluster?
Run the following commands.
kubectl get deploy alibaba-log-controller -n kube-system
kubectl get ds logtail-ds -n kube-systemalibaba-log-controller fails to start. What do I do?
Check whether you performed the installation in the following way.
Run the installation command on the master node of the Kubernetes cluster.
Enter your cluster ID in the parameters of the installation command.
If the installation failed for either of the preceding reasons, run the
kubectl delete -f deploycommand to delete the generated installation template, and then run the installation command again.
How do I check the status of the Logtail-ds DaemonSet in a Kubernetes cluster?
Run the kubectl get ds -n kube-system command to check the status of the Logtail-ds DaemonSet.
By default, the Logtail container resides in the kube-system namespace.
How do I view the operational logs of Logtail?
The operational logs of Logtail are stored in the /usr/local/ilogtail/ directory. The file name is ilogtail.LOG, and rotated files are compressed and stored as ilogtail.LOG.x.gz. For example, run the following command to view the logs.
kubectl exec logtail-ds-gb92k -n kube-system tail /usr/local/ilogtail/ilogtail.LOGThe following result is returned:
[2018-02-05 06:09:02.168693] [INFO] [9] [build/release64/sls/ilogtail/LogtailPlugin.cpp:104] logtail plugin Resume:start
[2018-02-05 06:09:02.168807] [INFO] [9] [build/release64/sls/ilogtail/LogtailPlugin.cpp:106] logtail plugin Resume:success
[2018-02-05 06:09:02.168822] [INFO] [9] [build/release64/sls/ilogtail/EventDispatcher.cpp:369] start add existed check point events, size:0
[2018-02-05 06:09:02.168827] [INFO] [9] [build/release64/sls/ilogtail/EventDispatcher.cpp:511] add existed check point events, size:0 cache size:0 event size:0 success count:0How do I restart Logtail in a pod?
Run the following command to stop Logtail. In the command, logtail-ds-gb92k is the container name and kube-system is the namespace. Replace them with the actual values.
kubectl exec logtail-ds-gb92k -n kube-system /etc/init.d/ilogtaild stopThe following result indicates that Logtail is stopped.
kill process Name: ilogtail pid: 7
kill process Name: ilogtail pid: 9
stop successRun the following command to start Logtail. In the command, logtail-ds-gb92k is the container name and kube-system is the namespace. Replace them with the actual values.
kubectl exec logtail-ds-gb92k -n kube-system /etc/init.d/ilogtaild startThe following result indicates that Logtail is started.
ilogtail is running