EFK log collection and analysis method for data aggregation
Through the EFK log collection and analysis method, combined with tools such as Agent, Filebeat, Kafka, Flink, Elasticsearch, ClickHouse and ZooKeeper, the efficiency and flexibility problems of log collection and data processing in large-scale language model training are solved, achieving high performance and depth data analysis.
Patent Information
- Application Number
- CN202410991124.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-10-15
AI Technical Summary
In large-scale distributed language model training, traditional log collection systems perform poorly in terms of data volume surge and redundant information processing, resulting in slow query performance, high resource consumption, and frequent failures. It is difficult to quickly locate the root cause of the problem and affects troubleshooting efficiency. and model iteration speed.
An EFK log collection and analysis method is designed. Log data is collected through Agent and Filebeat, Kafka is used for high-throughput data transmission and preprocessing, Flink is used for deep aggregation, dual storage strategies (Elasticsearch and ClickHouse) are used for storage, and it is stored through ZooKeeper and Kibana provides a visual query interface and supports multi-rule data aggregation and hierarchical storage.
It improves data collection capabilities and processing flexibility, optimizes resource usage, enhances fault location efficiency and analysis depth, solves the limitations of traditional ELK systems in large-scale data processing and real-time analysis, and achieves high-performance throughput and flexible data Storage and query.
Smart Images

Figure CN118779337A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of system and cluster logs and data collection and analysis, and in particular to an EFK log collection and analysis method for data aggregation. Background Art
[0002] With the rapid development and iteration of large language model training, large-scale distributed training has become the industry standard. This type of training usually requires the powerful computing power of thousands of GPU cards and hundreds of servers. However, as the scale of training increases, data monitoring and log collection face unprecedented challenges. The amount of data has surged, and the problem of log information redundancy has become increasingly serious. Traditional and lightweight log systems can no longer meet current needs.
[0003] In particular, as the scale of model training expands exponentially, the amount of log data generated also explodes, accompanied by highly redundant information flows, which puts tremendous pressure on the existing log collection architecture. The original EFK system has slow query performance and high resource consumption. As the running time increases and the amount of data accumulates, the entire system will also fail frequently. Once a large language model training fails, even an experienced development and operation team will get lost in the complex log maze due to information overload and insufficient analysis tools. It is difficult to quickly identify the root cause of the problem, which seriously affects the troubleshooting efficiency and model iteration speed.
[0004] In response to this series of thorny issues, the technical staff hopes to provide an efficient, scalable, and intelligent solution through a redesigned log collection management framework to meet the special needs of large language model distributed training in data monitoring and log collection. This can not only improve the efficiency of problem location, but also optimize the use of resources, accelerate the training process, and ultimately promote the development of large model training technology. Summary of the invention
[0005] In view of the shortcomings of the prior art, the purpose of the present invention is to provide an EFK log collection and analysis method for data aggregation, aiming to overcome the limitations of the traditional ELK framework in large-scale data processing, real-time analysis and structured data analysis. The present invention integrates a series of efficient tools and technologies to form a complete solution from data collection, transmission, processing to analysis and display.
[0006] The object of the present invention is to achieve the following technical solution: an EFK log collection and analysis method for data aggregation, comprising:
[0007] 1. Collect log data and system parameters;
[0008] 2. The log data collected in step 1 is uniformly cached for preprocessing;
[0009] 3. Aggregate the data processed in step 2 to generate a data structure;
[0010] 4. Store the data structures obtained in step 3 in different types of databases that are suitable for their access patterns and query requirements according to their levels and characteristics;
[0011] 5. Build API interface and visual query interface.
[0012] Furthermore, in step 1, the collection of log data and system parameters is completed by Agent and Filebeat tools, wherein the Filebeat is configured to dynamically collect system logs, container logs, pod logs and service logs in the server; the Agent is configured to collect the hardware resources and GPU computing power card parameters of the collection system, and the hardware resources include CPU usage, memory usage, disk I / O, network I / O, process information, graphics card usage, video memory usage, graphics card quantity, temperature and power information.
[0013] Furthermore, the step 2 is specifically as follows: using the high-performance distributed stream processing tool Kafka to build a high-throughput, low-latency data transmission channel, and pre-processing the data collected in step 1 through Kafka; at the same time, the data entering Kafka is preliminarily cleaned and filtered, and partitioned and indexed as needed, effectively alleviating the data peak pressure and ensuring the continuity and reliability of data flow.
[0014] Furthermore, the step 3 is specifically as follows: the data preprocessed in step 2 is introduced into Flink for aggregation, a custom aggregation rule is configured in Flink, log data and system data are deeply aggregated according to actual needs, the aggregated data is stored in a structured form, a data structure is generated, and the data is organized with time and server address as indexes. The structure also includes system status data and process text information at the collection time point, and the process is used as the smallest statistical unit to record the status of each process.
[0015] Furthermore, step 4 is specifically as follows: adopting a dual storage strategy, distributing the data structure aggregated in step 3 to Elasticsearch and ClickHouse to optimize analysis efficiency, and storing the data in different types of databases according to the level and characteristics of the data to better meet the access and query requirements of different data, wherein the different types of databases include relational databases, NoSQL databases, and time series databases.
[0016] Furthermore, the step 5 is specifically as follows: using ZooKeeper to manage metadata, using Kibana as a visualization front end to provide an intuitive log viewing and data analysis interface, and supporting users to directly observe data through OpenAPI or Kibana.
[0017] Furthermore, the functions of the visual query interface described in step 5 include complex query statement construction, real-time data display, and historical data comparison and analysis.
[0018] The beneficial effects of the present invention are:
[0019] 1. Enhanced data collection capabilities: Traditional ELK systems usually focus on the collection and storage of log data. This method adds the collection of system parameters and can provide a more detailed observation view of the large model training process.
[0020] 2. Multi-rule data aggregation: This method aggregates log and system data by applying multiple predefined rules, which improves the flexibility and depth of data processing, while traditional ELK systems may have basic functions in data aggregation.
[0021] 3. Hierarchical data storage: This method stores data in different types of databases according to its hierarchy and characteristics. This hierarchical storage strategy can better meet the access and query requirements of different data, while traditional ELK systems may use a single storage solution.
[0022] 4. High-performance throughput: Clustered Kafka and Flink are used to achieve large-scale throughput of logs and system parameter data, thereby solving the bottlenecks that are easily encountered in high-concurrency scenarios and improving the system's ability to process big data. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0024] Figure 1 A flowchart of an EFK log collection and analysis method for data aggregation provided for an implementation case of the present invention;
[0025] Figure 2 An architectural diagram of an EFK log collection and analysis method for data aggregation provided for an implementation case of the present invention;
[0026] Figure 3A timing diagram of an EFK log collection and analysis method for data aggregation provided for an implementation case of the present invention. DETAILED DESCRIPTION
[0027] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited to the specific embodiments disclosed below. It should be pointed out that for those of ordinary skill in the art, several changes and improvements can be made without departing from the concept of the present invention. All other embodiments obtained without paying creative labor belong to the scope of protection of the present invention.
[0028] Example 1
[0029] like Figure 1 As shown, an EFK log collection and analysis method for data aggregation, the specific steps are as follows:
[0030] 1. Enhanced data collection layer: Combining self-developed tools Agent and Filebeat, it not only covers the comprehensive collection of system logs and container logs, but also extends to real-time monitoring data of hardware resources (CPU, GPU, memory, disk, network), achieving wider coverage of data sources.
[0031] Among them, Filebeat is a lightweight log collection tool. This method will configure a custom collection directory, dynamically collect system logs, container logs, pod logs, and service logs in the server, and start it as a daemon process.
[0032] Among them, Agent is a self-developed system data collection tool that can collect the system's hardware resources and GPU computing card parameters, including but not limited to CPU usage, memory usage, disk I / O, network I / O, process information, graphics card usage, video memory usage, graphics card quantity, temperature and power information.
[0033] By combining log data and system data, this method can count the resource usage data and process logs of key processes in the system in a specific time period, and through the combination, the operation of key processes can be better monitored. If a log failure or resource monitoring alarm occurs, the key process problem can be located in the first time.
[0034] 2. Introduce a high-performance buffering mechanism: Use Kafka as the middleware to build a high-throughput, low-latency data transmission channel to effectively alleviate data peak pressure, ensure the continuity and reliability of data flow, and lay a solid foundation for real-time processing and analysis.
[0035] Among them, Kafka is deployed in a cluster and combined with ZooKeeper for metadata management. The producer and consumer of Kafka can be accessed through any node IP in the cluster. It has been verified that with three working nodes, the producer throughput of 11MB / sec and the consumer throughput of 220MB / sec can be achieved, which can meet the training data volume of 10,000 cards.
[0036] 3. Upgrade real-time stream processing capabilities: By configuring Flink's job function, you can customize data aggregation rules, merge log data and system data into a structure to achieve data management, and optimize data storage and retrieval efficiency. The data is indexed by time and server address, and contains system status data and process text information at the collection time point. The process is the smallest statistical unit, and the status of each process is recorded. The retrieval efficiency optimization of the data structure includes index optimization, data partitioning, and column storage; column storage is a retrieval optimization method in ClickHouse.
[0037] At the same time, by using Flink SQL for unified batch processing and stream processing, the data is divided into full data and key data. Among them, the key data is defined by custom rules and is some data that needs to be analyzed and recorded.
[0038] Among them, Flink is integrated as a powerful real-time stream processing engine, which supports complex event processing and window computing to ensure the timeliness and accuracy of data processing. It performs particularly well in high-throughput scenarios such as large-scale machine learning model training, realizes exactly-once processing semantics, and enhances the robustness of the system.
[0039] 4. Dual storage strategy optimizes analysis efficiency: By distributing aggregated data to ElasticSearch and ClickHouse, the advantages of both are utilized - ElasticSearch's full-text retrieval and log management capabilities, and ClickHouse's high-speed online analytical processing (OLAP) capabilities. This not only meets the needs of flexible instant search, but also realizes efficient statistical analysis of massive historical data, significantly improving data utilization efficiency and analysis depth.
[0040] 5. Metadata management and visualization integration: Metadata management with ZooKeeper ensures the consistency of cluster configuration and the efficiency of service discovery. Kibana, as a visualization front-end, provides an intuitive log viewing and data analysis interface, supports users to directly observe data through OpenAPI or Kibana, greatly simplifies the operation process and improves the user experience.
[0041] Example 2
[0042] S1. Prepare several servers with the same configuration. This case adopts a solution of 1 control node + 3 working nodes + several business servers, with 96 cores, 376G memory, 3.5T disk space, and 20G bandwidth network card.
[0043] S2. Deploy Kubernetes cluster nodes and configure NFS servers for persistent data storage.
[0044] S3. Use the scripts provided by this method to deploy cluster service components with one click: including Kafka, Flink, ElasticSearch, ClickHouse, and ZooKeeper;
[0045] S4. Deploy Agent and Filebeat tools on the business server through scripts, start them as system resident processes, modify the parameters in the configuration file to specify the EFK address and tool sampling interval, and send the data to the Kafka module after data collection;
[0046] like Figure 2 As shown, the tools deployed in S2, S3, and S4, the first layer is the physical storage layer, the data is actually stored in the medium, this method uses the NFS file server to store related data;
[0047] The second layer is the EFK cluster layer, which is used to deploy data caching, data aggregation, data retrieval, and data storage tools, and configure the cluster gateway for external communication access;
[0048] The third layer is the actual working node, on which log collection tools and data collection tools are deployed;
[0049] S5, the Kafka module stores the processed data in a specific data structure by configuring Flink’s aggregation rules;
[0050] S6. The new data structure will be stored in ElasticSearch for persistent storage according to its hierarchy. Alarm data or related data exceeding the threshold in the rules will be stored in ClickHouse.
[0051] S7. Through Kibana, you can query the full amount of data stored in ElasticSearch for common log query functions;
[0052] S8. The data stored in ClickHouse will be stored in different tables according to its function and level, and used for monitoring alarms or error cause queries and other functions.
[0053] like Figure 3 As shown in the figure, it is a timing diagram displayed after the deployment of S5, S6, S7, and S8 tools. After the deployment of the working node tool is completed, log collection and system data collection will be performed, and the data will be sent to the data buffer service for temporary storage, and then a specific data structure will be formed through data aggregation; according to the aggregation rule screening, the full amount of data will be stored in ElasticSearch, and the part that needs to be analyzed for the triggering rule will be stored in ClickHouse for analysis. Finally, data query and monitoring alarm can be performed in the visualization tool.
[0054] In summary, the EFK log collection and analysis framework of the present invention, through technology selection and architecture optimization, not only improves the real-time and accuracy of data processing, but also enhances the flexibility and scalability of the system in the field of big data analysis, and provides strong support for various application scenarios, especially complex log analysis and high-performance data aggregation needs.
Claims
1. An EFK log collection and analysis method for data aggregation, characterized in that: The following steps are involved: (1) Collect log data and system parameters; (2) The log data collected in step (1) is cached uniformly for preprocessing; (3) Aggregating the data processed in step (2) to generate a data structure; (4) The data structures obtained in step (3) are stored in different types of databases suitable for their access patterns and query requirements according to their levels and characteristics; (5) Build API interface and visual query interface.
2. The EFK log collection and analysis method for data aggregation according to claim 1, characterized in that: In the step (1), the collection of log data and system parameters is completed by the Agent and Filebeat tools, wherein the Filebeat is configured to dynamically collect system logs, container logs, pod logs and service logs in the server; the Agent is configured to collect the hardware resources and GPU computing card parameters of the collection system, and the hardware resources include CPU usage, memory usage, disk I / O, network I / O, process information, graphics card usage, video memory usage, graphics card quantity, temperature and power information.
3. The EFK log collection and analysis method for data aggregation according to claim 1, characterized in that: The step (2) is specifically as follows: using the high-performance distributed stream processing tool Kafka to build a high-throughput, low-latency data transmission channel, and pre-processing the data collected in step (1) through Kafka; at the same time, the data entering Kafka is preliminarily cleaned and filtered, and partitioned and indexed as needed, effectively alleviating the data peak pressure and ensuring the continuity and reliability of data flow.
4. The EFK log collection and analysis method for data aggregation according to claim 1, characterized in that: The step (3) is specifically as follows: the data obtained by preprocessing in step (2) is introduced into Flink for aggregation, a custom aggregation rule is configured in Flink, and the log data and system data are deeply aggregated according to actual needs. The aggregated data is stored in a structured form, a data structure is generated, and the data is organized with time and server address as indexes. The structure also includes system status data and process text information at the collection time point, and takes the process as the smallest statistical unit to record the status of each process.
5. The EFK log collection and analysis method for data aggregation according to claim 1, characterized in that: The step (4) is specifically as follows: adopting a dual storage strategy, distributing the data structure obtained by aggregation in step (3) to Elasticsearch and ClickHouse to optimize analysis efficiency, and storing the data in different types of databases according to the level and characteristics of the data to better meet the access and query requirements of different data, wherein the different types of databases include relational databases, NoSQL databases, and time series databases.
6. The EFK log collection and analysis method for data aggregation according to claim 1, characterized in that: The step (5) is specifically as follows: using ZooKeeper to manage metadata, using Kibana as a visualization front-end to provide an intuitive log viewing and data analysis interface, and supporting users to directly observe data through OpenAPI or Kibana.
7. The EFK log collection and analysis method for data aggregation according to claim 1, characterized in that: The functions of the visual query interface described in step (5) include query statement construction, real-time data display, and historical data comparison and analysis.
Citation Information
Patent Citations
Multi-source heterogeneous data real-time processing system and method based on Flink stream computing technology
CN110245158A
Log collection method, device and system
CN113778810A
Log aggregation analysis method and device, network equipment and medium
CN117591376A
GPU cluster data acquisition and analysis platform based on ELK
CN117827442A
Cited By
Log collection and analysis method and system based on weight
CN119646854A
