Cloud Native Log Collection
Introduction
The Cloud Native Log Collection add-on (log-agent) is developed based on Fluent Bit and OpenTelemetry for collecting logs and Kubernetes events. After the add-on is installed, the fluent-bit container component is automatically created for log collection. This add-on supports CRD-based log collection policies. It collects and forwards standard output logs, container file logs, and Kubernetes events in a cluster based on configured policies. It also reports all abnormal Kubernetes events and some normal Kubernetes events to AOM. For details about how to collect logs, see Collecting Logs.
The fluent-bit container component is provided by Huawei Cloud for free.
Log Collection Reliability
The logging system's core function is to record lifecycle events for service components, including startup and initialization, exit, runtime details, and exceptions. It is primarily used in O&M scenarios such as checking component status and analyzing root causes of failures.
Standard streams (stdout and stderr) and local log files use non-persistent storage. Data integrity may be compromised by the following risks:
- Log rotation and compression may trigger deletion of historical files
- Temporary storage volumes are reclaimed when Kubernetes pods terminate
- Automatic OS cleanup is triggered by limited node storage space
Although the Cloud Native Log Collection add-on employs mechanisms such as multi-level buffering, priority queues, and resumable uploads to improve collection reliability, log loss may still occur in the following scenarios:
- Service log throughput exceeds the collector's processing capacity.
- A service pod is terminated and immediately reclaimed by the container runtime.
- The log collector pod experiences exceptions.
The following are recommended best practices for cloud-native log management. Review and adopt them carefully:
- Use dedicated, high-reliability streams to record and persist critical service data (for example, financial transactions).
- Do not log sensitive information such as customer details, payment credentials, and session tokens.
Constraints
- Up to 100 log collection policies can be created for each cluster.
- log-agent cannot collect .gz, .tar, or .zip log files.
- If the container runtime is containerd, container standard output logs will not be split into multiple lines.
- In each cluster, up to 10,000 single-line logs can be collected per second, and up to 2,000 multi-line logs can be collected per second.
Permissions
The fluent-bit component reads and collects the standard output logs and container file logs based on the collection configuration.
The following permissions are required for running the fluent-bit component:
- CAP_DAC_OVERRIDE: ignores the discretionary access control (DAC) restrictions on files.
- CAP_FOWNER: ignores the restrictions that the file owner ID must match the process user ID.
- DAC_READ_SEARCH: ignores the DAC restrictions on file reading and catalog search.
- SYS_PTRACE: allows tracing of all processes.
Installing the Add-on
- Log in to the CCE console and click the cluster name to go to the cluster console.
- In the navigation pane, choose Add-ons. On the right of the displayed page, find the Cloud Native Log Collection add-on and click Install.
- On the Install Add-on slide-out panel, configure the specifications.
You can adjust the number of add-on pods and resource quotas as needed. The single-pod deployment does not provide high availability. If the add-on pod fails, the add-on becomes unavailable.
- Configure add-on parameters. This is supported by add-on v1.7.0 or later. For details, see Tail.
Parameter
Description
Default Value
Initial Buffer Size (Buffer_Chunk_Size)
The size of the initial buffer used to read files.
128k
Maximum Buffer Size (Buffer_Max_Size)
Limit on the buffer size for each monitored file. When a buffer is added, the number of memory buffers that can be added is restricted by this value. If the limit is exceeded, the file will be removed from the monitored file list.
512k
Memory Buffer Limit (Mem_Buf_Limit)
Memory limit when data is appended to the engine. When the limit is reached, the add-on will temporarily stop reading log file data. The reading will resume after the data is refreshed.
40mb
The unit can be case-insensitive k, kb, m, mb, g or gb. If no unit is specified, the default unit of byte will be used.
- Click Install.
Components
| Component | Description | Resource Type |
|---|---|---|
| fluent-bit | A lightweight log collector and forwarder for collecting logs. | Pod |
| log-operator | Used to generate internal configuration files | Deployment |
| otel-collector | Used to collect Kubernetes events and report them to LTS and AOM, and receive and report logs to LTS. | Deployment |
Release History
| Add-on Version | Supported Cluster Version | New Feature |
|---|---|---|
| 1.7.16 |
| Supported CCE Autopilot clusters v1.36. |
| 1.7.13 |
|
|
| 1.7.6 |
|
|
| 1.7.2 |
| Fixed some issues. |
| 1.7.0 |
| Supported CCE Autopilot clusters v1.31. |
| 1.4.5 |
| Optimized the resource configuration. |
| 1.4.4 |
| Fixed some issues. |
| 1.4.3 |
| Fixed some issues. |
| 1.2.25 |
| Fixed some issues. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot