Log processing method and apparatus, storage medium, and electronic device

CN117472678BActive Publication Date: 2026-09-04BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0004]本发明实施例提供了一种日志处理方法、装置、存储介质以及电子设备,以至少解决单集群多用户的日志的收集和管理成本高的技术问题

Benefits of technology

[0015] In this embodiment of the invention, a monitoring program is configured in each pod of a single cluster. This monitoring program triggers cloud functions within the pods. Different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to that user. When a cloud function is triggered, a first log generated by the cloud function is recorded. A user identifier corresponding to the user of the cloud function is added to the first log to obtain a target log. The target log is then written to a log pool corresponding to the pod. In this method, each pod in the single cluster can correspond to a log pool. For multiple cloud functions, the first log of each cloud function can be marked according to the user's identifier, and the resulting target log is written to the corresponding log pool. Therefore, it is possible to collect and manage logs from multiple users in a single cluster without needing to consider the programming language used to write the cloud functions, thus solving the technical problem of high costs in collecting and managing logs from multiple users in a single cluster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117472678B_ABST
    Figure CN117472678B_ABST
Patent Text Reader

Abstract

The application discloses a log processing method and device, a storage medium and electronic equipment. The method comprises the following steps: configuring a monitoring program in each pod in a single cluster, triggering a cloud function in the pod by the monitoring program, wherein different pods in the single cluster correspond to different users, and each pod is deployed with a cloud function corresponding to a user; recording a first log generated by the cloud function in the case that the cloud function is triggered; adding a user mark of a user corresponding to the cloud function in the first log to obtain a target log; and writing the target log into a log pool corresponding to the pod. The application solves the technical problem of high cost of collection and management of logs of single cluster and multiple users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and more specifically, to a log processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] Cloud functions are typically deployed in a single Kubernetes cluster. In a single cluster, the collection and querying of logs between cloud function services for multiple users presents a challenge.

[0003] The existing solution is to use an agent to collect logs. However, since user cloud functions can be written in multiple languages, using an agent requires writing a corresponding agent for each language, resulting in high costs for collecting and managing logs from multiple users in a single cluster. Summary of the Invention

[0004] This invention provides a log processing method, apparatus, storage medium, and electronic device to at least solve the technical problem of high collection and management costs of logs from multiple users in a single cluster.

[0005] According to one aspect of the present invention, a log processing method is provided, comprising: configuring a monitoring program in each pod of a single cluster, triggering a cloud function in the pod by the monitoring program, wherein different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to the user; recording a first log generated by the cloud function when the cloud function is triggered; adding a user identifier of the user corresponding to the cloud function to the first log to obtain a target log; and writing the target log to a log pool corresponding to the pod.

[0006] According to another aspect of the present invention, a log processing apparatus is provided, comprising: a first configuration module, configured to configure a monitoring program in each pod of a single cluster, wherein the monitoring program triggers cloud functions in the pods, wherein different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to the user; a recording module, configured to record a first log generated by the cloud function when the cloud function is triggered; an adding module, configured to add a user identifier of the user corresponding to the cloud function to the first log to obtain a target log; and a writing module, configured to write the target log to a log pool corresponding to the pod.

[0007] As an optional example, the above recording module includes: a first recording unit, configured to start recording log data generated by the cloud function when the cloud function is triggered; and to stop recording the log data generated by the cloud function when the cloud function finishes running; and a first determining unit, configured to use the recorded log data as the first log generated by the cloud function.

[0008] As an optional example, the above-mentioned recording module includes: a second recording unit, configured to start recording the log data generated by the cloud function at a first time point, wherein the first time point is the time point before the time point when the cloud function is triggered; and to stop recording the log data generated by the cloud function at a second time point, wherein the second time point is the time point after the cloud function finishes running; and a second determining unit, configured to use the recorded log data as the first log generated by the cloud function.

[0009] As an optional example, the above-mentioned adding module includes: a writing unit for writing the first log generated by the cloud function to a log file; and a first adding unit for adding the user identifier to the file name of the log file.

[0010] As an optional example, the above-mentioned adding module includes: a packaging unit for packaging the first log generated by the cloud function into a set of log data; and a second adding unit for adding the user identifier to the beginning position of the set of log data.

[0011] As an optional example, the above apparatus further includes: a second configuration module, used to configure a log pool for each of the above pods, and to use the log pool to store the logs generated by the cloud functions in the above pods.

[0012] As an optional example, the above apparatus further includes: a response module, configured to, upon receiving a user's log query request, obtain a first identifier of the user's cloud function and a target user identifier of the user; determine the target log pool of the pod corresponding to the user's cloud function from multiple log pools using the first identifier; determine the user's target log data from all log data in the target log pool using the target user identifier; and return the target log data to the user.

[0013] According to another aspect of the present invention, a storage medium is also provided, wherein a computer program is stored in the storage medium, and the computer program is executed by a processor to perform the above-described log processing method.

[0014] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the above-described log processing method through the computer program.

[0015] In this embodiment of the invention, a monitoring program is configured in each pod of a single cluster. This monitoring program triggers cloud functions within the pods. Different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to that user. When a cloud function is triggered, a first log generated by the cloud function is recorded. A user identifier corresponding to the user of the cloud function is added to the first log to obtain a target log. The target log is then written to a log pool corresponding to the pod. In this method, each pod in the single cluster can correspond to a log pool. For multiple cloud functions, the first log of each cloud function can be marked according to the user's identifier, and the resulting target log is written to the corresponding log pool. Therefore, it is possible to collect and manage logs from multiple users in a single cluster without needing to consider the programming language used to write the cloud functions, thus solving the technical problem of high costs in collecting and managing logs from multiple users in a single cluster. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0017] Figure 1 This is a flowchart of an optional log processing method according to an embodiment of the present invention;

[0018] Figure 2 This is a schematic diagram of the first log of the cloud function in an optional log processing method according to an embodiment of the present invention;

[0019] Figure 3 This is a schematic diagram of a log pool for a single cluster with multiple pods, representing an optional log processing method according to an embodiment of the present invention.

[0020] Figure 4 This is a schematic diagram of the structure of an optional log processing device according to an embodiment of the present invention;

[0021] Figure 5 This is a schematic diagram of an optional electronic device according to an embodiment of the present invention. Detailed Implementation

[0022] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0024] According to a first aspect of the present invention, a log processing method is provided, optionally, as follows: Figure 1 As shown, the above method includes:

[0025] S102, a monitoring program is configured in each pod in a single cluster, and the monitoring program triggers the cloud function in the pod. Different pods in a single cluster correspond to different users, and each pod deploys a cloud function corresponding to the user.

[0026] S104: When a cloud function is triggered, record the first log generated by the cloud function.

[0027] S106, Add the user's identifier corresponding to the cloud function to the first log to obtain the target log;

[0028] S108 writes the target logs to the log pool corresponding to the pod.

[0029] Optionally, the single cluster in this embodiment can be a cluster within a Kubernetes cluster. Kubernetes stands for Kubernetes, which is a program used to manage containerized applications on multiple hosts in a cloud platform. Kubernetes aims to make deploying containerized applications simple and efficient, and it provides a mechanism for application deployment, planning, updating, and maintenance.

[0030] In this embodiment, a pod is the smallest unit of management in Kubernetes (K8S), and it is a combination of one or more containers. These containers share storage, network, namespaces, and rules for how they operate. Within a pod, all containers are arranged and scheduled in the same way and run in a shared context. For a specific application, a pod is its logical host, and a pod contains multiple application containers related to its business logic.

[0031] In this embodiment, a log pool can be configured for each pod, and the logs generated by the cloud functions in that pod are stored in the log pool corresponding to that pod. Each pod corresponds to one user, and the cloud functions for that user are configured in that pod.

[0032] In this embodiment, the cloud function uses user-configured triggers to host user code and automatically executes the user application based on the trigger's event, providing the user with FaaS (Function as a Service) type service.

[0033] Cloud functions provide a serverless execution environment. There's no need to purchase or manage servers; simply write core code in a platform-supported language and configure the execution conditions. The code then runs elastically and securely on cloud infrastructure. The cloud fully manages the underlying computing resources, including server CPU, memory, network, and other configuration / resource maintenance, code deployment, elastic scaling, and load balancing. Code runs on demand, with no charge when idle.

[0034] The monitoring program can be a Watchdog monitoring system, which monitors system operation through a combination of hardware and software. The monitoring system can monitor and trigger user cloud functions.

[0035] In this embodiment, a monitoring program is configured in each pod of a single cluster. When a user wants to run a cloud function in a pod, the monitoring program in the pod activates the cloud function and records the first log generated by the cloud function in the activated state. The user's user identifier is added to the first log to obtain the target log, which is then written to the log pool corresponding to that pod. Thus, logs generated by cloud functions from different users can be statistically analyzed and managed separately for each pod and user.

[0036] As an optional example, the first log generated by the cloud function when it is triggered includes:

[0037] When a cloud function is triggered, log data generated by the cloud function begins to be recorded;

[0038] When the cloud function finishes running, stop recording the log data generated by the cloud function;

[0039] The recorded log data will be used as the first log generated by the cloud function.

[0040] Optionally, in this embodiment, for the triggered cloud function, log data is generated during the cloud function's execution. In this embodiment, log data generated by a cloud function can be recorded starting at the time the cloud function is triggered. Log data recording for the cloud function ends when the cloud function finishes running. The recorded log data is then used as the log data generated by the cloud function. This method can record log data for each cloud function. Figure 2 As shown. Figure 2 In the process, cloud function 1 runs between 12:00 and 13:00, and cloud function 2 runs between 13:40 and 14:30. The log data generated during their execution is used as their respective first logs.

[0041] As an optional example, the first log generated by the cloud function when it is triggered includes:

[0042] At the first time point, log data generated by the cloud function is recorded. The first time point is the time point before the cloud function is triggered.

[0043] At the second time point, the logging of the cloud function ends. The second time point is the time point after the cloud function finishes running.

[0044] The recorded log data will be used as the first log generated by the cloud function.

[0045] Optionally, in this embodiment, for the triggered cloud function, log data will be generated during the cloud function's execution. In this embodiment, preparation for recording the log data generated by the cloud function can begin before the cloud function is triggered. Recording the log data generated by the cloud function ends at a second time point after the cloud function finishes execution. This method ensures that the log data generated by the cloud function is recorded completely and comprehensively. If the recorded logs contain logs from other cloud functions besides the one being triggered, the logs from those other cloud functions can be removed.

[0046] As an optional example, adding the user's identifier corresponding to the cloud function to the first log will result in the target log including:

[0047] Write the first log generated by the cloud function to a log file;

[0048] Add a user identifier to the log file name.

[0049] Optionally, in this embodiment, the user identifier can be a string that uniquely identifies the user. The composition of the string is not limited in this embodiment. For example, it can be a string of numbers, a string of letters, a string of special characters, or a combination of letters, numbers, and special characters.

[0050] In this embodiment, the first log generated by the cloud function can be written to a log file, and then the user identifier can be added to the beginning or end of the log file's filename. This allows the first log to be marked with the user identifier.

[0051] Of course, in this embodiment, the first log can also be written to multiple log files, and the filenames of the multiple log files can be marked with the aforementioned user flag.

[0052] As an optional example, adding the user's identifier corresponding to the cloud function to the first log will result in the target log including:

[0053] Package the first log generated by the cloud function into a set of log data;

[0054] Add the user flag to the beginning of a set of log data.

[0055] Optionally, in this embodiment, all the data of the first log generated by the cloud function can be packaged into a set of log data, and then the user flag can be added to the beginning of the set of log data.

[0056] As an optional example, the above method also includes:

[0057] Configure a log pool for each pod and use the log pool to store the logs generated by the cloud functions in the pod.

[0058] In this embodiment, each pod can correspond to a log pool, and different log pools are marked with the pod to which they belong. Based on the pod where a cloud function resides, the log pool storing the logs of that cloud function can be determined.

[0059] As an optional example, the above method also includes:

[0060] Upon receiving a user's log query request, obtain the first identifier of the user's cloud function and the user's target user identifier;

[0061] The target log pool for the pod corresponding to the user's cloud function is determined from multiple log pools using the first identifier.

[0062] The target log data for a user is determined from all log data in the target log pool using the target user identifier.

[0063] Return the target log data to the user.

[0064] Optionally, in this embodiment, after the cloud function's logs are written to the log pool, the user can initiate a log query request when log queries are needed. Upon receiving the user's log query request, the system first determines the user's target user identifier and the cloud function the user wants to query. Based on the cloud function, the system can determine the pod running the cloud function and further determine the log pool where the cloud function's logs are written. After determining the log pool, the system iterates through all logs in the log pool based on the user's target user identifier. Since all logs in the log pool have been tagged with user identifiers, the system can find the logs corresponding to the user's target user identifier. The logs are then returned to the user for review.

[0065] In this embodiment, cloud functions are triggered by adding a monitoring program to the Kubernetes pod where the user function resides. The monitoring program prints logs when the function is triggered, including request parameters or user identifiers to uniquely identify the log. This process continues until the function stops running, thus obtaining the target logs corresponding to the cloud function. For different pods, log collection tools are configured to collect logs into different log pools. When querying logs, the daily support of the pod corresponding to the cloud function can be determined first, and then the query can be performed based on the request parameters or user identifiers for each request to accurately retrieve the cloud function logs under the tenant corresponding to that request.

[0066] During configuration, the log pool information to be collected is written into the pod where the user's cloud function resides. A lightweight delivery tool for forwarding and centralizing log data is configured to obtain information such as the log pool in the pod and collect logs into the corresponding log pool. A monitoring program is configured to trigger the cloud function. When querying logs, queries can be performed directly in the log pool corresponding to the user's cloud function using the user's identifier. This method significantly reduces development costs, eliminating the need to adapt cloud functions developed in every language for log collection and querying. A log collection scheme is also designed to distribute logs to different log pools for easy management.

[0067] Figure 3 This is a schematic diagram of the log pool for each pod in a single cluster with multiple pods in this embodiment. Each log pool records the log data generated by the cloud functions of the pod.

[0068] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0069] According to another aspect of the embodiments of this application, a log processing apparatus is also provided, such as... Figure 4 As shown, it includes:

[0070] The first configuration module 402 is used to configure a monitoring program in each pod in a single cluster, and the monitoring program triggers the cloud function in the pod. Different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to the user.

[0071] The logging module 404 is used to record the first log generated by the cloud function when the cloud function is triggered;

[0072] Add module 406 to add the user identifier of the user corresponding to the cloud function to the first log to obtain the target log;

[0073] The write module 408 is used to write the target logs to the log pool corresponding to the pod.

[0074] Optionally, the single cluster in this embodiment can be a cluster within a Kubernetes cluster. Kubernetes stands for Kubernetes, which is a program used to manage containerized applications on multiple hosts in a cloud platform. Kubernetes aims to make deploying containerized applications simple and efficient, and it provides a mechanism for application deployment, planning, updating, and maintenance.

[0075] In this embodiment, a pod is the smallest unit of management in Kubernetes (K8S), and it is a combination of one or more containers. These containers share storage, network, namespaces, and rules for how they operate. Within a pod, all containers are arranged and scheduled in the same way and run in a shared context. For a specific application, a pod is its logical host, and a pod contains multiple application containers related to its business logic.

[0076] In this embodiment, a log pool can be configured for each pod, and the logs generated by the cloud functions in the pod are stored in the log pool corresponding to the pod.

[0077] In this embodiment, the cloud function uses user-configured triggers to host user code and automatically executes the user application based on the trigger's event, providing the user with FaaS (Function as a Service) type service.

[0078] Cloud functions provide a serverless execution environment. There's no need to purchase or manage servers; simply write core code in a platform-supported language and configure the execution conditions. The code then runs elastically and securely on cloud infrastructure. The cloud fully manages the underlying computing resources, including server CPU, memory, network, and other configuration / resource maintenance, code deployment, elastic scaling, and load balancing. Code runs on demand, with no charge when idle.

[0079] The monitoring program can be a Watchdog monitoring system, which monitors system operation through a combination of hardware and software. The monitoring system can monitor and trigger user cloud functions.

[0080] In this embodiment, a monitoring program is configured in each pod of a single cluster. When a user wants to run a cloud function in a pod, the monitoring program in the pod activates the cloud function and records the first log generated by the cloud function in the activated state. The user's user identifier is added to the first log to obtain the target log, which is then written to the log pool corresponding to that pod. Thus, logs generated by cloud functions from different users can be statistically analyzed and managed separately for each pod and user.

[0081] As an optional example, the above recording module includes:

[0082] The first recording unit is used to start recording the log data generated by the cloud function when the cloud function is triggered, and to stop recording the log data generated by the cloud function when the cloud function finishes running.

[0083] The first determining unit is used to use the recorded log data as the first log generated by the cloud function.

[0084] Optionally, in this embodiment, for the triggered cloud function, log data is generated during the cloud function's execution. In this embodiment, log data generated by a cloud function can be recorded starting at the time the cloud function is triggered. Log data recording for the cloud function ends when the cloud function finishes running. The recorded log data is then used as the log data generated by the cloud function. This method can record log data for each cloud function. Figure 2 As shown. Figure 2 In the process, cloud function 1 runs between 12:00 and 13:00, and cloud function 2 runs between 13:40 and 14:30. The log data generated during their execution is used as their respective first logs.

[0085] As an optional example, the above recording module includes:

[0086] The second recording unit is used to start recording the log data generated by the cloud function at the first time point, where the first time point is the time point before the cloud function is triggered; and to stop recording the log data generated by the cloud function at the second time point, where the second time point is the time point after the cloud function finishes running.

[0087] The second determining unit is used to use the recorded log data as the first log generated by the cloud function.

[0088] Optionally, in this embodiment, for the triggered cloud function, log data will be generated during the cloud function's execution. In this embodiment, preparation for recording the log data generated by the cloud function can begin before the cloud function is triggered. Recording the log data generated by the cloud function ends at a second time point after the cloud function finishes execution. This method ensures that the log data generated by the cloud function is recorded completely and comprehensively. If the recorded logs contain logs from other cloud functions besides the one being triggered, the logs from those other cloud functions can be removed.

[0089] As an optional example, the above-mentioned added modules include:

[0090] The write unit is used to write the first log generated by the cloud function to a log file;

[0091] The first addition unit is used to add a user identifier to the filename of the log file.

[0092] Optionally, in this embodiment, the user identifier can be a string that uniquely identifies the user. The composition of the string is not limited in this embodiment. For example, it can be a string of numbers, a string of letters, a string of special characters, or a combination of letters, numbers, and special characters.

[0093] In this embodiment, the first log generated by the cloud function can be written to a log file, and then the user identifier can be added to the beginning or end of the log file's filename. This allows the first log to be marked with the user identifier.

[0094] Of course, in this embodiment, the first log can also be written to multiple log files, and the filenames of the multiple log files can be marked with the aforementioned user flag.

[0095] As an optional example, the above-mentioned added modules include:

[0096] Packaging unit, used to package the first log generated by the cloud function into a set of log data;

[0097] The second addition unit is used to add the user flag to the beginning of a set of log data.

[0098] Optionally, in this embodiment, all the data of the first log generated by the cloud function can be packaged into a set of log data, and then the user flag can be added to the beginning of the set of log data.

[0099] As an optional example, the above-described apparatus further includes:

[0100] The second configuration module is used to configure a log pool for each pod, and use the log pool to store the logs generated by the cloud functions in the pod.

[0101] In this embodiment, each pod can correspond to a log pool, and different log pools are marked with the pod to which they belong. Based on the pod where a cloud function resides, the log pool storing the logs of that cloud function can be determined.

[0102] As an optional example, the above-described apparatus further includes:

[0103] The response module, upon receiving a user's log query request, retrieves the first identifier of the user's cloud function and the target user identifier; uses the first identifier to determine the target log pool of the pod corresponding to the user's cloud function from multiple log pools; uses the target user identifier to determine the user's target log data from all log data in the target log pool; and returns the target log data to the user.

[0104] Optionally, in this embodiment, after the cloud function's logs are written to the log pool, the user can initiate a log query request when log queries are needed. Upon receiving the user's log query request, the system first determines the user's target user identifier and the cloud function the user wants to query. Based on the cloud function, the system can determine the pod running the cloud function and further determine the log pool where the cloud function's logs are written. After determining the log pool, the system iterates through all logs in the log pool based on the user's target user identifier. Since all logs in the log pool have been tagged with user identifiers, the system can find the logs corresponding to the user's target user identifier. The logs are then returned to the user for review.

[0105] For other examples of this embodiment, please refer to the examples above, which will not be repeated here.

[0106] Figure 5 This is a structural block diagram of an optional electronic device according to an embodiment of this application, such as... Figure 5 As shown, it includes a processor 502, a communication interface 504, a memory 506, and a communication bus 508. The processor 502, communication interface 504, and memory 506 communicate with each other via the communication bus 508.

[0107] Memory 506 is used to store computer programs;

[0108] When processor 502 executes a computer program stored in memory 506, it performs the following steps:

[0109] Configure a monitoring program in each pod of a single cluster, and the monitoring program will trigger the cloud function in the pod. Different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to the user.

[0110] When a cloud function is triggered, record the first log generated by the cloud function;

[0111] Add the user identifier of the user corresponding to the cloud function to the first log to obtain the target log;

[0112] Write the target logs to the log pool corresponding to the pod.

[0113] Optionally, in this embodiment, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single thick line, but this does not indicate that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0114] The memory may include RAM, or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0115] As an example, the memory 506 described above may include, but is not limited to, the first configuration module 402, the recording module 404, the adding module 406, and the writing module 408 of the log processing device described above. Furthermore, it may include, but is not limited to, other module units of the log processing device described above, which will not be elaborated upon in this example.

[0116] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0117] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0118] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only. The device implementing the above log processing method can be a terminal device, such as a smartphone (e.g., Android phone, iOS phone), tablet computer, PDA, mobile Internet Device (MID), PAD, etc. Figure 5 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.

[0119] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, ROM, RAM, disk or optical disk, etc.

[0120] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is executed by a processor to perform the steps in the above-described log processing method.

[0121] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0122] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0123] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0124] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0125] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0126] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0127] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0128] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A log processing method, characterized in that, include: A monitoring program is configured in each pod of a single cluster, and the monitoring program triggers the cloud function in the pod. Different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to the user. When the cloud function is triggered, the first log generated by the cloud function is recorded; Add the user's identifier corresponding to the cloud function to the first log to obtain the target log; Write the target logs to the log pool corresponding to the pod; The method further includes: configuring a log pool for each pod, and using the log pool to store logs generated by cloud functions in the pod.

2. The method according to claim 1, characterized in that, The first log generated by the cloud function, when the cloud function is triggered, includes: When the cloud function is triggered, the log data generated by the cloud function begins to be recorded; When the cloud function finishes running, the recording of the log data generated by the cloud function will cease. The recorded log data is used as the first log generated by the cloud function.

3. The method according to claim 1, characterized in that, The first log generated by the cloud function, when the cloud function is triggered, includes: At the first time point, the log data generated by the cloud function is recorded. The first time point is the time point before the time when the cloud function is triggered. At the second time point, the recording of log data generated by the cloud function ends, wherein the second time point is the time point after the cloud function finishes running; The recorded log data is used as the first log generated by the cloud function.

4. The method according to claim 1, characterized in that, The step of adding the user identifier of the user corresponding to the cloud function to the first log to obtain the target log includes: Write the first log generated by the cloud function to a log file; Add the user flag to the filename of the log file.

5. The method according to claim 1, characterized in that, The step of adding the user identifier of the user corresponding to the cloud function to the first log to obtain the target log includes: The first log generated by the cloud function is packaged into a set of log data; Add the user flag to the beginning of the data set of log data.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Upon receiving a user's log query request, obtain the first identifier of the user's cloud function and the target user identifier of the user; Using the first flag, the target log pool of the pod corresponding to the user's cloud function is determined from multiple log pools; The target log data of the user is determined from all log data in the target log pool using the target user identifier. The target log data is returned to the user.

7. A log processing device, characterized in that, include: The first configuration module is used to configure a monitoring program in each pod in a single cluster, and the monitoring program triggers the cloud function in the pod. Different pods in the single cluster correspond to different users, and each pod deploys a cloud function corresponding to the user. A recording module is used to record the first log generated by the cloud function when the cloud function is triggered; An add module is used to add the user identifier of the user corresponding to the cloud function to the first log to obtain the target log; The writing module is used to write the target log to the log pool corresponding to the pod; The device further includes: configuring a log pool for each pod, and using the log pool to store logs generated by cloud functions in the pod.

8. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to perform the method described in any one of claims 1 to 6.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • DM master-slave cluster deployment method and device based on Kubernetes

    CN111930465A

  • Usage consumption for an invitee of a cloud system

    US20140325070A1