Container log management method and device, equipment, medium and program product

By listening to operational events in a serverless architecture and selecting an appropriate storage method to store container logs, the problem of ineffective log storage in serverless containers is solved, achieving efficient and reliable log management and improving debugging and fault location capabilities.

CN120994518APending Publication Date: 2025-11-21BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511157242.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-18
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

In serverless architectures, logs generated during the operation of serverless containers cannot be effectively stored and queried, resulting in low debugging efficiency and difficulty in fault location. Furthermore, existing centralized log collection links suffer from poor reliability and long latency.

Method used

Listen for operational events throughout the container lifecycle, acquire container log data for the target time period through zero-copy or streaming read methods, and select the appropriate storage method (hot storage or cold storage) based on the event metric values ​​to avoid multi-level forwarding and ensure the reliability and real-time performance of data storage.

Benefits of technology

It achieves efficient and reliable storage and fast querying of container logs, reduces storage latency, improves fault location efficiency, and reduces the risk of data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994518A_ABST
    Figure CN120994518A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud computing, in particular to a container log management method and device, equipment, a medium and a program product. According to the container log management method provided by the embodiment of the invention, the container log data is immediately obtained when the occurrence of the operation and maintenance event is monitored, and the storage of the container log data is realized according to the target storage mode corresponding to the operation and maintenance event. In the storage process, multi-stage forwarding is not needed, so that the condition of storage failure caused by a fault of a certain node in the forwarding process is avoided, and the reliability of data storage is ensured. In addition, due to the fact that the storage does not need to be forwarded in a multi-level mode, storage time delay is reduced, and real-time performance of data storage is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of cloud computing technology, and in particular to a container log management method, apparatus, device, medium, and program product. Background Technology

[0002] In serverless platforms, serverless containers are typically destroyed shortly after completing their tasks, making it impossible to view the standard output (stdout) and standard error (stderr) logs (also known as logs or container logs) generated during runtime. Users cannot access these logs when anomalies occur or when auditing is required, thus impacting debugging efficiency and fault location capabilities.

[0003] Currently, log collection and storage primarily rely on a centralized log collection chain. For example, during task execution, the serverless container sends logs to Kafka (a distributed message queue based on a publish / subscribe pattern) via the log collection and processing tool Logstash, and then the consumer writes them to object storage or a database. Users can then retrieve the logs when needed.

[0004] However, due to the multi-level forwarding in the log collection chain, the failure of any node in the chain will result in log loss, leading to a decrease in the reliability of the log collection chain. Moreover, the multi-level forwarding also causes excessive latency in log storage. Summary of the Invention

[0005] To address the aforementioned technical issues, this disclosure provides a container log management method, apparatus, device, media, and program product.

[0006] Firstly, this disclosure provides a container log management method, including:

[0007] When an operational event is detected during the container's lifecycle, the occurrence time and event metric value of the operational event are obtained; for any operational event, the container log data within the target time period is obtained based on the occurrence time and a preset time interval; based on the event metric value, the target storage method is matched, and the container log data is stored according to the target storage method.

[0008] In some optional implementations, container log data for a target time period is obtained, including:

[0009] Extract container log data for the target time period from the container logs using a zero-copy method; or extract container log data for the target time period from the container logs using a streaming read method; the container logs are at least one of the following: logs in the local cache, logs in the standard output stream stdout, and logs in the standard error stream stderr.

[0010] In some optional implementations, the target storage method includes storage space corresponding to the event metric value; storing container log data according to the target storage method includes:

[0011] Container log data is stored in the storage space corresponding to the target storage method; wherein, the event indicator value is either the first indicator value or the second indicator value, and the storage space is a hot storage type storage space, the first indicator value is used to indicate that the operation and maintenance event is a task abnormal exit event, and the second indicator value is used to indicate that the operation and maintenance event is a resource alarm event; or, the event indicator value is the third indicator value, and the storage space is a cold storage type storage space, the third indicator value is used to indicate that the operation and maintenance event is a task normal completion event.

[0012] In some alternative implementations, the method further includes:

[0013] Obtain the event identifier, event type, log level, and container identifier of the operation and maintenance event; generate an index entry for the container log data based on at least one of the following: event identifier, event type, log level, container identifier, and time of occurrence.

[0014] Container log data is stored according to the target storage method, including:

[0015] Store container log data and index entries in the storage space corresponding to the target storage method.

[0016] In some alternative implementations, the method further includes:

[0017] The system receives log query operations from users, including at least one of the following query information: event identifier of the operation and maintenance event, target time period, and log level corresponding to the container log data. In response to the log query operation, the system returns the associated information of the container log data corresponding to the query information to the user.

[0018] In some alternative implementations, the method further includes:

[0019] Delete the container log data when the storage time of the container log data reaches the preset time threshold.

[0020] Secondly, this disclosure provides a container log management apparatus, including:

[0021] The first acquisition module is used to acquire the occurrence time and event metric value of an operation and maintenance event when it is detected during the container lifecycle; the second acquisition module is used to acquire container log data within a target time period for any operation and maintenance event based on the occurrence time and a preset time interval; the storage module is used to match the target storage method based on the event metric value and store the container log data according to the target storage method.

[0022] Thirdly, this disclosure provides a computer device, including:

[0023] The memory and processor are interconnected and communicate with each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the container log management method corresponding to the first aspect and any of its embodiments.

[0024] Fourthly, this disclosure provides a computer-readable storage medium storing computer instructions, which are used to cause a computer to execute the container log management method corresponding to the first aspect and any embodiment thereof.

[0025] Fifthly, this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the container log management method corresponding to the first aspect and any of its embodiments.

[0026] The technical solution provided in this disclosure has the following advantages compared with the prior art:

[0027] The container log management method provided in this embodiment immediately acquires container log data upon detecting an operational event and stores the data according to the target storage method corresponding to the operational event. This storage process eliminates the need for multi-level forwarding, avoiding storage failures due to node failures during forwarding and ensuring data storage reliability. Furthermore, the elimination of multi-level forwarding reduces storage latency and improves the real-time performance of data storage. Attached Figure Description

[0028] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0029] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 A structural connection diagram of a serverless sidecar architecture is provided for embodiments of this disclosure;

[0031] Figure 2 A flowchart illustrating a container log management method provided in this embodiment of the disclosure;

[0032] Figure 3 A structural connection diagram of a container log management device provided in an embodiment of this disclosure;

[0033] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure. Detailed Implementation

[0034] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0035] Numerous specific details are set forth in the following description to provide a thorough understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0036] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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. Unless otherwise specified, 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 the element.

[0037] According to an embodiment of this disclosure, a container log management method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0038] To facilitate understanding, the technical terms involved in the embodiments of this application will be introduced below.

[0039] Serverless containers: Short-lived container instances used in serverless computing platforms to perform a single task. Serverless containers are typically destroyed immediately after the task finishes running.

[0040] Zero-copy is a data transfer method that allows data to be transferred directly between a file and a network buffer without requiring multiple copies between the kernel and user space.

[0041] Streamed reading reads content sequentially as a data stream, without loading the complete file content into memory. It is suitable for large files or memory-constrained scenarios.

[0042] This embodiment provides a container log management method, which can be used for, for example Figure 1 The serverless sidecar architecture shown is illustrated. For example... Figure 1 As shown, the serverless sidecar architecture includes a serverless container 101 and a sidecar container 102. The serverless container 101 deploys an event listener 1011, while the sidecar container 102 deploys extended components such as a log aggregation trigger 1021, a storage manager 1022, a query interface 1023, and a recycling manager 1024. A description of the functions of these components will be provided later.

[0043] Figure 2 This is a flowchart of a container log management method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process includes the following steps:

[0044] S201: When an operational event is detected during the container's lifecycle, obtain the time of occurrence and the event metric value.

[0045] For example, a container refers to a serverless container 101, and the container lifecycle refers to the time period from the moment the container is created to the moment the container is destroyed.

[0046] Among them, operation and maintenance events refer to predefined events to be listened to. Operation and maintenance events correspond to user needs, and there can be one or more operation and maintenance events.

[0047] The event metric value refers to the value of the event monitoring metric corresponding to the operation and maintenance event when it occurs. Each operation and maintenance event has at least one corresponding event monitoring metric. The event monitoring metrics corresponding to different operation and maintenance events may be the same or different.

[0048] For example, when the operation and maintenance event is a task completion event, the corresponding event monitoring metric is the task execution result. When the value corresponding to the task execution result (i.e., the event metric value) is 0, it indicates that a task completion event has occurred.

[0049] For example, when the operation and maintenance event is a task abnormal exit event, the corresponding event monitoring indicator is still the task execution result. Unlike a task normal completion event, when the value corresponding to the task execution result (i.e., the event indicator value) is 1, it indicates that a task abnormal exit event has occurred.

[0050] For example, when the operation and maintenance event is a resource alarm event, the corresponding event monitoring indicator is the resource status. When the value corresponding to the resource status (i.e., the event indicator value) is 1, it indicates that a resource alarm event has occurred. For example, resources include, but are not limited to, CPU, memory, and other resources.

[0051] Optionally, monitoring operations and maintenance events can be done by monitoring the values ​​of the corresponding event monitoring metrics. An operations and maintenance event is detected when the monitored metric reaches a preset value.

[0052] Specifically, in combination Figure 1 During the container's lifecycle, an event listener 1011 deployed in serverless container 101 monitors the tasks running within serverless container 101. When the event listener 1011 determines that an operational event has occurred based on the monitored tasks, it can obtain the event's occurrence time and event metric value. The event listener 1011 generates a notification message representing the occurrence of the operational event and sends this notification message to the log aggregation trigger 1021 in the sidecar container 102. It should be noted that the notification message includes at least the operational event's occurrence time and event metric value.

[0053] S202: For any operational event, obtain container log data within the target time period based on the time of occurrence and the preset time interval.

[0054] The preset time interval is a time interval set by the user according to actual needs. For example, the preset time interval can be 10 seconds before and / or after the occurrence of an operation and maintenance event.

[0055] The target time period is determined based on the occurrence time and a preset time interval. For example, the occurrence time of an operation and maintenance event is t, and the preset time interval is from before the operation and maintenance event to m seconds after the event. Then, the target time period is [tm, t+m].

[0056] Specifically, in combination Figure 1When the log aggregation trigger 1021 in the sidecar container 102 receives a notification from the event listener 1011 in the serverless container 101, it retrieves the occurrence time of the operation and maintenance event from the notification and determines the target time period based on the occurrence time and a preset time interval. Then, it sends a request to the container logs and retrieves the container log data within the target time period.

[0057] S203: Match the target storage method based on the event metric value, and store the container log data according to the target storage method.

[0058] The target storage method corresponds to the operation and maintenance event.

[0059] Specifically, in combination Figure 1 After the log aggregation trigger 1021 in the sidecar container 102 obtains the container log data via S202, it sends the obtained container log data to the storage manager 1022 in the sidecar container 102. The storage manager 1022 then matches the target storage method for the corresponding operation and maintenance event based on the event metric value and stores the container log data according to the target storage method.

[0060] The container log management method disclosed herein immediately retrieves container log data upon detecting an operational event and stores the data according to the target storage method corresponding to the operational event. This storage process eliminates the need for multi-level forwarding, preventing storage failures due to node failures during forwarding and ensuring data storage reliability. Furthermore, the elimination of multi-level forwarding reduces storage latency, ensuring real-time data storage.

[0061] In some embodiments, to obtain container log data more efficiently, the process of obtaining container log data within a target time period is optimized as follows: the container log data within the target time period is extracted from the container logs using a zero-copy method; or, the container log data within the target time period is extracted from the container logs using a streaming reading method.

[0062] The container logs are at least one of the following: logs in the local cache, logs in the standard output stream stdout, and logs in the standard error stream stderr. It should be noted that the logs in the local cache are not persistently stored; they will be destroyed when the container is destroyed.

[0063] Optional, combined Figure 1After the log aggregation trigger 1021 in the sidecar container 102 sends a request to the container log, it can extract the container log data for the target time period from the container log using a zero-copy method. The zero-copy method directly extracts container log data from the container log, avoiding data copying between kernel space and user space, thereby reducing CPU overhead, minimizing memory bandwidth usage, and improving data transfer efficiency.

[0064] Optional, combined Figure 1 After the log aggregation trigger 1021 in the sidecar container 102 sends a request to the container log, it can also extract container log data within the target time period from the container log using a streaming read method. By reading the container log data sequentially in a data stream manner, there is no need to load the entire file content, thus improving data transmission efficiency.

[0065] In some embodiments, to improve the efficiency of accessing container log data, storing container log data according to the target storage method is optimized to: storing container log data in the storage space corresponding to the target storage method.

[0066] The target storage method includes the storage space corresponding to the event metric values. The storage space corresponding to the event metric values ​​can be understood as the storage space corresponding to the operation and maintenance events represented by the event metric values.

[0067] Among them, the event indicator value is either the first indicator value or the second indicator value, and the storage space is a hot storage type storage space. The first indicator value is used to indicate that the operation and maintenance event is a task abnormal exit event, and the second indicator value is used to indicate that the operation and maintenance event is a resource alarm event; or, the event indicator value is the third indicator value, and the storage space is a cold storage type storage space. The third indicator value is used to indicate that the operation and maintenance event is a task normal completion event.

[0068] For example, hot storage is primarily used to store data that is accessed frequently but in short periods of time. Hot storage can be a local solid-state drive (SSD) cache.

[0069] For example, cold storage type storage space is mainly used to store data that is accessed infrequently over a long period of time. Cold storage type storage space can be cold storage media such as low-frequency access object storage and archive storage.

[0070] Specifically, to improve the efficiency of users accessing container log data, this embodiment provides different target storage methods for container log data of different operation and maintenance events. The differences between the target storage methods are specifically reflected in the different storage spaces.

[0071] Generally, the access frequency of log data is related to the log's anomaly level. Based on this, this embodiment stores container log data corresponding to high-anomaly-level operational events in the hot storage type of storage space; and stores container log data corresponding to low-anomaly-level operational events in the cold storage type of storage space. The anomaly level of an operational event can be understood as the log level of the corresponding container log data when the operational event occurs. The anomaly level of an operational event is preset by the operations personnel.

[0072] For example, the anomaly level of an operational event can include INFO / DEBUG level and ERROR / WARN level. For instance, the anomaly level corresponding to a normal task completion event is INFO / DEBUG level, while the anomaly level corresponding to a task abnormal exit event and a resource alarm event is ERROR / WARN level.

[0073] For example, when the event metric value is the first metric value, it indicates that the operation and maintenance event is a task abnormal exit event. In this case, the container log data corresponding to the task abnormal exit event is stored in the storage space corresponding to the hot storage type. The first metric value means that the task execution result is 1.

[0074] For example, when the event metric value is the second metric value, it indicates that the operational event is a resource alarm event. In this case, the container log data corresponding to the resource alarm event is stored in the storage space corresponding to the hot storage type. The second metric value refers to the resource status value being 1.

[0075] For example, when the event metric value is the third metric value, it indicates that the operation and maintenance event is a normal task completion event. In this case, the container log data corresponding to the normal task completion event is stored in the storage space corresponding to the cold storage type. The third metric value means that the task execution result is 0.

[0076] This disclosure embodiment improves user access efficiency for container log data, increases storage space utilization, and reduces storage costs by classifying and storing container log data.

[0077] Furthermore, to avoid long-term occupation of storage resources by container log data, container log data is deleted when the storage duration of container log data reaches a preset duration threshold.

[0078] The preset duration threshold can be configured according to user needs. The preset duration threshold corresponds to the storage space.

[0079] For example, when container log data is stored in a hot storage type of storage space, the preset duration threshold can be configured to 30 days.

[0080] For example, when container log data is stored in a cold storage type of storage space, the preset duration threshold can be configured to 7 days.

[0081] Optional, combined Figure 1 When container log data is stored in a hot storage type storage space, the recycling manager 1024 records the storage time of the container log data and the corresponding storage duration in the hot storage type storage space. When the storage duration of the container log data reaches a preset duration threshold, the container log data is transferred to a cold storage type storage space and deleted from the hot storage type storage space.

[0082] This embodiment, by deleting container log data in the hot storage type storage space, not only avoids the long-term occupation of the hot storage type storage space by container log data, reducing storage costs, but also ensures that the hot storage type storage space always stores the latest container log data, improving data access efficiency.

[0083] Optional, combined Figure 1 When container log data is stored in a cold storage type storage space, the recycling manager 1024 records the storage time of the container log data and the corresponding storage duration of the container log data in the cold storage type storage space. When the storage duration of the container log data reaches a preset duration threshold, the container log data is deleted from the cold storage type storage space.

[0084] This embodiment deletes expired container log data by deleting it from the cold storage type of storage space. This method reduces the space occupied by invalid container log data and indirectly improves access efficiency by reducing the amount of container log data.

[0085] Furthermore, in combination Figure 1 To prevent storage failures due to insufficient storage space, the recycling manager 1024 can periodically check the remaining storage capacity; when the remaining capacity is less than a preset capacity threshold, an alarm message is issued. The storage space here includes both hot storage and cold storage types.

[0086] This embodiment alerts maintenance personnel to insufficient storage resources, thereby preventing the permanent loss of container log data due to insufficient storage space and improving the security of container log data.

[0087] In some embodiments, to improve the efficiency of indexing container log data, before storing the container log data, the event identifier, event type, log level corresponding to the operation and maintenance event, and container identifier of the container are obtained; an index entry corresponding to the container log data is generated based on at least one of the event identifier, event type, log level corresponding to the container log data, container identifier, and occurrence time. In this case, storing the container log data according to the target storage method includes: storing the container log data and the index entry in the storage space corresponding to the target storage method.

[0088] Optional, combined Figure 1 The event identifier, event type, log level, and container identifier of an operation and maintenance event can be obtained by the event listener 1011 when the operation and maintenance event is detected.

[0089] Optionally, the index entry can be used as the key and the container log data as the value, and the two can be stored as key-value pairs in the storage space corresponding to the target storage method.

[0090] This embodiment improves query efficiency by storing index entries together with container log data.

[0091] Furthermore, it receives log query operations from users; in response to log query operations, it returns to the user the association information of the container log data corresponding to the query information.

[0092] The log query operation includes at least one of the following query information: the event identifier of the operation and maintenance event, the target time period, and the log level corresponding to the container log data.

[0093] Optional, combined Figure 1 A user's log query operation can be a call to query interface 1023. For example, query interface 1023 is a RESTful API.

[0094] Optionally, the association information for container log data can be a link to a log snapshot of the container log data corresponding to the query information.

[0095] Optionally, the association information for container log data can be streaming data of container log data corresponding to the query information.

[0096] For example, users can query container log data by event identifier, by event identifier and target time period, or by target time period and corresponding log level.

[0097] This embodiment also provides a container log management device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0098] This embodiment provides a container log management device, such as... Figure 3 As shown, it includes:

[0099] The first acquisition module 301 is used to acquire the occurrence time and event metric value of the operation and maintenance event when the operation and maintenance event is detected during the container lifecycle.

[0100] The second acquisition module 302 is used to acquire container log data within a target time period for any operation and maintenance event, based on the time of occurrence and a preset time interval.

[0101] Storage module 303 is used to match the target storage method according to the event indicator value and store the container log data according to the target storage method.

[0102] In some alternative implementations, the second acquisition module 302 includes:

[0103] The first extraction submodule is used to extract container log data within a target time period from the container logs using a zero-copy method; or, the second extraction submodule is used to extract container log data within a target time period from the container logs using a streaming read method; the container logs are at least one of the following: logs in the local cache, logs in the standard output stream stdout, and logs in the standard error stream stderr.

[0104] In some optional implementations, the target storage method includes storage space corresponding to the event metric value; storage module 303 includes:

[0105] The first storage submodule is used to store container log data in a storage space corresponding to the target storage method. The event indicator value is either a first indicator value or a second indicator value. The storage space is a hot storage type storage space. The first indicator value is used to indicate that the operation and maintenance event is a task abnormal exit event, and the second indicator value is used to indicate that the operation and maintenance event is a resource alarm event. Alternatively, the event indicator value is a third indicator value. The storage space is a cold storage type storage space. The third indicator value is used to indicate that the operation and maintenance event is a task normal completion event.

[0106] In some alternative embodiments, the apparatus further includes:

[0107] The second acquisition module is used to acquire the event identifier, event type, log level, and container identifier of the operation and maintenance event; the generation module is used to generate an index entry corresponding to the container log data based on at least one of the event identifier, event type, log level, container identifier, and occurrence time of the operation and maintenance event.

[0108] Storage module 303 includes:

[0109] The second storage submodule is used to store container log data and index entries in the storage space corresponding to the target storage method.

[0110] In some alternative embodiments, the apparatus further includes:

[0111] The receiving module is used to receive log query operations from users. The log query operation includes at least one of the following query information: event identifier of the operation and maintenance event, target time period, and log level corresponding to the container log data. The returning module is used to respond to the log query operation and return the associated information of the container log data corresponding to the query information to the user.

[0112] In some alternative embodiments, the apparatus further includes:

[0113] The deletion module is used to delete container log data when the storage time of container log data reaches a preset time threshold.

[0114] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0115] In this embodiment, the container log management device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0116] This disclosure also provides a computer device having the above-described features. Figure 3 The container log management device shown.

[0117] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of this disclosure, such as... Figure 4As shown, the computer device includes one or more processors 401, memory 402, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 4 Take a processor 401 as an example.

[0118] Processor 401 may be a central processing unit, a network processor, or a combination thereof. Processor 401 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0119] The memory 402 stores instructions executable by at least one processor 401 to cause the at least one processor 401 to perform the method shown in the above embodiments.

[0120] Memory 402 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, memory 402 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 402 may optionally include memory remotely located relative to processor 401, and this remote memory may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0121] Memory 402 may include volatile memory, such as random access memory; memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; memory 402 may also include combinations of the above types of memory.

[0122] The computer device also includes a communication interface 403 for communicating with other devices or communication networks.

[0123] This disclosure also provides a computer-readable storage medium in which the methods described in this disclosure can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded over a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium may be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code that, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0124] In addition to the computer devices and computer-readable storage media described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps of the sound source localization method provided in any embodiment of this application.

[0125] Computer program products can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this application. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0126] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A container log management method, characterized in that, include: When an operational event is detected during the container's lifecycle, the occurrence time and event metric value of the operational event are obtained. For any operational event, obtain container log data within the target time period based on the occurrence time and the preset time interval; Based on the event metric value, a target storage method is matched, and the container log data is stored according to the target storage method.

2. The method according to claim 1, characterized in that, The acquisition of container log data within the target time period includes: The container log data for the target time period is extracted from the container logs using a zero-copy method. Alternatively, the container log data for the target time period can be extracted from the container logs using a streaming read method; The container logs are at least one of the following: logs in the local cache, logs in the standard output stream stdout, and logs in the standard error stream stderr.

3. The method according to claim 1, characterized in that, The target storage method includes storage space corresponding to the event metric value; storing the container log data according to the target storage method includes: The container log data is stored in a storage space corresponding to the target storage method; Wherein, the event indicator value is a first indicator value or a second indicator value, the storage space is a hot storage type of storage space, the first indicator value is used to indicate that the operation and maintenance event is a task abnormal exit event, and the second indicator value is used to indicate that the operation and maintenance event is a resource alarm event; Alternatively, the event indicator value may be a third indicator value, the storage space may be a cold storage type of storage space, and the third indicator value may be used to indicate that the operation and maintenance event is a normal task completion event.

4. The method according to claim 3, characterized in that, The method further includes: Obtain the event identifier of the operation and maintenance event, the event type of the operation and maintenance event, the log level corresponding to the operation and maintenance event, and the container identifier of the container; An index entry corresponding to the container log data is generated based on at least one of the following: the event identifier of the operation and maintenance event, the event type of the operation and maintenance event, the log level corresponding to the container log data, the container identifier of the container, and the time of occurrence. The storage of the container log data according to the target storage method includes: The container log data and the index entries are stored in the storage space corresponding to the target storage method.

5. The method according to claim 1 or 2, characterized in that, The method further includes: Receive user log query operation, wherein the log query operation includes at least one of the following query information: event identifier of operation and maintenance event, target time period, and log level corresponding to container log data; In response to the log query operation, the system returns the associated information of the container log data corresponding to the query information to the user.

6. The method according to claim 1 or 2, characterized in that, The method further includes: When the storage duration of the container log data reaches a preset duration threshold, the container log data is deleted.

7. A container log management device, characterized in that, include: The first acquisition module is used to acquire the occurrence time and event index value of the operation and maintenance event when an operation and maintenance event is detected during the container lifecycle. The second acquisition module is used to acquire container log data within a target time period for any operation and maintenance event, based on the occurrence time and a preset time interval. The storage module is used to match the target storage method according to the event indicator value, and store the container log data according to the target storage method.

8. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the container log management method of any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the container log management method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the container log management method according to any one of claims 1 to 6.