Log processing methods, apparatus, equipment, readable storage media, and vehicles

By setting up shared memory for each application process and enabling fast access to its memory and storage identifiers, the problem of slow log sorting between processes is solved, achieving fast and efficient log processing.

CN117931758BActive Publication Date: 2026-05-26BEIJING CO WHEELS TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING CO WHEELS TECH CO LTD
Filing Date
2022-10-24
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, inter-process communication methods struggle to quickly input logs generated by different processes in chronological order when processing large volumes of logs, resulting in a decrease in the processing speed of the log processing system.

Method used

By setting up shared memory for each application process and using memory and storage identifiers to quickly access the shared memory of each application process, and obtaining and comparing timestamps to determine the log with the smallest time, fast sorting and output can be achieved.

Benefits of technology

It improves the processing speed of the log processing system, enabling it to quickly output logs generated by multiple application processes in chronological order, reducing the burden of inter-process communication and improving system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117931758B_ABST
    Figure CN117931758B_ABST
Patent Text Reader

Abstract

This application discloses a log processing method, apparatus, device, readable storage medium, and vehicle. The log processing method is applied to a log processing system and includes: based on the memory identifier of shared memory corresponding to each application process, searching for the shared memory and a first storage identifier corresponding to each memory identifier, wherein the first storage identifier corresponds to a first target storage space among M storage spaces, the first target storage space is used to store a first target log and a timestamp of the first target log, and the first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier; obtaining the timestamps of the first target log from the N first target storage spaces corresponding to the N first storage identifiers, obtaining N timestamps; and outputting the log corresponding to the smallest timestamp among the N timestamps. According to the embodiments of this application, the processing speed of the log processing system can be improved, and logs generated by different processes can be quickly input in chronological order.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer technology, and in particular relates to a log processing method, apparatus, device, readable storage medium, and vehicle. Background Technology

[0002] Network devices, systems, and services generate logs during operation, which record descriptions of relevant actions such as date, time, user, and details. Typically, systems can be configured to process these logs, such as a log server. A log server can output logs sequentially according to their creation time.

[0003] However, in some network devices, systems, and service programs, there are independent application processes, and correspondingly, the logs of these application processes are also independent of each other. Currently, inter-process communication (IPC) can be used to transmit information between processes and between processes and the log processing system. However, when the number of logs is large, IPC communication will significantly reduce the processing speed of the log processing system, making it difficult to quickly input logs generated by different processes in chronological order. Summary of the Invention

[0004] This application provides a log processing method, apparatus, device, readable storage medium, and vehicle, which can improve the processing speed of the log processing system and quickly input logs generated by different processes in chronological order.

[0005] In a first aspect, embodiments of this application provide a log processing method. The method is applied to a log processing system that processes logs generated by N application processes. Each application process corresponds to a shared memory location, each shared memory location corresponds to a memory identifier, and each shared memory location includes M storage spaces, each storage space corresponding to a storage identifier. The method includes:

[0006] Based on the memory identifier of the shared memory corresponding to each application process, find the shared memory and the first storage identifier corresponding to each memory identifier. The first storage identifier corresponds to the first target storage space among M storage spaces. The first target storage space is used to store the first target log and the timestamp of the first target log. The first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier.

[0007] Obtain the timestamps of the first target logs from the N first target storage spaces corresponding to the N first storage identifiers, and obtain N timestamps;

[0008] Output the log corresponding to the smallest timestamp among N timestamps.

[0009] In some possible implementations of the first aspect, the log corresponding to the smallest timestamp among the N timestamps is the second target log; after outputting the log corresponding to the smallest timestamp among the N timestamps, the method also includes:

[0010] The log corresponding to the smallest timestamp among N timestamps is determined as the processed second target log, wherein the second target log is generated by the target application process among N application processes;

[0011] Obtain the timestamp of each log in at least one unprocessed log generated by the target application process;

[0012] Update the first storage identifier of the target application process to the storage identifier of the storage space where the log with the smallest timestamp is located among at least one unprocessed log generated by the target application process.

[0013] Among the possible implementations of the first aspect, after outputting the log corresponding to the smallest timestamp among N timestamps, the method also includes:

[0014] Delete the logs and log timestamps stored in the first target storage space.

[0015] In some possible implementations of the first aspect, before looking up the shared memory and the first storage identifier corresponding to each memory identifier based on the memory identifier of each application process, the method further includes:

[0016] Receive log processing requests from application processes;

[0017] In response to a log processing request, determine the log processing sequence number;

[0018] Determine the log storage identifier based on the log processing sequence number;

[0019] Send the log storage identifier to the application process so that the application process stores the log and the log timestamp in the storage space corresponding to the log storage identifier.

[0020] In some possible implementations of the first aspect, the shared memory for each application process comprises M storage spaces, where M = 2. x X is a positive integer;

[0021] Based on the log processing sequence number, determine the log's storage identifier, including:

[0022] The log processing sequence number and the preset value are ANDed to obtain the log storage identifier, where the size of the preset value is M-1.

[0023] Secondly, embodiments of this application provide a log processing apparatus. The apparatus is applied to a log processing system, which processes logs generated by N application processes. Each application process corresponds to a shared memory, and each shared memory includes M storage identifiers and M storage spaces corresponding one-to-one with the M storage identifiers. Each storage space is used to store logs generated by the application processes and the log timestamps. The log processing apparatus includes:

[0024] The acquisition module is used to acquire the address of the shared memory and the first storage identifier of each application process, wherein the storage space corresponding to the first storage identifier is used to store the logs to be processed by the application process;

[0025] The processing module is used to determine the timestamps of N logs corresponding to N application processes based on the address of the shared memory of each application process and the first storage identifier.

[0026] The processing module is also used to determine the target storage identifier from the N first storage identifiers based on the timestamps of the N logs, and to use the logs stored in the storage space corresponding to the target storage identifier as the target logs.

[0027] In some possible implementations of the second aspect, the log corresponding to the smallest timestamp among the N timestamps is the second target log; the apparatus also includes:

[0028] The processing module is used to determine the log corresponding to the smallest timestamp among N timestamps as the processed second target log, wherein the second target log is generated by the target application process among N application processes;

[0029] The acquisition module is also used to acquire the timestamp of each log in at least one unprocessed log generated by the target application process;

[0030] The processing module is also used to update the first storage identifier of the target application process to the storage identifier of the storage space where the log with the smallest timestamp is located in at least one unprocessed log generated by the target application process.

[0031] Thirdly, this application provides an electronic device, which includes: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the log processing method described in the first aspect or any implementable method of the first aspect.

[0032] Fourthly, this application provides a readable storage medium storing computer program instructions, which, when executed by a processor, implement the log processing method described in the first aspect or any implementable mode of the first aspect.

[0033] Fifthly, this application provides a vehicle that includes a log processing device as described in the second aspect or any possible implementation of the second aspect, or includes an electronic device as described in the third aspect, or a readable storage medium as described in the fourth aspect.

[0034] This application provides a log processing method, apparatus, device, readable storage medium, and vehicle. The log processing method in this application can be applied to a log processing system. Specifically, the log processing system can conveniently and quickly access the shared memory corresponding to each application process by obtaining the memory identifier of the shared memory corresponding to each application process. Here, a first storage identifier corresponds to a first target storage space among M storage spaces. The first target storage space is used to store a first target log and its timestamp. The first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier. Next, the log processing system can obtain the timestamps of the first target logs from the N first target storage spaces corresponding to the N first storage identifiers, obtaining N timestamps. Then, by comparing the timestamps of the N logs, the log corresponding to the smallest timestamp among the N timestamps can be output. Thus, the log processing system can quickly output the logs generated by the N application processes in chronological order. Because the log processing system can conveniently and quickly access the shared memory of each application process, it can effectively improve the processing speed of the log processing system. Attached Figure Description

[0035] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is a communication diagram of a log processing system provided in an embodiment of this application;

[0037] Figure 2 This is a schematic flowchart of a log processing method provided in an embodiment of this application;

[0038] Figure 3 This is a schematic diagram of a shared memory provided in an embodiment of this application;

[0039] Figure 4 This is a schematic diagram of a log storage process provided in an embodiment of this application;

[0040] Figure 5 This is a schematic diagram of the structure of a log processing device provided in an embodiment of this application;

[0041] Figure 6This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0042] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0043] 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. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0044] Network devices, systems, and services generate logs during operation. These logs record descriptions of events, including the date, time, user, and actions. Typically, systems can be configured to process these logs, such as a log server. A log server can output logs in chronological order of their creation.

[0045] However, in some network devices, systems, and service programs, there are independent application processes, and correspondingly, the logs of these application processes are also independent of each other. Currently, information transmission between processes and between processes and the log processing system can be achieved through IPC communication. However, when the number of logs is large, IPC communication will significantly reduce the processing speed of the log processing system, making it difficult to quickly input logs generated by different processes in chronological order.

[0046] To address this, embodiments of this application provide a log processing method, apparatus, device, and readable storage medium that can be applied to a log processing system. The log processing system is used to process logs generated by N application processes. Each application process corresponds to a shared memory. Each shared memory includes M storage identifiers and M storage spaces that correspond one-to-one with the M storage identifiers. Each storage space is used to store the logs generated by the application processes and the timestamps of the logs.

[0047] In some embodiments, the log processing system can conveniently and quickly access the shared memory corresponding to each application process by obtaining the memory identifier of the shared memory corresponding to each application process. Here, the first storage identifier corresponds to the first target storage space among M storage spaces. The first target storage space is used to store the first target log and its timestamp. The first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier. Next, the log processing system can obtain the timestamps of the first target log from the N first target storage spaces corresponding to the N first storage identifiers, obtaining N timestamps. Then, by comparing the timestamps of the N logs, the log corresponding to the smallest timestamp among the N timestamps can be output. In this way, the log processing system can quickly output the logs generated by the N application processes in chronological order. Because the log processing system can conveniently and quickly access the shared memory of each application process, it can effectively improve the processing speed of the log processing system.

[0048] In some embodiments of this application, network devices, systems, and service programs may include multiple application processes, each of which can generate logs during its operation. A log processing system can process the logs generated by each application process. For example, the log processing system can sort the logs sequentially according to their generation time to facilitate chronological output and printing. Figure 1 A schematic diagram of the communication of a log processing system according to an embodiment of this application is shown. (In conjunction with...) Figure 1 As shown, the log processing system 110 includes a storage unit 111 and a processing unit 112. Multiple application processes correspond one-to-one with multiple shared memory units 120. These application processes can be, for example, application processes running in network devices, systems, and service programs, and different application processes can run independently.

[0049] For example, taking a microkernel-based application system as an example, the application system can run multiple application processes. Based on the embodiments of this application, a shared memory is set up for each application process. (Continue to refer to...) Figure 1 As shown, N application processes correspond to N shared memory locations. For example, the multiple shared memory locations 120 include shared memory 1, shared memory 2, ..., shared memory N.

[0050] In some embodiments, each shared memory includes M storage spaces, each corresponding to a storage identifier. For example, a shared memory may include 8 storage spaces. In other words, the capacity of the shared memory is M. The number of storage spaces in each memory can be set according to actual needs and is not specifically limited here. Each storage space corresponds to a storage identifier, and correspondingly, the M storage spaces each correspond to M storage identifiers.

[0051] For example, the storage identifier can be a positive integer in the range [0, M-1].

[0052] Logs generated by an application process during runtime can be stored in the storage space. That is, the storage space can store the logs generated by the application process and their timestamps. The timestamp represents the time the log was generated.

[0053] In some embodiments, Compare-and-swap (CAS) operations can be used to implement lock-free management of logs generated by a single application process. For example, the principle is to first save the value of *dest_ptr (dest_ptr is a pointer), then check if the value of *dest_ptr is equal to the old value old_value. If they are equal, the new value new_value is written to *dest_ptr; otherwise, nothing is done, and the final return value is the original value of *dest_ptr. CAS operations guarantee atomicity in the application system because they are the smallest processing unit; that is, the entire CAS operation can only be interrupted by other processes in the application system or interrupted for other reasons. Based on CAS operations, secure lock-free shared memory can be implemented, allowing multiple threads within a process to store logs in the same memory address (ID value) without locks.

[0054] In the log processing system, the system can store the memory identifier of the shared memory for each application process and the storage identifier of the logs to be processed within that application process. For example, storage unit 111 can store a memory identifier (ID value) for the shared memory corresponding to each application process. Using the memory identifier corresponding to the shared memory, the log processing system can find the actual storage location of the logs generated by the application process; that is, the log processing system can locate the shared memory corresponding to the application process. Then, based on the storage identifier, the log processing system can quickly find the logs to be processed by the application process from the shared memory. Optionally, the storage identifier of the logs to be processed in each application process in the log processing system may include the storage identifier that needs to be accessed currently, and the next storage identifier that needs to be accessed after the log is output.

[0055] The log processing system may include a processing unit 112. The processing unit 112 obtains the timestamps of the first target logs from the N first target storage spaces corresponding to the N first storage identifiers, and obtains N timestamps. By comparing the N timestamps, the output object of this log processing is determined. For example, the processing object is the log with the earliest corresponding time among the N timestamps.

[0056] According to the embodiments provided in this application, since the log processing system can conveniently and quickly access the shared memory of each application process, it can quickly output the logs generated by N application processes in chronological order, thereby effectively improving the processing speed of the log processing system.

[0057] The log processing method provided in the embodiments of this application is described below. Figure 2 A flowchart illustrating a log processing method according to an embodiment of this application is shown. Figure 2 As shown, the method may include steps 210 to 230.

[0058] Step 210: Based on the memory identifier of the shared memory corresponding to each application process, find the shared memory and the first storage identifier corresponding to each memory identifier.

[0059] Specifically, the first storage identifier corresponds to the first target storage space among M storage spaces. The first target storage space is used to store the first target log and the timestamp of the first target log. The first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier.

[0060] Specifically, each time the log processing system provides log processing services, it can locate the shared memory and the first storage identifier corresponding to each memory identifier based on the memory identifier of the shared memory corresponding to each application process. Next, it can obtain the timestamp of the first target log in each first target storage space.

[0061] Step 220: Obtain the timestamps of the first target logs from the N first target storage spaces corresponding to the N first storage identifiers, and obtain N timestamps.

[0062] Specifically, based on the N target storage spaces corresponding to each first storage identifier, the log processing system can obtain the timestamp of each target log. Thus, for N application processes, N log timestamps can be obtained.

[0063] Step 230: Output the log corresponding to the smallest timestamp among the N timestamps.

[0064] After obtaining the timestamps of N logs, the log processing system can sort the N logs according to the size relationship of the timestamps. This allows for the rapid determination of the target log corresponding to the desired order. For example, it can directly output the log corresponding to the smallest timestamp.

[0065] According to the embodiments provided in this application, since the log processing system can conveniently and quickly access the shared memory of each application process, it can quickly output the logs generated by N application processes in chronological order. Simultaneously, by providing shared memory for each application process through the log processing system, especially for independently running application processes, IPC communication can be significantly reduced, improving the operating performance of the log processing system. This effectively increases the processing speed of the log processing system, enabling the rapid output of logs generated by multiple application processes in chronological order.

[0066] In some embodiments, after outputting the log corresponding to the smallest timestamp among N timestamps, the present application embodiment may further include the following steps: determining the log corresponding to the smallest timestamp among N timestamps as the processed second target log, wherein the second target log is generated by the target application process among N application processes; obtaining the timestamp of each log in at least one unprocessed log generated by the target application process; updating the first storage identifier of the target application process to the storage identifier of the storage space where the log with the smallest timestamp among the at least one unprocessed log generated by the target application process is located.

[0067] After determining that the log with the smallest timestamp among N timestamps corresponds to the processed second target log, the log processing system can then update the first storage identifier of the target application process to facilitate a quick search for the first target log in the future. Specifically, the log processing system can access the target application process's storage space, identify unprocessed logs within that space, determine the storage identifier of the storage space containing the unprocessed log with the smallest timestamp, and use this identifier as the first storage identifier for quick retrieval of the first target log in the future.

[0068] According to the above embodiments of this application, the log processing system can quickly and accurately obtain the timestamp of the first target log, so as to quickly correspond the time sequence and determine the log to be output.

[0069] In some embodiments, after outputting the log corresponding to the smallest timestamp among N timestamps, the log processing system may further: delete the log and the timestamp of the log stored in the first target storage space.

[0070] After obtaining the target log, the log processing system can delete the target log stored in the cache space, freeing up shared memory and preventing it from occupying excessive storage space in the entire application system, thus avoiding waste of storage resources. Furthermore, deleting processed logs through the log processing system eliminates the need for the application to perform the deletion step, thereby reducing data communication between the log processing system and the application and improving log processing efficiency.

[0071] As a concrete example, Figure 3 A schematic diagram of shared memory corresponding to an application process is shown. The shared memory includes eight storage spaces. Each storage space corresponds to a storage identifier. For example, the storage identifiers corresponding to the eight storage spaces are (0), (1), ..., (7) in sequence. Each log generated by the application process can be stored in one of these storage spaces. Combined with... Figure 3 As shown, storage identifiers (1) to (5) store unprocessed logs. Storage identifiers (0), (6) and (7) are empty.

[0072] In some embodiments, to further improve log processing efficiency, the log processing system can assign a log processing sequence number to each log generated by an application process, combined with... Figure 4 The flowchart of log storage shown can be referred to in detail in the following steps: Step 401, receive the log processing request from the application process; Step 402, in response to the log processing request, determine the log processing sequence number; Step 403, determine the log storage identifier based on the log processing sequence number; Step 404, send the log storage identifier to the application process so that the application process stores the log and the log timestamp into the storage space corresponding to the log storage identifier.

[0073] In some embodiments, the log processing system can process logs generated by multiple application processes. Each application process, after generating logs, can generate a log processing request and send the request to the log processing system.

[0074] Upon receiving a log processing request, the log processing system generates a unique log processing sequence number. When the system receives multiple log processing requests, it generates sequence numbers sequentially from morning to night based on the reception time of each request, ensuring the order of log processing.

[0075] The log processing system then determines the log's storage identifier based on the log processing sequence number. Specifically, the shared memory includes M storage spaces, where M = 2^32. xX is a positive integer. The log processing system performs a bitwise AND operation on the log processing sequence number and the preset value to obtain the log storage identifier, where the size of the preset value is M-1. For example, the calculation process can be shown in formula (1).

[0076] index = sequence & mask (1)

[0077] Here, `index` is the log storage identifier, `sequence` is the log processing sequence number, and `mask` is a preset value. It's understandable that when two values ​​are ANDed, the result is obtained by performing the operation in binary representation.

[0078] The shared memory contains M log storage identifiers. Since the value of is a power of 2, calculating the log storage identifiers can improve code efficiency.

[0079] After generating a log storage identifier, the log processing system can send the log storage identifier to the application process, so that the application process can store the log and the log timestamp into the storage space corresponding to the log storage identifier.

[0080] After assigning a storage identifier to the application process log, newly generated logs and their timestamps can be stored in the storage space corresponding to the identifier. This allows the log processing system to retrieve the logs and their timestamps from the storage space corresponding to the log storage identifier during log processing.

[0081] In some embodiments, the shared memory of an application process can be, for example, a ring buffer, where M memory spaces are linked end-to-end, and each memory space is used cyclically. Combined with Figure 3 As shown, log E is the most recently generated log. After calculating the log storage identifier (5) based on the log processing sequence number, log E can be stored in the storage space corresponding to the log storage identifier (5). According to the embodiment of this application, after the log storage identifier (7) is stored in the log, the storage space corresponding to the storage identifier (0) can be used cyclically. Moreover, since the log processing system deletes the logs stored in the shared memory after each log acquisition, it ensures that the shared memory can be used cyclically, avoiding waste of storage space resources.

[0082] According to the specific implementation provided in this application, after the logs are stored in the shared memory storage space, the log processing system deals with multiple ordered arrays. Taking N application processes as an example, in each comparison process, the log processing system only needs to compare the timestamps of the logs stored in N storage identifiers to achieve ordered output of the log data.

[0083] According to the embodiments of this application, the log processing system can conveniently and quickly access the shared memory of each application process, which can significantly reduce the use of IPC, effectively improve the processing speed of the log processing system, and quickly output the logs generated by N application processes in chronological order, reducing the running burden of the entire application system.

[0084] Based on the same inventive concept, this application also provides a log processing apparatus 500 corresponding to the above-described log processing method. (Specifically combined with...) Figure 5 Please provide a detailed explanation.

[0085] Figure 5 This is a schematic diagram of a log processing device provided in an embodiment of this application. The log processing device 500 is applied to a log processing system, which processes logs generated by N application processes. Each application process corresponds to a shared memory, each shared memory corresponds to a memory identifier, and each shared memory includes M storage spaces, each storage space corresponding to a storage identifier. The device includes:

[0086] The processing module 510 is used to find the shared memory and the first storage identifier corresponding to each memory identifier according to the memory identifier of the shared memory corresponding to each application process. The first storage identifier corresponds to the first target storage space among M storage spaces. The first target storage space is used to store the first target log and the timestamp of the first target log. The first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier.

[0087] The acquisition module 520 is used to obtain the timestamps of the first target logs from the N first target storage spaces corresponding to the N first storage identifiers, and obtain N timestamps respectively;

[0088] Output module 530 is used to output the log corresponding to the smallest timestamp among N timestamps.

[0089] In some embodiments, the log corresponding to the smallest timestamp among the N timestamps is the second target log; the apparatus further includes:

[0090] Processing module 510 is used to determine the log corresponding to the smallest timestamp among N timestamps as the processed second target log, wherein the second target log is generated by the target application process among N application processes;

[0091] The acquisition module 520 is also used to acquire the timestamp of each log in at least one unprocessed log generated by the target application process;

[0092] The processing module 510 is further configured to update the first storage identifier of the target application process to the storage identifier of the storage space where the log with the smallest timestamp is located in at least one unprocessed log generated by the target application process.

[0093] In some embodiments, the processing apparatus is further configured to delete logs and log timestamps stored in the first target storage space.

[0094] In some embodiments, the apparatus further includes:

[0095] A receiving device used to receive log processing requests from application processes;

[0096] The processing module 510 is also used to determine the log processing sequence number in response to the log processing request;

[0097] The processing module 510 is also used to determine the storage identifier of the log based on the log processing sequence number;

[0098] The sending module is also used to send the log storage identifier to the application process, so that the application process stores the log and the log timestamp into the storage space corresponding to the log storage identifier.

[0099] In some embodiments, the shared memory for each application process includes M storage spaces, where M = 2. x X is a positive integer;

[0100] The processing module 510 is also used to perform AND operation on the log processing sequence number and the preset value to obtain the log storage identifier, wherein the size of the preset value is M-1.

[0101] It is understood that the log processing device 500 in this application embodiment can correspond to the execution subject of the log processing method provided in this application embodiment. The specific details of the operation and / or function of each module / unit of the log processing device 500 can be found in the description of the corresponding part in the log processing method provided in the above application embodiment. For the sake of brevity, it will not be repeated here.

[0102] The log processing apparatus 500 of this application embodiment can conveniently and quickly access the shared memory of each application process to determine the first target log for each application process. The log processing system can obtain the timestamps of the first target logs from N first target storage spaces corresponding to N first storage identifiers, resulting in N timestamps. Next, by comparing the timestamps of the N logs, the log corresponding to the smallest timestamp among the N timestamps can be output. In this way, the log processing system can quickly output the logs generated by the N application processes in chronological order. Because the log processing system can conveniently and quickly access the shared memory of each application process, it can effectively improve the processing speed of the log processing system.

[0103] Figure 6 A schematic diagram of the structure of an electronic device according to an embodiment of this application is shown. Figure 6 As shown, the device may include a processor 601 and a memory 602 storing computer program instructions.

[0104] Specifically, the processor 601 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0105] Memory 602 may include mass storage for information or instructions. For example, and not limitingly, memory 602 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 602 may include removable or non-removable (or fixed) media, or memory 602 may be a non-volatile solid-state memory. Memory 602 may be... electronic devices The inside or outside.

[0106] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this application.

[0107] The processor 601 reads and executes computer program instructions stored in the memory 602 to implement the method described in the embodiments of this application and achieve the corresponding technical effects achieved by executing the method in the embodiments of this application. For the sake of brevity, it will not be described in detail here.

[0108] In one example, the electronic device may also include a communication interface 603 and a bus 610. Wherein, as... Figure 6 As shown, the processor 601, memory 602, and communication interface 603 are connected through bus 610 and complete communication with each other.

[0109] The communication interface 603 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0110] Bus 610 includes hardware, software, or both, that couples components of an online information flow metering device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 610 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.

[0111] The electronic device can execute the log processing method in the embodiments of this application, thereby achieving the corresponding technical effects of the log processing method described in the embodiments of this application.

[0112] Furthermore, in conjunction with the log processing methods in the above embodiments, this application embodiment can provide a readable storage medium for implementation. This readable storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the log processing methods in the above embodiments. Examples of readable storage media can be non-transitory machine-readable media, such as electronic circuits, semiconductor memory devices, read-only memory (ROM), floppy disks, compact disc read-only memory (CD-ROM), optical discs, hard disks, etc.

[0113] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0114] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0115] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0116] Furthermore, in conjunction with the log processing methods, apparatus, and readable storage medium described in the above embodiments, this application can provide a computer program product for implementation. When the instructions in the computer program product are executed by the processor of an electronic device, the electronic device performs any of the log processing methods described in the above embodiments.

[0117] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0118] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A log processing method, characterized in that, The method is applied to a log processing system, which processes logs generated by N application processes. Each application process corresponds to a shared memory, each shared memory corresponds to a memory identifier, each shared memory includes M storage spaces, and each storage space corresponds to a storage identifier. The method includes: Based on the memory identifier of the shared memory corresponding to each application process, find the shared memory and the first storage identifier corresponding to each memory identifier, wherein the first storage identifier corresponds to the first target storage space among the M storage spaces, the first target storage space is used to store the first target log and the timestamp of the first target log, and the first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier; From the N first target storage spaces corresponding to the N first storage identifiers, obtain the timestamps of the first target logs respectively to obtain N timestamps; Output the log corresponding to the smallest timestamp among the N timestamps.

2. The method according to claim 1, characterized in that, After outputting the log corresponding to the smallest timestamp among the N timestamps, the method further includes: The log corresponding to the smallest timestamp among the N timestamps is determined as the processed second target log, wherein the second target log is generated by the target application process among the N application processes; Obtain the timestamp of each log in at least one unprocessed log generated by the target application process; Update the first storage identifier of the target application process to the storage identifier of the storage space where the log with the smallest timestamp is located in at least one unprocessed log generated by the target application process.

3. The method according to claim 1, characterized in that, After outputting the log corresponding to the smallest timestamp among the N timestamps, the method further includes: Delete the log and the log timestamp stored in the first target storage space.

4. The method according to claim 1, characterized in that, Before searching for the shared memory and the first storage identifier corresponding to each memory identifier based on the memory identifier of each application process, the method further includes: Receive log processing requests from application processes; In response to the log processing request, determine the log processing sequence number; The storage identifier of the log is determined based on the log processing sequence number; The application process is sent a storage identifier for the log, so that the application process stores the log and the log timestamp into the storage space corresponding to the log storage identifier.

5. The method according to claim 4, characterized in that, The shared memory of each application process includes M storage spaces, where M = 2. x X is a positive integer; Determining the storage identifier of the log based on the log processing sequence number includes: The log processing sequence number and the preset value are ANDed to obtain the storage identifier of the log, wherein the size of the preset value is M-1.

6. A log processing device, characterized in that, The device is applied to a log processing system, which processes logs generated by N application processes. Each application process corresponds to a shared memory, each shared memory corresponds to a memory identifier, each shared memory includes M storage spaces, and each storage space corresponds to a storage identifier. The device includes: The processing module is used to find the shared memory and the first storage identifier corresponding to each memory identifier according to the memory identifier of the shared memory corresponding to each application process, wherein the first storage identifier corresponds to the first target storage space among the M storage spaces, the first target storage space is used to store the first target log and the timestamp of the first target log, and the first target log is the log with the smallest timestamp among at least one unprocessed log generated by the application process corresponding to the memory identifier; The acquisition module is used to obtain the timestamps of the first target logs from the N first target storage spaces corresponding to the N first storage identifiers, and obtain N timestamps respectively; The output module is used to output the log corresponding to the smallest timestamp among the N timestamps.

7. The apparatus according to claim 6, characterized in that, The log corresponding to the smallest timestamp among the N timestamps is the second target log; the device further includes: The processing module is used to determine the log corresponding to the smallest timestamp among the N timestamps as the processed second target log, wherein the second target log is generated by the target application process among the N application processes; The acquisition module is also used to acquire the timestamp of each log in at least one unprocessed log generated by the target application process; The processing module is further configured to update the first storage identifier of the target application process to the storage identifier of the storage space where the log with the smallest timestamp among at least one unprocessed log generated by the target application process is located.

8. An electronic device, characterized in that, The device includes: a processor, and a memory storing computer program instructions; The processor reads and executes the computer program instructions to implement the log processing method as described in any one of claims 1-7.

9. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when executed by a processor, implement the log processing method as described in any one of claims 1-7.

10. A vehicle, characterized in that, The vehicle includes the log processing device as described in claim 6 or 7, or the electronic device as described in claim 8, or the readable storage medium as described in claim 9.