A log storage method and device, electronic equipment and storage medium
By using array structures and buffer counting operations during log storage, the problems of high log ingestion pressure and low merging efficiency are solved, achieving efficient log storage and merging, and reducing ingestion failures and data redundancy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING TOPSEC NETWORK SECURITY TECH
- Filing Date
- 2022-12-05
- Publication Date
- 2026-06-12
AI Technical Summary
Existing technologies suffer from problems such as high log ingestion pressure, frequent log information generation leading to ingestion failures, low log merging efficiency, and non-serialization of data key-value pairs during log storage.
An array structure is used for merging and storing log information. After generating log information, it is stored in a temporary cache. The system performs a counting operation based on the status of the formal cache and the log information to determine whether to merge and store the log information. This avoids repeated reading and frequent generation of log information and optimizes the log storage process.
It reduces the probability of log insertion failure, improves log storage efficiency, shortens insertion time, avoids data redundancy and storage errors, and optimizes the log merging process.
Smart Images

Figure CN115827575B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a log storage method, apparatus, electronic device, and computer storage medium. Background Technology
[0002] When a specified event is executed within the device system, a corresponding log file is generated to record the specific execution information of that event. In previous log storage methods, each event required the output of a separate log entry to describe the event's process. However, with the development of business applications, the repetitive generation of the same events within the same timeframe leads to frequent log information production. Each log generation necessitates a database read operation, increasing the pressure on log storage and potentially causing log storage failures.
[0003] Existing technologies have many problems when processing log files. For example, when merging logs, it is necessary to search the log merging sequence layer by layer under each merging line number, which is not conducive to log merging efficiency. Or, when data needs to be appended, the old data is not modified, resulting in key range overlap between several appended data, and the key-value pairs are no longer ordered. Summary of the Invention
[0004] The purpose of this application is to provide a log storage method, apparatus, electronic device, and storage medium, which can alleviate the pressure of log entry, reduce the probability of log entry failure, reduce the drawbacks of repetitive log information reading and frequent log information generation, improve log storage efficiency, and shorten entry time.
[0005] In a first aspect, embodiments of this application provide a log storage method, the method comprising:
[0006] Generate log information;
[0007] Get the status of the formal cache area;
[0008] A counting operation is performed based on the state of the formal cache area and the log information to obtain the counted log information;
[0009] The counted log information is stored in the database.
[0010] In the above implementation process, by performing technical operations based on the status of the formal cache area and log information, it is possible to accurately determine whether log information needs to be merged into the database. This can alleviate the pressure of logging information into the database, reduce the probability of log information failure, reduce the drawbacks of repetitive reading of log information and frequent generation of log information, improve the storage efficiency of log information, and shorten the time of logging into the database.
[0011] Furthermore, after the step of generating log information, the method further includes:
[0012] The log information is stored in a temporary cache.
[0013] In the above implementation process, storing log information in a temporary cache can alleviate the storage pressure of log information and avoid data redundancy caused by too much log information waiting to be stored.
[0014] Further, the step of performing a counting operation based on the state of the formal cache and the log information to obtain the counted log information includes:
[0015] Determine whether the status of the formal cache area stores the log information;
[0016] If not, the log information is transferred from the temporary cache to the formal cache, and a counting operation is performed on the formal cache to obtain the counted log information.
[0017] If so, initialize the count of the formal cache area based on the log information and the log information stored in the formal cache area.
[0018] In the above implementation process, by using the technique of determining whether the formal cache contains log information, the storage status of the formal cache can be clearly obtained, avoiding the storage of too much log information in the formal cache, which could lead to log information insertion failure and effectively shorten the storage time of log information.
[0019] Further, the step of initializing the count of the formal cache based on the log information and the log information stored in the formal cache includes:
[0020] Obtain the log information stored in the formal cache area;
[0021] Determine whether the log information is consistent with the log information stored in the formal cache area;
[0022] If so, obtain the current count of the formal cache area and initialize the current count;
[0023] If not, the log information stored in the formal cache is stored in the database, and the log information is transferred from the temporary cache to the formal cache.
[0024] In the above implementation process, by judging the log information and the log information stored in the formal cache to determine whether to perform initialization technology, it is possible to accurately obtain the log information that needs to be stored in the formal cache or the log information that needs to be stored in the database, effectively reducing the probability of log information storage errors and avoiding the storage of incorrect log information in the database.
[0025] Further, the step of initializing the current count includes:
[0026] Determine whether the current count has reached the preset count;
[0027] If so, store the log information stored in the formal cache into the database, and initialize the current count;
[0028] If not, perform a counting operation on the formal cache area to obtain the counted log information.
[0029] In the above implementation process, if the current count reaches the preset count, it indicates that the log information stored in the formal cache has reached the database entry requirements. It is necessary to store it in the database and initialize it before recounting. This can improve the efficiency of logging information into the database and avoid errors.
[0030] Furthermore, the step of determining whether the log information and the log information stored in the formal cache are consistent includes:
[0031] Parameters for obtaining the log information;
[0032] Obtain the parameters of the log information stored in the formal cache area;
[0033] Determine whether the parameters of the log information are consistent with the parameters of the log information stored in the formal cache.
[0034] In the above implementation process, judging whether the parameters of the log information and the parameters of the log information stored in the formal cache are consistent can improve the comparison efficiency and correctly identify the log information.
[0035] Secondly, embodiments of this application also provide a log storage device, the device comprising:
[0036] The generation module is used to generate log information;
[0037] The retrieval module is used to retrieve the status of the formal cache area;
[0038] The counting module is used to perform a counting operation based on the status of the formal cache area and the log information to obtain the counted log information;
[0039] The storage module is used to store the counted log information into the database.
[0040] In the above implementation process, by performing technical operations based on the status of the formal cache area and log information, it is possible to accurately determine whether log information needs to be merged into the database. This can alleviate the pressure of logging information into the database, reduce the probability of log information failure, reduce the drawbacks of repetitive reading of log information and frequent generation of log information, improve the storage efficiency of log information, and shorten the time of logging into the database.
[0041] Furthermore, the storage module is also used for:
[0042] The log information is stored in a temporary cache.
[0043] In the above implementation process, storing log information in a temporary cache can alleviate the storage pressure of log information and avoid data redundancy caused by too much log information waiting to be stored.
[0044] Thirdly, an electronic device provided in this application includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method as described in any of the first aspects.
[0045] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described in any of the first aspects.
[0046] Fifthly, embodiments of this application provide a computer program product that, when run on a computer, causes the computer to perform the method described in any of the first aspects.
[0047] Other features and advantages of this disclosure will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.
[0048] It can be implemented in accordance with the contents of the specification. The preferred embodiments of this application are described in detail below with reference to the accompanying drawings. Attached Figure Description
[0049] 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. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation on the range. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 A flowchart illustrating the log storage method provided in an embodiment of this application;
[0051] Figure 2 This is a schematic diagram of the structural composition of the log storage device provided in the embodiments of this application;
[0052] Figure 3 This is a schematic diagram of the structural composition of the electronic device provided in the embodiments of this application. Detailed Implementation
[0053] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0054] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0055] The specific embodiments of this application will be described in further detail below with reference to the accompanying drawings and examples. The following examples are used to illustrate this application, but are not intended to limit the scope of this application.
[0056] Example 1
[0057] Figure 1 This is a flowchart illustrating the log storage method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method includes:
[0058] S1, generate log information;
[0059] S2, obtain the status of the actual cache area;
[0060] S3 performs a counting operation based on the status of the formal buffer and log information to obtain the counted log information;
[0061] S4 stores the counted log information into the database.
[0062] In the above implementation process, by performing technical operations based on the status of the formal cache area and log information, it is possible to accurately determine whether log information needs to be merged into the database. This can alleviate the pressure of logging information into the database, reduce the probability of log information failure, reduce the drawbacks of repetitive reading of log information and frequent generation of log information, improve the storage efficiency of log information, and shorten the time of logging into the database.
[0063] The embodiments of this application can solve the problem of merging and counting the generated log information when there is a large number of identical traffic accesses, and performing database insertion operations when a certain count is reached, thereby reducing the number of database read and write operations.
[0064] Furthermore, after the step of generating log information, the following steps are also included:
[0065] Log information is stored in a temporary cache.
[0066] In the above implementation process, storing log information in a temporary cache can alleviate the storage pressure of log information and avoid data redundancy caused by too much log information waiting to be stored.
[0067] Log information is generated and placed in a temporary cache.
[0068] Furthermore, S3 includes:
[0069] Determine whether the status of the formal cache area stores log information;
[0070] If not, transfer the log information from the temporary cache to the formal cache, perform a counting operation on the formal cache, and obtain the counted log information.
[0071] If so, initialize the count for the formal cache based on the log information and the log information stored in the formal cache.
[0072] In the above implementation process, by using the technique of determining whether the formal cache contains log information, the storage status of the formal cache can be clearly obtained, avoiding the storage of too much log information in the formal cache, which could lead to log information insertion failure and effectively shorten the storage time of log information.
[0073] Furthermore, the step of initializing the count in the formal cache based on the log information and the log information stored in the formal cache includes:
[0074] Retrieve log information stored in the formal cache area;
[0075] Determine whether the log information is consistent with the log information stored in the formal cache;
[0076] If so, obtain the current count of the formal cache and initialize the count.
[0077] If not, store the log information in the formal cache into the database, and transfer the log information from the temporary cache to the formal cache.
[0078] In the above implementation process, by judging the log information and the log information stored in the formal cache to determine whether to perform initialization technology, it is possible to accurately obtain the log information that needs to be stored in the formal cache or the log information that needs to be stored in the database, effectively reducing the probability of log information storage errors and avoiding the storage of incorrect log information in the database.
[0079] Check if there is log information in the formal cache. If so, compare the log information stored in the temporary cache with the log information in the formal cache. If not, transfer the logs stored in the temporary cache to the formal cache and set the count in the formal cache to 1.
[0080] If the log information stored in the temporary cache is consistent with the information in the formal cache, check the count in the formal cache; otherwise, perform a database entry operation on the log information stored in the formal cache, and transfer the log information in the temporary cache to the formal cache.
[0081] Furthermore, the step of initializing the current count includes:
[0082] Determine whether the current count has reached the preset count;
[0083] If so, store the log information stored in the formal cache into the database and initialize the current count;
[0084] If not, perform a counting operation on the formal cache area to obtain the counted log information.
[0085] In the above implementation process, if the current count reaches the preset count, it indicates that the log information stored in the formal cache has reached the database entry requirements. It is necessary to store it in the database and initialize it before recounting. This can improve the efficiency of logging information into the database and avoid errors.
[0086] If the count has not reached the preset count, the count is incremented by 1. If the count has reached the preset count, the log information in the formal cache is stored in the database, the count is initialized, and then the counting starts again.
[0087] Furthermore, the step of determining whether the log information and the log information stored in the formal cache are consistent includes:
[0088] Parameters for retrieving log information;
[0089] Parameters for retrieving log information stored in the formal cache;
[0090] Determine whether the parameters of the log information are consistent with the parameters of the log information stored in the formal cache.
[0091] In the above implementation process, judging whether the parameters of the log information and the parameters of the log information stored in the formal cache are consistent can improve the comparison efficiency and correctly identify the log information.
[0092] This application provides a log information merging and storage method based on an array structure. When a device generates log information, the current log information is stored in a temporary buffer and compared with the log information in the formal buffer. If the parameters to be compared between the log information stored in the temporary buffer and the log information stored in the formal buffer are consistent, then the log information stored in the temporary buffer is considered to need to be merged, and the count in the formal buffer is incremented by 1. When the count accumulates to a preset count, the log information stored in the formal buffer is stored in the database, and the count in the formal buffer is initialized (optionally, the initial count can be set to 1), and counting starts again. If the parameters to be compared are inconsistent, the log information stored in the temporary buffer is considered to be new log information and does not need to be merged. The log information stored in the formal buffer is stored in the database, and the log information in the temporary buffer is transferred to the formal buffer.
[0093] For example, embodiments of this application can be applied to logging modules in next-generation firewalls, such as access control logs, data filtering logs, and virus filtering logs. Using an array structure proposed in this application, a large number of identical log messages from the same time period are merged before being stored in the database, reducing frequent read and write operations on the database. The system architecture and implementation process are as follows:
[0094] When client A accesses server B's web port for the first time, a log message will be generated immediately for the corresponding connection. The protocol is Hypertext Transfer Protocol (HTTP), and the count is 1. When client A accesses server B's web port again, since the source port is the same, the backend has already started counting based on the previous log message. At this time, no new log message is generated on the web page.
[0095] Client A pings server B (using an update notification service based on the XML-RPC standard protocol). Because the protocol and destination port have changed, the client first generates the log information for the previous cached count before immediately generating the corresponding ping connection log information, with a count of 1. Two log entries can be viewed on the web page: one for HTTP with a count of 2, and the other for Internet Control Message Protocol (ICMP) with a count of 1.
[0096] The lightweight merging method based on the log merge tree structure in the existing technology aims to reduce read-write amplification when the log merge tree performs background Dtable merging. This is achieved by storing the metadata in the lower-level overlap Dtables in the upper-level Victim Dtable and adjusting the key-value range of the Dtables to balance the amount of appended data in the Dtables. This reduces the overhead of the log merge tree merging operation and eliminates the technical problem of read-write amplification in the log merge tree.
[0097] Compared to the lightweight merging method using a log merging tree structure, this embodiment of the application compares and merges adjacent log messages using an array structure, thus optimizing the log merging process. By comparing log messages using an array structure, the log messages are only inserted into the database after the log message count reaches a certain threshold, reducing database read and write operations.
[0098] Example 2
[0099] In order to execute the method corresponding to Embodiment 1 above and achieve the corresponding functions and technical effects, a log storage device is provided below, such as... Figure 3 As shown, the device includes:
[0100] Module 1 is used to generate log information;
[0101] Module 2 is used to obtain the status of the formal cache area;
[0102] Counting module 3 is used to perform counting operations based on the status of the formal buffer and log information to obtain the counted log information;
[0103] Storage module 4 is used to store the counted log information into the database.
[0104] In the above implementation process, by performing technical operations based on the status of the formal cache area and log information, it is possible to accurately determine whether log information needs to be merged into the database. This can alleviate the pressure of logging information into the database, reduce the probability of log information failure, reduce the drawbacks of repetitive reading of log information and frequent generation of log information, improve the storage efficiency of log information, and shorten the time of logging into the database.
[0105] Furthermore, storage module 4 is also used for:
[0106] Log information is stored in a temporary cache.
[0107] In the above implementation process, storing log information in a temporary cache can alleviate the storage pressure of log information and avoid data redundancy caused by too much log information waiting to be stored.
[0108] Furthermore, the counting module 3 is also used for:
[0109] Determine whether the status of the formal cache area stores log information;
[0110] If not, transfer the log information from the temporary cache to the formal cache, perform a counting operation on the formal cache, and obtain the counted log information.
[0111] If so, initialize the count for the formal cache based on the log information and the log information stored in the formal cache.
[0112] In the above implementation process, by using the technique of determining whether the formal cache contains log information, the storage status of the formal cache can be clearly obtained, avoiding the storage of too much log information in the formal cache, which could lead to log information insertion failure and effectively shorten the storage time of log information.
[0113] Furthermore, the counting module 3 is also used for:
[0114] Retrieve log information stored in the formal cache area;
[0115] Determine whether the log information is consistent with the log information stored in the formal cache;
[0116] If so, obtain the current count of the formal cache and initialize the count.
[0117] If not, store the log information in the formal cache into the database, and transfer the log information from the temporary cache to the formal cache.
[0118] In the above implementation process, by judging the log information and the log information stored in the formal cache to determine whether to perform initialization technology, it is possible to accurately obtain the log information that needs to be stored in the formal cache or the log information that needs to be stored in the database, effectively reducing the probability of log information storage errors and avoiding the storage of incorrect log information in the database.
[0119] Furthermore, the counting module 3 is also used for:
[0120] Determine whether the current count has reached the preset count;
[0121] If so, store the log information stored in the formal cache into the database and initialize the current count;
[0122] If not, perform a counting operation on the formal cache area to obtain the counted log information.
[0123] In the above implementation process, if the current count reaches the preset count, it indicates that the log information stored in the formal cache has reached the database entry requirements. It is necessary to store it in the database and initialize it before recounting. This can improve the efficiency of logging information into the database and avoid errors.
[0124] Furthermore, the counting module 3 is also used for:
[0125] Parameters for retrieving log information;
[0126] Parameters for retrieving log information stored in the formal cache;
[0127] Determine whether the parameters of the log information are consistent with the parameters of the log information stored in the formal cache.
[0128] In the above implementation process, judging whether the parameters of the log information and the parameters of the log information stored in the formal cache are consistent can improve the comparison efficiency and correctly identify the log information.
[0129] The log storage device described above can implement the method of Embodiment 1. The options in Embodiment 1 are also applicable to this embodiment, and will not be described in detail here.
[0130] The remaining contents of this embodiment can be referred to the contents of Embodiment 1 above, and will not be repeated in this embodiment.
[0131] Example 3
[0132] This application provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor runs the computer program to cause the electronic device to perform the log storage method of Embodiment 1.
[0133] Alternatively, the aforementioned electronic device may be a server.
[0134] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating the structural composition of an electronic device provided in an embodiment of this application. The electronic device may include a processor 31, a communication interface 32, a memory 33, and at least one communication bus 34. The communication bus 34 is used to enable direct communication between these components. In this embodiment, the communication interface 32 is used for signaling or data communication with other node devices. The processor 31 may be an integrated circuit chip with signal processing capabilities.
[0135] The processor 31 described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor, or the processor 31 can be any conventional processor.
[0136] The memory 33 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. The memory 33 stores computer-readable instructions. When these computer-readable instructions are executed by the processor 31, the device can perform the aforementioned operations. Figure 1 The various steps involved in the method implementation examples.
[0137] Optionally, the electronic device may also include a storage controller and an input / output unit. The memory 33, storage controller, processor 31, peripheral interface, and input / output unit are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses 34. The processor 31 is used to execute executable modules stored in the memory 33, such as software function modules or computer programs included in the device.
[0138] Input / output units are used to enable users to create tasks and set optional start periods or preset execution times for those tasks, facilitating user-server interaction. Input / output units can be, but are not limited to, a mouse and keyboard.
[0139] Understandable. Figure 3 The structure shown is for illustrative purposes only; the electronic device may also include components that are more advanced than those shown. Figure 3 The more or fewer components shown, or having the same Figure 3 The different configurations shown. Figure 3The components shown can be implemented using hardware, software, or a combination thereof.
[0140] In addition, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the log storage method of Embodiment 1.
[0141] This application also provides a computer program product that, when run on a computer, causes the computer to perform the method described in the method embodiment.
[0142] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using dedicated hardware-based apparatus that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0143] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0144] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion 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 a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, external hard drives, ROM, RAM, magnetic disks, or optical disks.
[0145] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0146] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of protection of the claims.
[0147] It should be noted that, in this document, relational terms such as "first" and "second" are used only 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 one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A log storage method, characterized in that, The method includes: Generate log information; Store the current log information in a temporary cache. Get the status of the formal cache area; Determine whether the status of the formal cache area stores log information; If so, obtain the log information stored in the formal cache area, and determine whether the parameters that need to be compared between the current log information and the log information stored in the formal cache area are consistent; If the log information stored in the temporary cache area has the same parameters as the log information stored in the formal cache area, then the log information stored in the temporary cache area is considered to need to be merged. The current count in the formal cache area is incremented by 1, and it is determined whether the current count has reached the preset count. If the current count has reached the preset count, the log information stored in the formal cache area is stored in the database, the current count is initialized, and counting starts again. If the parameters that need to be compared between the log information stored in the temporary cache and the log information stored in the formal cache are inconsistent, the log information currently stored in the formal cache is stored in the database, and the log information is transferred from the temporary cache to the formal cache. If not, the current log information is transferred from the temporary cache to the formal cache, and a counting operation is performed on the formal cache to obtain the counted log information.
2. A log storage device, characterized in that, The device includes: a generation module, a counting module, an acquisition module, and a storage module; The generation module is used to generate log information; The counting module is used to store the current log information into a temporary buffer. The retrieval module is used to retrieve the status of the formal cache area; The counting module is also used for: Determine whether the status of the formal cache area stores log information; If so, obtain the log information stored in the formal cache area, and determine whether the parameters that need to be compared between the current log information and the log information stored in the formal cache area are consistent; If the log information stored in the temporary cache area has the same parameters as the log information stored in the formal cache area, then the log information stored in the temporary cache area is considered to need to be merged. The current count in the formal cache area is incremented by 1, and it is determined whether the current count has reached the preset count. If the current count has reached the preset count, the storage module is used to store the log information stored in the formal cache area into the database, initialize the current count, and start counting again. If the parameters that need to be compared between the log information stored in the temporary cache and the log information stored in the formal cache are inconsistent, the storage module is used to store the log information currently stored in the formal cache into the database and transfer the log information from the temporary cache to the formal cache. If not, the current log information is transferred from the temporary cache to the formal cache, and a counting operation is performed on the formal cache to obtain the counted log information.
3. An electronic device, characterized in that, The device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the log storage method according to claim 1.
4. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the log storage method as described in claim 1.