Log collection method, apparatus, device, and medium

CN115221003BActive Publication Date: 2026-09-22VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210782867.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-05
Publication Date
2026-09-22
Estimated Expiration
2042-07-05

AI Technical Summary

Technical Problem

[0004]本申请实施例的目的是提供一种日志采集方法、装置、设备及介质,能够解决相关技术中容器日志采集方案时效性不高,容器发布后容器日志无法及时采集的问题

Benefits of technology

[0013]在本申请实施例中,在CICD发布业务容器之后,宿主机可以主动获取该业务容器所在的业务容器组pod的名称信息和CICD下发的第一配置信息,并从业务pod的名称信息中获取第二配置信息。基于此,宿主机通过向第一服务器(即采集管理服务器)发送第一配置信息和第二配置信息,可以接收到该第一服务器基于采集配置信息发送的采集任务信息,从而基于该采集任务信息采集业务容器的日志数据。本申请实施例提供的日志采集方案,宿主机可以主动获取并向采集管理服务器主动上报采集配置信息,无需容器管理服务器与采集管理服务器之间进行信息交互,因此能够避免出现容器管理服务器与采集管理服务器的信息交互耗时过长或者交互环节出现问题,导致采集管理服务器无法及时下发采集任务信息的情况,保证容器发布后宿主机能够及时接收到采集任务信息并采集日志数据,提升容器日志采集方案的时效性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221003B_ABST
    Figure CN115221003B_ABST
Patent Text Reader

Abstract

The application discloses a log collection method, device, equipment and medium, and belongs to the technical field of computers. The log collection method comprises the following steps: in the case that a release change platform CICD releases a business container, acquiring name information of a business container group pod where the business container is located and first configuration information issued by the CICD; acquiring second configuration information based on the name information of the business pod; sending collection configuration information to a first server, wherein the collection configuration information comprises the first configuration information and the second configuration information; receiving collection task information sent by the first server based on the collection configuration information; and collecting log data of the business container based on the collection task information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer technology, specifically relating to a log collection method, apparatus, device, and medium. Background Technology

[0002] As users place increasing emphasis on the efficiency of cloud application development, deployment, and operation, container technology continues to evolve, and the application value of containers is becoming increasingly prominent. Compared to traditional applications, containerized applications are easier to automate deployment and can run multiple instances simultaneously in the same environment without interfering with each other. Therefore, more and more businesses are now using containers to accomplish their tasks.

[0003] In related technologies, container log data needs to be collected after container deployment. Based on the collected log data, users can not only understand the health status of their business in a timely manner, but also perform business-side data analysis and monitoring alerts. However, current container log collection solutions are not timely, and the inability to collect container logs after deployment can easily lead to business losses. Summary of the Invention

[0004] The purpose of this application is to provide a log collection method, apparatus, device, and medium that can solve the problems of low timeliness of container log collection schemes in related technologies and the inability to collect container logs in a timely manner after container deployment.

[0005] In a first aspect, embodiments of this application provide a log collection method, which includes: when a business container is published on a CICD (Content Container Registry) platform, obtaining the name information of the business container group pod where the business container is located, and the first configuration information issued by CICD; obtaining second configuration information based on the name information of the business pod; sending collection configuration information to a first server, the collection configuration information including the first configuration information and the second configuration information; receiving collection task information sent by the first server based on the collection configuration information; and collecting log data of the business container based on the collection task information.

[0006] Secondly, embodiments of this application provide a log collection method, which includes: receiving collection configuration information corresponding to the business container sent by the host machine when a business container is deployed in CICD; determining collection task information according to the collection configuration information corresponding to the business container; and sending the collection task information to the agent in the host machine so that the agent collects log data of the business container.

[0007] Thirdly, embodiments of this application provide a log collection device, which includes: an acquisition module, used to acquire the name information of the business container group pod where the business container is located, and the first configuration information issued by the CICD, when the business container is released by the CICD release platform; the acquisition module is also used to acquire second configuration information based on the name information of the business pod; a transceiver module, used to send collection configuration information to a first server, the collection configuration information including the first configuration information and the second configuration information; the transceiver module is also used to receive collection task information sent by the first server based on the collection configuration information; and a log collection module, used to collect log data of the business container based on the collection task information.

[0008] Fourthly, embodiments of this application provide a log collection device, which includes: a receiving module, used to receive collection configuration information corresponding to the service container sent by the host machine when a service container is deployed in CICD; a determining module, used to determine collection task information according to the collection configuration information corresponding to the service container; and a sending module, used to send the collection task information to an agent in the host machine so that the agent collects log data of the service container.

[0009] Fifthly, embodiments of this application provide an electronic device, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the log collection method as described in the first or second aspect.

[0010] In a sixth aspect, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the log collection method as described in the first or second aspect.

[0011] In a seventh aspect, embodiments of this application provide a chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the steps of the log collection method as described in the first or second aspect.

[0012] Eighthly, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the log collection method as described in the first or second aspect.

[0013] In this embodiment, after the CICD deploys the service container, the host machine can proactively obtain the name information of the service container group pod where the service container resides and the first configuration information issued by the CICD, and obtain the second configuration information from the name information of the service pod. Based on this, the host machine can receive the collection task information sent by the first server (i.e., the collection management server) based on the collection configuration information by sending the first configuration information and the second configuration information to the first server, thereby collecting the log data of the service container based on the collection task information. The log collection scheme provided in this embodiment allows the host machine to proactively obtain and report the collection configuration information to the collection management server, eliminating the need for information interaction between the container management server and the collection management server. Therefore, it avoids situations where the information interaction between the container management server and the collection management server takes too long or encounters problems in the interaction process, resulting in the collection management server being unable to issue the collection task information in a timely manner. This ensures that the host machine can receive the collection task information and collect log data in a timely manner after the container is deployed, improving the timeliness of the container log collection scheme. Attached Figure Description

[0014] Figure 1 This is one of the schematic diagrams illustrating an example of the log collection architecture provided in the embodiments of this application;

[0015] Figure 2 This is one of the flowcharts illustrating the log collection method provided in the embodiments of this application;

[0016] Figure 3 This is a second schematic diagram illustrating an example of the log collection architecture provided in this application embodiment;

[0017] Figure 4 This is a second schematic flowchart of the log collection method provided in the embodiments of this application;

[0018] Figure 5 This is one of the structural schematic diagrams of the log collection device provided in the embodiments of this application;

[0019] Figure 6 This is a second schematic diagram of the log collection device provided in the embodiments of this application;

[0020] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0021] Figure 8 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0022] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0023] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0024] First, the technical terms involved in the technical solutions provided in the embodiments of this application will be introduced:

[0025] Deploying a container: The process of deploying an image to a host machine to run the entity. The relationship between an image and a container is similar to that between a class and an instance in object-oriented programming; the image is a static definition, while the container is the runtime entity of the image. Containers can be created, started, stopped, deleted, paused, etc.

[0026] The CICD release platform can be used to release business containers, including continuous integration and continuous delivery capabilities.

[0027] The log collection agent is a proxy program responsible for collecting log data.

[0028] A pod is the smallest deployable and manageable unit in Kubernetes. A pod can contain multiple containers, and a pod represents a process running in a cluster.

[0029] Log pod: A pod used for log collection.

[0030] The log collection method provided in this application embodiment can be applied to, for example... Figure 1 In the architecture, specifically combined Figure 1 Please provide a detailed explanation.

[0031] Figure 1This is a schematic diagram illustrating an example of the log collection architecture provided in this application embodiment.

[0032] like Figure 1 As shown, the log collection architecture 10 includes a container management server 110, a collection management server 120, a CICD 130, and a host machine 140. The container management server 110 is connected to the collection management server 120 and the CICD 130, and the host machine 140 is connected to the collection management server 120 and the CICD 130.

[0033] In related technologies, after the container management server 110 detects that the CICD 130 has published a business container, it interacts with the collection management server 120 to send collection task information to the host machine 140. After receiving the collection task information, the host machine 140 starts container log collection.

[0034] However, after the CICD130 deploys the business container, if the information exchange between the container management server 110 and the data collection management server 120 takes too long, or if problems occur in the exchange process, the data collection management server 120 cannot promptly send data collection task information to the host machine 140. Therefore, the host machine 140 cannot start container log collection in a timely manner, affecting the timeliness of container log collection. This results in the inability to promptly detect the health status of containers and to obtain log information of deployed services in a timely manner. Especially when deploying important and sensitive business containers, personnel making changes or business operations personnel cannot promptly understand the health status of the business, and may even fail to detect abnormal logs in a timely manner, delaying processing time and causing significant losses to the business.

[0035] To address the problems in related technologies, this application provides a log collection method. After a business container is deployed in a CICD system, the host machine can proactively acquire and report collection configuration information to the collection management server. This eliminates the need for information interaction between the container management server and the collection management server, thus avoiding situations where the information interaction between the container management server and the collection management server takes too long or encounters problems, preventing the collection management server from issuing collection task information in a timely manner. This ensures that the host machine can receive collection task information and collect log data promptly after the container is deployed, improving the timeliness of the container log collection solution and solving the problem of low timeliness and failure to collect container logs in a timely manner after container deployment in related technologies.

[0036] The log collection method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0037] Figure 2This is a flowchart illustrating a log collection method provided in an embodiment of this application. The execution entity of this log collection method can be a host machine. It should be noted that the aforementioned execution entity does not constitute a limitation on this application.

[0038] like Figure 2 As shown, the log collection method provided in this application embodiment may include steps 210-250.

[0039] Step 210: In the case of CICD publishing a business container, obtain the name information of the business container group pod where the business container is located, as well as the first configuration information issued by CICD.

[0040] Specifically, the host machine can monitor CICD, and when CICD releases a business container, the host machine can detect the release of the business container in a timely manner.

[0041] Step 220: Obtain the second configuration information based on the business pod name information.

[0042] Step 230: Send the collection configuration information to the first server.

[0043] The collection configuration information includes first configuration information and second configuration information. The first server can be a collection management server used to issue collection task information.

[0044] Step 240: Receive the collection task information sent by the first server based on the collection configuration information.

[0045] Step 250: Collect log data from the business container based on the collection task information.

[0046] The log collection method provided in this application embodiment allows the host machine to proactively obtain the name information of the business container group pod where the business container resides and the first configuration information issued by the CICD after the business container is deployed by CICD. It also retrieves second configuration information from the business pod's name information. Based on this, the host machine sends the first and second configuration information to a first server (i.e., the collection management server) and receives collection task information sent by the first server based on the collection configuration information. This allows the host machine to collect log data from the business container based on the collection task information. The log collection scheme provided in this application embodiment allows the host machine to proactively obtain and report collection configuration information to the collection management server, eliminating the need for information interaction between the container management server and the collection management server. This avoids situations where information interaction between the container management server and the collection management server takes too long or encounters problems, preventing the collection management server from issuing collection task information in a timely manner. This ensures that the host machine can receive collection task information and collect log data promptly after the container is deployed, improving the timeliness of the container log collection scheme.

[0047] The specific implementation methods of steps 210-250 above will be explained in detail below.

[0048] In step 210, when a business container is published by CICD, the name information of the business container group pod where the business container is located, as well as the first configuration information issued by CICD, are obtained.

[0049] Specifically, before CICD publishes a service container, users can perform configuration operations on the CICD so that CICD can issue the first configuration information after publishing the service container.

[0050] In some embodiments of this application, the host machine includes a business pod and a log collection pod. Step 210 may specifically include: obtaining the name information of the business container group pod where the business container is located, and the first configuration information issued by CICD, through the sidecar container in the log collection pod.

[0051] For example, such as Figure 3 As shown, host machine 140 may include a log collection pod and n service pods. The log collection pod is used to collect log data. The log pod may include a sidecar container 301 and an agent 302. Host machine 140 can obtain the name information and initial configuration information of the service pod where the service container is located through the sidecar container 301.

[0052] In this embodiment, after CICD publishes a service container, the host machine where the service container resides can obtain the name information of the service pod where the service container resides, as well as the first configuration information issued by CICD, through the sidecar container in the log collection pod. That is, the sidecar container in the host machine can promptly obtain the collection configuration information of the service container after CICD publishes it. Since the collection management server can only issue collection task information after receiving the collection configuration information, improving the acquisition speed of the collection configuration information can achieve the goal of improving the issuance speed of collection task information and timely log collection.

[0053] Step 220 involves obtaining the second configuration information based on the name information of the business pod.

[0054] Specifically, after obtaining the name information of the business pod, the sidecar container in the host machine can extract the second configuration information from that name information.

[0055] In one embodiment, CICD can verify that the name information of the service pod meets a preset rule, which can be "{serviceName}-{env}-{pod ID}".

[0056] The steps involve step 230, sending collection configuration information to the first server, and step 240, receiving collection task information sent by the first server based on the collection configuration information.

[0057] In some embodiments of this application, the log collection pod includes a log collection agent, and step 230 may specifically include: sending collection configuration information to the first server through the sidecar container in the log collection pod; step 240 may specifically include: receiving collection task information sent by the first server based on the collection configuration information through the agent, wherein the collection task information includes triplet information.

[0058] The data collection task information is determined based on the data collection configuration information, and the triplet information may include the data collection task identifier ID, the service node ID, and the host machine Internet Protocol address.

[0059] Specifically, on the host machine, the sidecar container in the log collection pod sends collection configuration information to the first server. After receiving the collection configuration information, the first server can determine the collection task information of the business container and complete the automatic registration of the log collection task for the business container. Based on this, the first server directly sends the collection task information to the agent on the host machine. After receiving the collection task information, the agent starts the log collection of the business container.

[0060] For example, such as Figure 3 As shown, the first server is the data collection management server 120, and the log pod can include a sidecar container 301 and an agent 302. The sidecar container 301 can report data collection configuration information to the data collection management server 120. After receiving the data collection configuration information, the data collection management server 120 sends data collection task information to the agent 302.

[0061] In this embodiment, the sidecar container in the log collection pod has the function of actively acquiring and reporting collection configuration information. Therefore, after the business container is deployed, the host machine where the business container resides can obtain the collection configuration information in a timely manner through the sidecar container. Compared with the information interaction between the container management server and the collection management server, the sidecar container can actively report directly to the collection management server, which can greatly shorten the time and avoid the failure to report collection configuration information due to errors in the interaction between the container management server and the collection management server, thereby improving the stability of container log collection.

[0062] In one embodiment, the sidecar container and the agent container in the log collection pod share the same inter-process communication (IPC) namespace, so they can communicate with each other using standard inter-process communication methods, such as System V semaphores and POSIX shared memory. Therefore, after step 220, the method may further include: sending collection configuration information to the agent through the sidecar container in the log collection pod.

[0063] Step 250 involves collecting log data from the business container based on the collection task information.

[0064] In some embodiments of this application, step 250 may specifically include: when the agent receives the collection task information, collecting log data of the business container through the agent.

[0065] Specifically, when the agent receives the collection task information from the business container, it directly starts the log collection of that business container.

[0066] In this embodiment, compared to the scheme where the agent actively sends a request message to the data collection management server to request the data collection management server to issue data collection task information, the data collection management server of this application can actively issue data collection task information to the agent. The agent does not need to send a request message, which simplifies the intermediate steps of container publishing to log collection, enables the agent to perceive data collection task information in a timely manner, and improves the timeliness of container publishing to log collection to the millisecond level.

[0067] In one embodiment, after step 250, the method may further include: sending log data of the business container to Kafka so that Kafka can write the log data to the full-text search tool (Elastic Search, ES) in the log center.

[0068] In some embodiments of this application, the collected configuration information includes first configuration information and second configuration information. The first configuration information may include at least one of the following: rate limiting configuration information, topic, configuration environment information, and full-text search tool ES configuration information. The second configuration information may include at least one of the following: the host IP address corresponding to the business container, service name information, and log collection path information.

[0069] In some embodiments of this application, in order to provide a detailed description of the information interaction process between the host machine and the first server, Figure 4 This is a flowchart illustrating another log collection method provided in this application embodiment, wherein the execution subject of the log collection method can be a first server.

[0070] It should be noted that the aforementioned implementing entities do not constitute a limitation on this application.

[0071] like Figure 4 As shown, the log collection method provided in this application embodiment may include steps 410-430.

[0072] Step 410: In the case of CICD publishing a service container, receive the collection configuration information corresponding to the service container sent by the host machine.

[0073] Specifically, when CICD publishes a service container, the sidecar container in the host machine actively obtains and reports the collection configuration information to the first server, and the first server can receive the collection configuration information sent by the sidecar container.

[0074] Step 420: Determine the collection task information based on the collection configuration information corresponding to the business container.

[0075] Step 430: Send collection task information to the agent in the host machine so that the agent can collect log data of the business container.

[0076] The log collection method provided in this application embodiment allows a first server to receive collection configuration information actively reported by the host machine after the CICD deploys the business container, and to determine collection task information based on this configuration information. Compared to the scheme where the agent actively requests the collection management server to issue collection task information, the first server actively issues the collection task information to the agent in the host machine, enabling the agent to perceive the collection task information in real time, improving the timeliness of agent container log collection, and reducing business losses caused by untimely detection of abnormal logs.

[0077] In one embodiment, step 420 may specifically include: upon receiving the collection configuration information, obtaining the cache information of the Remote Dictionary Server (Redis); determining the triple information based on the Redis cache information and the collection configuration information; and registering the log collection task corresponding to the business container by writing the triple information into the database to obtain the collection task information.

[0078] Specifically, after determining the collection task information, the first server automatically registers the log collection task corresponding to the business container by storing the collection task information in the database.

[0079] The data collection task information includes triplet information, which may include the data collection task ID, service node ID, and host IP address. The data collection task information may include, but is not limited to: data collection task ID, service node ID, machine IP address, host IP address, business service name, log collection path, data collection task status (collecting), rate limit configuration information, topic, configuration environment information, and esIndex (including service name information).

[0080] In this embodiment, the data collection management server can directly receive the data collection configuration information sent by the host machine and obtain Redis cache information. Based on this, the triple information can be determined based on the Redis cache information and the data collection configuration information. By writing the triple information into the database, the log collection task corresponding to the business container is registered, and the data collection task information is obtained. The entire process of registering the log collection task does not require information interaction with the container management server, but directly interfaces with the host machine. This avoids situations where the information interaction between the container management server and the data collection management server takes too long or encounters problems in the interaction process, resulting in the data collection management server being unable to send the data collection task information in a timely manner. This ensures that the log collection task can be sent in a timely manner after the container is deployed. By sending the data collection task information to the host machine, the host machine can be aware of the log collection task and collect log data in a timely manner, improving the timeliness of the container log collection solution.

[0081] It should be noted that the log collection method provided in this application can be executed by a log collection device or a control module within that log collection device for performing the log collection method. This application uses the example of a log collection device executing a log collection method to illustrate the log collection device provided in this application. The log collection device will be described in detail below.

[0082] Figure 5 This is a schematic diagram of the structure of a log collection device provided in this application.

[0083] like Figure 5 As shown in the figure, this application embodiment provides a log collection device 500, which includes: an acquisition module 510, a transceiver module 520, and a log collection module 530.

[0084] The acquisition module 510 is used to acquire the name information of the business container group pod where the business container is located, as well as the first configuration information issued by CICD, when the business container is released on the CICD release platform; the acquisition module 510 is also used to acquire the second configuration information based on the name information of the business pod; the transceiver module 520 is used to send the collection configuration information to the first server, the collection configuration information including the first configuration information and the second configuration information; the transceiver module 520 is also used to receive the collection task information sent by the first server based on the collection configuration information; the log collection module 530 is used to collect the log data of the business container based on the collection task information.

[0085] The log collection device provided in this application embodiment allows the host machine to proactively obtain the name information of the business container group pod where the business container resides and the first configuration information issued by the CICD after the CICD deploys the business container. It also retrieves the second configuration information from the business pod's name information. Based on this, the host machine sends the first and second configuration information to a first server (i.e., the collection management server) and receives collection task information sent by the first server based on the collection configuration information. This allows the host machine to collect log data from the business container based on the collection task information. The log collection scheme provided in this application embodiment allows the host machine to proactively obtain and report collection configuration information to the collection management server, eliminating the need for information interaction between the container management server and the collection management server. This avoids situations where information interaction between the container management server and the collection management server takes too long or encounters problems, preventing the collection management server from issuing collection task information in a timely manner. This ensures that the host machine can receive the collection task information and collect log data promptly after the container is deployed, improving the timeliness of the container log collection scheme.

[0086] In some embodiments of this application, the acquisition module 510 is specifically used to: obtain the name information of the business pod where the business container is located, and the first configuration information issued by CICD, through the sidecar container in the log collection pod.

[0087] In some embodiments of this application, the log collection pod includes a log collection agent. The transceiver module 520 is specifically used to: send collection configuration information to the first server through the sidecar container in the log collection pod; and receive collection task information sent by the first server based on the collection configuration information through the agent. The collection task information includes triple information, which includes a collection task identifier ID, a service node ID, and a host Internet Protocol address. The log collection module 530 is specifically used to: collect log data from the business container through the agent when the agent receives the collection task information.

[0088] In some embodiments of this application, the log collection pod includes a log collection agent, and the transceiver module 520 is further configured to send collection configuration information to the agent through the sidecar container in the log collection pod.

[0089] In some embodiments of this application, the first configuration information includes at least one of the following: rate limit configuration information, topic, configuration environment information, and full-text search tool ES configuration information; the second configuration information includes at least one of the following: the host machine Internet Protocol IP address corresponding to the business container, service name information, and log collection path information.

[0090] The log collection device provided in this application embodiment can achieve... Figure 2 The various processes implemented by the electronic device in the method embodiment can achieve the same technical effect, and will not be described again here to avoid repetition.

[0091] Figure 6 This is a schematic diagram of the structure of a log collection device provided in this application.

[0092] like Figure 6 As shown in the figure, this application embodiment provides a log collection device 600, which includes: a receiving module 610, a determining module 620, and a sending module 630.

[0093] The receiving module 610 is used to receive the collection configuration information corresponding to the business container sent by the host machine when the business container is published by CICD; the determining module 620 is used to determine the collection task information according to the collection configuration information corresponding to the business container; and the sending module 630 is used to send the collection task information to the agent in the host machine so that the agent can collect the log data of the business container.

[0094] The log collection device provided in this application embodiment allows the first server to receive collection configuration information actively reported by the host machine after the CICD publishes the service container, and to determine collection task information based on this configuration information. Compared to the scheme where the agent actively requests the collection management server to issue collection task information, the first server actively issues the collection task information to the agent in the host machine, enabling the agent to perceive the collection task information in real time, improving the timeliness of agent container log collection, and reducing business losses caused by untimely detection of abnormal logs.

[0095] In some embodiments of this application, the determining module 620 includes: an acquisition unit, configured to acquire remote data service Redis cache information upon receiving collection configuration information; a determining unit, configured to determine triplet information based on the Redis cache information and the collection configuration information, wherein the triplet information includes a collection task identifier ID, a service node ID, and a host machine Internet Protocol address; and a registration unit, configured to register the log collection task corresponding to the business container by writing the triplet information into the database, thereby obtaining collection task information, wherein the collection task information includes the triplet information.

[0096] The log collection device provided in this application embodiment can achieve... Figure 4 The various processes implemented by the electronic device in the method embodiment can achieve the same technical effect, and will not be described again here to avoid repetition.

[0097] The log collection device in this application embodiment can be an electronic device, or a component, integrated circuit, or chip within an electronic device. The electronic device can be a terminal, or any other device besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0098] The log collection device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0099] Optionally, such as Figure 7As shown, this application embodiment also provides an electronic device 700, including a processor 701, a memory 702, and a program or instructions stored in the memory 702 and executable on the processor 701. When the program or instructions are executed by the processor 701, they implement the various processes of the above-described log collection method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0100] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0101] Figure 8 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application.

[0102] The electronic device 800 includes, but is not limited to, components such as: radio frequency unit 801, network module 802, audio output unit 803, input unit 804, sensor 805, display unit 806, user input unit 807, interface unit 808, memory 809, and processor 810.

[0103] Those skilled in the art will understand that the electronic device 800 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 810 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0104] In one embodiment, the processor 810 is configured to, when a business container is published on a CICD (CID-based Change Container Registry) platform, obtain the name information of the business container group pod where the business container resides, and the first configuration information issued by the CICD; the processor 810 is further configured to obtain second configuration information based on the name information of the business pod; the radio frequency unit 801 is configured to send collection configuration information to a first server, the collection configuration information including the first configuration information and the second configuration information; the radio frequency unit 801 is further configured to receive collection task information sent by the first server based on the collection configuration information; the processor 810 is further configured to collect log data of the business container based on the collection task information.

[0105] In this embodiment, after the CICD deploys the service container, the host machine can proactively obtain the name information of the service container group pod where the service container resides and the first configuration information issued by the CICD, and obtain the second configuration information from the name information of the service pod. Based on this, the host machine can receive the collection task information sent by the first server (i.e., the collection management server) based on the collection configuration information by sending the first configuration information and the second configuration information to the first server, thereby collecting the log data of the service container based on the collection task information. The log collection scheme provided in this embodiment allows the host machine to proactively obtain and report the collection configuration information to the collection management server, eliminating the need for information interaction between the container management server and the collection management server. Therefore, it avoids situations where the information interaction between the container management server and the collection management server takes too long or encounters problems in the interaction process, resulting in the collection management server being unable to issue the collection task information in a timely manner. This ensures that the host machine can receive the collection task information and collect log data in a timely manner after the container is deployed, improving the timeliness of the container log collection scheme.

[0106] In another embodiment, the radio frequency unit 801 is used to receive the collection configuration information corresponding to the service container sent by the host machine when the CICD publishes the service container; the processor 810 is used to determine the collection task information according to the collection configuration information corresponding to the service container; the radio frequency unit 801 is also used to send the collection task information to the agent in the host machine so that the agent can collect the log data of the service container.

[0107] In this embodiment, after the CICD publishes the service container, the first server can receive the collection configuration information actively reported by the host machine and determine the collection task information based on the collection configuration information. Compared with the scheme where the agent actively requests the collection management server to issue collection task information, the first server actively issues the collection task information to the agent in the host machine, which enables the agent to perceive the collection task information in real time, improves the timeliness of agent container log collection, and reduces business losses caused by untimely detection of abnormal logs.

[0108] It should be understood that, in this embodiment, the input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The GPU 8041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0109] The memory 809 can be used to store software programs and various data. The memory 809 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 809 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 809 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0110] Processor 810 may include one or more processing units; optionally, processor 810 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 810.

[0111] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described log collection method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0112] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer-readable storage medium, examples of which include non-transitory computer-readable storage media such as computer read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0113] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described log collection method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0114] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0115] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the log collection method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0116] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0118] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A log collection method, characterized in that, Applied to the host machine, including: When the host machine detects the CICD (Content Delivery Control Platform) publishing service container, it obtains the name information of the service container group pod where the service container is located, as well as the first configuration information issued by CICD, through the sidecar container in the log collection pod. The second configuration information is obtained by the sidecar container based on the name information of the business pod; The sidecar container sends collection configuration information to the first server. The collection configuration information includes the first configuration information and the second configuration information. The first configuration information includes at least one of the following: rate limit configuration information, topic, configuration environment information, and full-text search tool ES configuration information. The second configuration information includes at least one of the following: the host machine Internet Protocol IP address corresponding to the business container, service name information, and log collection path information. The log collection agent in the log collection pod receives collection task information sent by the first server based on the collection configuration information. The collection task information includes triple information, which includes collection task identifier ID, service node ID, and host Internet Protocol address. Upon receiving the collection task information, the agent collects the log data of the service container.

2. The method according to claim 1, characterized in that, The method further includes: The sidecar container in the log collection pod sends the collection configuration information to the agent.

3. A log collection method, characterized in that, Applied to the first server, including: When the host machine detects a CICD publishing service container, it receives the collection configuration information corresponding to the service container sent by the sidecar container in the host machine. The collection configuration information includes first configuration information and second configuration information. The first configuration information includes at least one of the following: rate limiting configuration information, topic, configuration environment information, and full-text search tool ES configuration information. The second configuration information includes at least one of the following: the host machine Internet Protocol IP address corresponding to the service container, service name information, and log collection path information. Upon receiving the aforementioned data collection configuration information, obtain the remote data service Redis cache information; The triplet information is determined based on Redis cache information and the collection configuration information. The triplet information includes the collection task identifier ID, the service node ID, and the host machine Internet Protocol address. By writing the triplet information into the database, the log collection task corresponding to the business container is registered to obtain the collection task information, which includes the triplet information. The collection task information is sent to the agent in the host machine so that the agent can collect the log data of the service container.

4. A log collection device, characterized in that, Applied to the host machine, including: The acquisition module is used to obtain the name information of the business container group pod where the business container is located, as well as the first configuration information issued by CICD, through the sidecar container in the log collection pod when the host machine detects the release change platform CICD release business container. The acquisition module is also used to acquire second configuration information based on the name information of the business pod through the side vehicle container; The transceiver module is used to send collection configuration information to the first server through the sidecar container. The collection configuration information includes the first configuration information and the second configuration information. The first configuration information includes at least one of the following: rate limit configuration information, topic, configuration environment information, and full-text search tool ES configuration information. The second configuration information includes at least one of the following: the host machine Internet Protocol IP address corresponding to the business container, service name information, and log collection path information. The transceiver module is also used to receive collection task information sent by the first server based on the collection configuration information through the log collection agent in the log collection pod. The collection task information includes triple information, which includes collection task identifier ID, service node ID and host Internet Protocol address. The log collection module is used to collect log data of the business container through the agent when the agent receives the collection task information.

5. A log collection device, characterized in that, Applied to the first server, including: The receiving module is used to receive the collection configuration information corresponding to the CICD publishing service container sent by the sidecar container in the host machine when the host machine detects the CICD publishing service container. The collection configuration information includes first configuration information and second configuration information. The first configuration information includes at least one of the following: rate limiting configuration information, topic, configuration environment information, and full-text search tool ES configuration information. The second configuration information includes at least one of the following: the host machine Internet Protocol IP address corresponding to the service container, service name information, and log collection path information. The acquisition unit is used to acquire Redis cache information of the remote data service upon receiving the acquisition configuration information; The determining unit is used to determine triplet information based on Redis cache information and the collection configuration information, wherein the triplet information includes collection task identifier ID, service node ID, and host machine Internet Protocol address; The registration unit is used to register the log collection task corresponding to the business container by writing the triple information into the database, and to obtain collection task information, wherein the collection task information includes the triple information. The sending module is used to send the collection task information to the agent in the host machine, so that the agent can collect the log data of the service container.

6. An electronic device, characterized in that, The electronic device includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the log collection method as described in any one of claims 1-3.

7. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the log collection method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Log collection method and system

    CN111352691A

  • Log processing method and device and container group

    CN112988528A