Updated on 2024-11-21 GMT+08:00

Collecting Kubernetes Events

The Cloud Native Logging add-on works with LTS to collect and store Kubernetes events and works with AOM to generate alarms.

Billing

LTS does not charge you for creating log groups and offers a free quota for log collection every month. You pay only for log volume that exceeds the quota. For details, see Price Calculator.

Reporting Kubernetes Events to LTS

The Cloud Native Logging add-on has not been installed in a cluster.

You can select Kubernetes events when installing the Cloud Native Logging add-on. A default log collection policy will be created, and all events collected will be reported to LTS. For details about how to install the add-on, see Collecting Logs.

The Cloud Native Logging add-on has been installed in a cluster.

  1. Log in to the CCE console and click the cluster name to access the cluster console. In the navigation pane on the left, choose Logging.
  2. Click View Log Collection Policies in the upper right corner.

    All log collection policies reported to LTS are displayed.

  3. Click Create Log Policy and configure parameters as required.

    Policy Template: If Kubernetes events is not selected during add-on installation or the log collection policy is deleted, you can use this option to create a default log collection policy.

  4. On the Logging page, select the log stream configured in the log collection policy to view the events reported to LTS.

Reporting Kubernetes Events to AOM

After the Cloud Native Logging add-on is installed, all Warning events and some Normal events will be reported to AOM by default. The reported events can be used to configure alarms.

Custom Event Reporting

If the reported events cannot meet requirements, you can modify the settings for the events.

  1. Run the following command on the cluster to edit the event collection settings:

    kubectl edit logconfig -n kube-system default-event-aom

  2. Modify the event collection settings as required.

    apiVersion: logging.openvessel.io/v1
    kind: LogConfig
    metadata:
      annotations:
        helm.sh/resource-policy: keep
      name: default-event-aom
      namespace: kube-system
    spec:
      inputDetail:    # Settings on CCE from which events are collected
        type: event    # Type of logs to be collected from CCE. Do not change the value.
        event:
          normalEvents:    # Used to configure Normal events
            enable: true    # Whether to enable Normal event collection
            includeNames:    # Name of the Normal event to be collected. If this parameter is not specified, all Normal events will be collected.
            - NotTriggerScaleUp
            excludeNames:    # Name of the Normal event that is not collected. If this parameter is not specified, all Normal events will be collected.
            - ScaleDown
          warningEvents:    # Used to configure Warning events
            enable: true    # Whether to enable Warning event collection
            includeNames:    # Name of the Warning event to be collected. If this parameter is not specified, all Warning events will be collected.
            - NotTriggerScaleUp
            excludeNames:    # Name of the Warning event that is not collected. If this parameter is not specified, all Warning events will be collected.
            - ScaleDown
      outputDetail:
        type: AOM    # Type of the system that receives the events. Do not change the value.
        AOM:
          events:
          - name: DeleteNodeWithNoServer    # Event name. This parameter is mandatory.
            resourceType: Namespace    # Type of the resource that operations are performed on.
            severity: Major    # Event severity after an event is reported to AOM, which can be Critical, Major, Minor, or Info. The default value is Major.