Alibaba Cloud ACK Edge integrates with Simple Log Service. You can enable Simple Log Service when you create an ACK Edge cluster to quickly collect the cluster's container logs, including standard output and text files.
Step 1: Enable the Logtail component
You can enable the Logtail component when you create an ACK Edge cluster by selecting Enable Log Service. The component can also be enabled for an existing ACK Edge cluster.
Enable Logtail when creating a cluster
-
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click Create Kubernetes Cluster.
The following steps describe only how to enable Simple Log Service. For more information about how to create a cluster, see Create an ACK Edge cluster.
In the Component Configurations wizard, select Enable Log Service.
After you select Enable Log Service, you are prompted to create a Project. For more information about how Simple Log Service organizes logs, see Project. You can create a Project in one of the following ways:
Click Select Project and select an existing Project to manage the collected logs.
Click Create Project. A new Project is automatically created to manage the collected logs. The Project is automatically named
k8s-log-{ClusterID}, where {ClusterID} is the unique ID of the new ACK Edge cluster.
After you complete the configurations, click Create Cluster in the lower-right corner, and then click Confirm in the dialog box.
After the cluster is created, the ACK Edge cluster with Logtail enabled appears on the Clusters page.
Enable Logtail for an existing cluster
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click Components and Add-ons .
On the Add-ons page, click the Logs and Monitoring tab and find the logtail-ds component.
NoteFor ACK Edge versions later than 1.18.8-aliyunedge.1, the log components are merged into
logtail-ds.For ACK Edge versions 1.18.8-aliyunedge.1 and earlier, the log components consist of
alibaba-log-controllerandlogtail-ds-docker.
In the row for the logtail-ds component, click Install. In the Install Comment dialog box, click OK.
If an earlier version of the Simple Log Service component is installed, click Upgrade on the right side of the component.
Step 2: Configure Simple Log Service for applications
You can configure Simple Log Service when you create an application to collect logs from the ACK Edge cluster.
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
On the Deployments page, select a namespace from the Namespace drop-down list at the top, and then click Create from Image in the upper-right corner.
On the Basic Information tab, set the Name, Replicas:, and Type. Then, click Next to go to the Container page.
This section describes only the configurations related to Simple Log Service. For information about other application configurations, see Create a stateless Deployment.
In the Log section, configure the log settings.
Set the Collection Configuration.
ImportantLog collection configurations cannot be modified after creation. To make changes, see Collect container logs by using a DaemonSet-CRD.
Click Collection Configuration. Each collection configuration consists of a Logstore and a Log Path in Container.
Logstore: Specify a name for the Logstore where collected logs are stored. If the specified Logstore does not exist, ACK automatically creates it in the Simple Log Service Project associated with the cluster.
NoteBy default, logs in a newly created Logstore are retained for 180 days.
Log Path in Container: Specify the path to the logs you want to collect. For example, use /usr/local/tomcat/logs/catalina.*.log to collect text logs from Tomcat.
NoteIf you specify
stdout, Logtail collects the standard output (stdout) and standard error (stderr) of the container.Each collection configuration is automatically created for the corresponding Logstore, using simple mode (line-by-line collection) by default. For multi-line mode and more advanced collection methods, see Collect container text logs in DaemonSet mode by using the console and Collect container standard output in DaemonSet mode by using the console.
Before you proceed, make sure that the log plug-in is deployed in the cluster. For example, you can set the Logstore fields to
accessandcatalinarespectively.Set Custom Tags.
Click Custom Tag. Each custom tag is a key-value pair appended to the collected logs. You can use these tags to label a container's log data with information such as a version number.
For example, set Tag Name to
releaseand Tag Value to1.0.0.
After you complete all configurations, click Next in the upper-right corner to continue.
For information about subsequent steps, see Create a stateless Deployment.
Step 3: View logs
After you configure log collection for the Tomcat application, the logs are stored in Simple Log Service. You can then view the container logs in the Simple Log Service console.
Go to the Simple Log Service console.
In the Projects section, select the Project for your Kubernetes cluster (by default,
k8s-log-{ClusterID}). Then, go to the Logstore tab.Find the Logstore that you specified in the collection configuration. In the row for the Logstore, click the
icon and select Query and Analysis.On the log query page, you can view the application's standard output and in-container text logs. The custom tags that you added are also appended to the log fields.
Related documents
To collect container text logs by using a sidecar, see Collect Kubernetes container text logs in sidecar mode.
To collect the standard output of Kubernetes containers, see Collect the standard output of Kubernetes containers in DaemonSet mode (legacy).
You can monitor the running status of your cluster by adding alert rules to logs. For more information, see Manage alert monitoring rules.
For troubleshooting information, see Troubleshoot Logtail log collection failures.
To collect container logs across Alibaba Cloud accounts, see Use Logtail to collect container logs across Alibaba Cloud accounts.
For issues related to a Simple Log Service Logstore, such as changing the log retention period or disabling log collection, see Troubleshoot Logstore-related issues.