All Products
Search
Document Center

Simple Log Service:Create and use an event center

Last Updated:Aug 29, 2023

K8s Event Center records the status changes of Kubernetes clusters. For example, K8s Event Center records a status change when you create, run, or delete a pod, or when a component exception occurs. K8s Event Center aggregates all the events in Kubernetes clusters in real time. This allows you to perform various operations on the events. For example, you can store, query, analyze, and visualize event data and configure alerts for the events. This topic describes how to create and use an event center in K8s Event Center.

Prerequisites

A Kubernetes cluster, such as a Container Service for Kubernetes (ACK) or ACK Serverless cluster, is created.

Billing

If the following conditions are met, you are not charged when you use an event center:

  • The data retention period of the Logstore that is associated with your event center is 90 days, which is the default value.

  • The amount of data that is written to your event center per day is less than 256 MB, which is equivalent to approximately 250,000 events.

Examples:

  • If the default data retention period is specified for the associated Logstore and 1,000 events are generated in your Kubernetes cluster per day, you can use your event center for free.

  • If you change the data retention period to 105 days and 1,000 events are generated in your Kubernetes cluster per day, you are charged only for the data that is stored in the associated Logstore for a period that exceeds 90 days. The fee is calculated based on the billable item of the storage space occupied by log data. For more information about the billable item, see Billable items of pay-by-feature.

Step 1: Create an event center

  1. Log on to the Log Service console.

  2. In the Log Application section, click the Intelligent O&M tab and click K8s Event Center.

  3. On the Event Center Management tab, click Add.

  4. In the Add Event Center panel, configure the parameters.

    • If you select Existing Project, you can select an existing project from the Project drop-down list to manage the resources of your event center. The resources include a Logstore and the related dashboards.

    • If you select Kubernetes Cluster, you can select an existing Kubernetes cluster from the Kubernetes Cluster drop-down list. If you use this method to create an event center, Simple Log Service automatically creates a project whose name is in the k8s-log-{cluster-id} format to manage the resources of your event center. The resources include a Logstore and the related dashboards.

    Note

    After you create an event center, Simple Log Service automatically creates a Logstore named k8s-event in the specified project. Associated dashboards are also created for the event center.

  5. Click Next.

Step 2: Deploy the eventer and node-problem-detector components

Before you can use an event center, you must deploy the eventer and node-problem-detector components in your Kubernetes cluster.

Deploy the eventer and node-problem-detector components in an ACK cluster

The ack-node-problem-detector component that is provided by ACK is integrated with the features of the eventer and node-problem-detector components. Therefore, to deploy the eventer and node-problem-detector components in an ACK cluster, you need to only deploy the ack-node-problem-detector component. For more information, see Event monitoring. If you use an ACK Serverless cluster, you must deploy the kube-eventer component.

In this example, an ACK cluster is used.

  1. Log on to the ACK console.

  2. In the left-side navigation pane, click Clusters.

  3. On the Clusters page, find and click the cluster in which you want to deploy the ack-node-problem-detector component.

  4. In the left-side navigation pane of the page that appears, choose Operations > Add-ons.

  5. Click the Logs and Monitoring tab, find the ack-node-problem-detector component, and then click Install.

    After the component is installed, you can choose Operations > Event Center to view the dashboard of the event center.

Deploy the eventer and node-problem-detector components in a self-managed Kubernetes cluster

  1. Deploy the eventer component.

    For more information, see Collect Kubernetes events.

  2. Deploy the node-problem-detector component.

    For more information, visit GitHub.

Step 3: Use an event center

After you create an event center in K8s Event Center and deploy the eventer and node-problem-detector components, you can use the event center. For example, you can use the event center to view event statistics, query event details, view the lifecycle of a pod, view node events, view core component events, configure alerts, perform custom queries, and update the version of K8s Event Center.

In the left-side navigation pane of the K8s Event Center page, find the event center that you want to manage and click the K8s Event Center-002 icon. Then, you can perform the following operations.

Operation

Description

View event statistics

The Event Overview tab displays the statistics of core events. The statistics include the total number of events, the difference between the number of error events within the current day and the preceding day, statistics of alert items, trends of error events, and details of pod OOM events.

Note

If a pod OOM event is recorded, you can view only the node on which the event occurs, process name, and process ID. The pod in which the event occurs cannot be located. However, you can query the pod restart event that occurs around the time of the pod OOM event. This way, you can locate the pod.

Query event details

The Event Details tab displays the details about the events that are returned by using different filter conditions, such as the event type, event destination, host, namespace, and name.

View the lifecycle of a pod

The Pod Lifecycle tab displays the details about the events that occur within the lifecycle of a pod. You can filter important pod events by event level.

View node events

The Node Event tab displays the details about node events. You can view the lifecycle of a node and the events that occur on the node.

View core component events

The Event Core tab displays the details about core component events. The events include NLC.Task.RestartECS.Fail and NLC.Task.URL.Mode.Unimplemented.

Configure alerts

On the page that appears after you click Alert Configuration, you can configure alerts for your event center. For more information, see Configure alerts.

Perform custom queries

On the page that appears after you click Custom Query, you can customize query statements.

All events in an event center are stored in a Logstore. You can use all features of the Logstore. For example, you can perform custom queries, consume event data, create custom reports, or configure custom alerts. For more information, see Query and analyze logs.

If you want to access a project that is specified for an event center, you can obtain the name of the project by using one of the following methods:

  • Obtain the name of the project by using the URL of the page that appears after you click Custom Query. The URL is in the https://sls.console.aliyun.com/lognext/app/k8s-event/project/k8s-log-xxxx/logsearch/k8s-event format. The field that follows the project field indicates the name of the project. Example: k8s-log-xxxx.

  • In the list of event centers on the Event Center Management tab, find the event center and view the project name.

Update the version of K8s Event Center

On the page that appears after you click Version Update, you can update the version of K8s Event Center.

Delete an event center

On the K8s Event Center > Event Center Management page, find the event center that you want to delete and click the K8s Event Center icon in the Actions column.

FAQ

  • Why does no data exist in my event center?

    After you deploy an event center, new events are automatically collected to the event center. You can click Custom Query to search for the events. We recommend that you set the time range in the upper-right corner to 1 Day. Data may not be found in the event center due to the following reasons:

    • After you deploy the event center, no events are generated in the associated Kubernetes cluster.

      You can run the kubectl get events --all-namespaces command to check whether new events are generated in a cluster.

    • Invalid values are specified for the parameters that are used to deploy the eventer and node-problem-detector components.

      • If you are using an ACK cluster, perform the following steps:

        1. Log on to the ACK console.

        2. On the Clusters page, find the cluster that you want to manage and click the name of the cluster.

        3. In the left-side navigation pane, choose Applications > Helm.

        4. On the Helm page, find ack-node-problem-detector and click Update in the Actions column.

        5. Check and modify the parameter settings. For more information, see Step 2: Deploy the eventer and node-problem-detector components.

      • If you are using a self-managed Kubernetes cluster, check the configurations based on the descriptions in Collect Kubernetes events.

  • How do I view the logs of a container in which an event occurs?

    • If you are using an ACK cluster, perform the following steps:

      1. Log on to the ACK console.

      2. On the Clusters page, find the cluster that you want to manage and click the name of the cluster.

      3. In the left-side navigation pane, choose Workloads > Pods.

      4. Set the Namespace parameter to kube-system.

      5. On the Pods page, find the pod that you want to manage and click Logs in the Actions column.

    • If you are using a self-managed Kubernetes cluster, filter the kube-system namespace and find the file whose name is prefixed with eventer-sls to view the pod logs.