Log operation method and device, storage medium and program product

Through the substrate management control system, the storage addresses of the logs of each system of the server are managed uniformly, which solves the problems of complex log collection and unbalanced erase, and realizes efficient log management and memory life extension.

CN120256247AActive Publication Date: 2025-07-04INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510705559.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-07-04
Estimated Expiration
2045-05-29

AI Technical Summary

Technical Problem

The prior art cannot manage the logs generated by various systems in the server, resulting in complex and time-consuming log collection, and the number of erases in different storage areas is uneven, affecting the service life of the memory.

Method used

The baseboard management control system converts the log storage addresses of each system into a unified storage address, and partitions are divided into the log memory to realize unified management of each system log, and at the same time, the target system is allowed to generate operation instructions based on the original storage address.

Benefits of technology

It realizes unified management of each system log, reduces the complexity of log collection, balances the number of erases in the storage area, extends the service life of the memory, and does not affect the log processing logic of the target system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256247A_ABST
    Figure CN120256247A_ABST
Patent Text Reader

Abstract

The invention discloses a log operation method and device, a storage medium and a program product, and relates to the technical field of server computation.The log operation method comprises the steps that on one hand, when a log operation instruction sent by a target system is received, a first storage address indicated by the log operation instruction is converted into a second storage address, and therefore the log operation instruction is converted into the second storage address; therefore, the target logs indicated by the log operation instruction can be managed in a unified manner according to the storage address planning of the baseboard management control system. On the other hand, based on the conversion function of the storage address, the target system can still generate the operation instruction for the target log based on the first storage address while the target log is managed in a unified mode according to the second storage address, and the log processing logic of the target system side is not affected. Based on the above two aspects, the technical scheme of the application can solve the problem that in some technologies, logs generated by each target system cannot be managed in a unified manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of servers, and particularly to a log operation method, device, storage medium, and program product. Background Art

[0002] In a server, there are usually multiple systems with different functions, such as the Basic Input / Output System (BIOS), Baseboard Management Controller (BMC), backup and recovery system, network security system, etc. During the operation of the system, logs are generated to record the operation status, error information, debugging information, etc. of the system.

[0003] Currently, some technologies cannot uniformly manage the logs generated by each system and need to be improved. Summary of the Invention

[0004] This application provides a log operation method, recovery method, log operation device, recovery device, electronic device, computer-readable storage medium, and computer program product to at least solve the problem in the related art that the logs generated by each system cannot be uniformly managed.

[0005] This application provides a log operation method, the method includes: Receiving a log operation instruction sent by a target system, the log operation instruction is used to indicate a target log to be operated by the target system and a first storage address of the target log, the target log is a log generated by the target system, and the first storage address is a storage address planned by the target system for the target log; Converting the first storage address to a second storage address according to a first conversion logic, the second storage address is a storage address planned by the Baseboard Management Control System for the target log, and the Baseboard Management Control System is used to operate and manage the logs of at least one target system; Operating the target log according to the second storage address.

[0006] This application also provides a log operation device, the device includes: An instruction receiving module, configured to receive a log operation instruction sent by a target system, the log operation instruction is used to indicate a target log to be operated by the target system and a first storage address of the target log, the target log is a log generated by the target system, and the first storage address is a storage address planned by the target system for the target log; An address conversion module, configured to convert the first storage address into a second storage address according to a first conversion logic, where the second storage address is a storage address planned by the baseboard management control system for the target log, and the baseboard management control system is used to operate and manage the logs of at least one target system; A log operation module, configured to operate the target log according to the second storage address.

[0007] This application also provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to implement the steps of any of the above log operation methods when executing the computer program.

[0008] This application also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above annotation methods are implemented.

[0009] This application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of any of the above annotation methods are implemented.

[0010] In the technical solutions of some embodiments of this application, on the one hand, when a log operation instruction sent by a target system is received, the first storage address indicated by the log operation instruction is converted into a second storage address, so that the target log indicated by the log operation instruction can be uniformly managed according to the storage address plan of the baseboard management control system. On the other hand, based on the storage address conversion function, while the target log is uniformly managed according to the second storage address, the target system can still generate an operation instruction for the target log based on the first storage address, that is, it does not affect the log processing logic on the target system side. Based on the above two aspects, the technical solutions of this application can solve the problem in some technologies that the logs generated by each target system cannot be uniformly managed. Description of the Drawings

[0011] To more clearly illustrate the embodiments of this application, the following will briefly introduce the drawings required for the embodiments. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0012] Figure 1 A schematic diagram for log management of a server in some technologies; Figure 2 A schematic diagram for log management of a server in other technologies; Figure 3 A flowchart of the log operation method provided by some embodiments of this application; Figure 4 Schematic diagram of a log storage partition provided for some embodiments of the present application; Figure 5 Module schematic diagram of a log operation device provided for some embodiments of the present application; Figure 6 Module schematic diagram of an electronic device provided for some embodiments of the present application. Detailed implementation manners

[0013] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0014] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0015] To enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.

[0016] Refer to Figure 1 , which is a schematic diagram for log management of a server in some technologies. Figure 1 In, systems 1 to n refer to each system running in the server. For example, system 1 is the basic input / output system, system 2 is the baseboard management control system, and system n is the network security system. Systems 1 to n are connected to memories 1 to n one-to-one based on the SPI (Serial Peripheral Interface) protocol. Memories 1 to n can be non-volatile memories, such as Flash. Each memory can be used to store the firmware and logs of the corresponding system. For example, memory 1 is used to store the firmware and logs of system 1, and memory 2 is used to store the firmware and logs of system 2.

[0017] In the program codes of each system, the log storage address can be pre-planned according to actual needs, that is, each system can manage logs independently. For example, in the program code of System 1, through planning, log a generated by System 1 can be saved at storage address a1 of Memory 1, and log b generated by System 1 can be saved at storage address b1 of Memory 1. Another example is that in the program code of System 2, through planning, log c generated by System 2 can be saved at storage address c1 of Memory 2, and log d generated by System 2 can be saved at storage address d1 of Memory 2.

[0018] In Figure 1 In the log management method shown, on the one hand, each system manages logs independently, which is not conducive to the unified management and collection of logs. For example, in order to monitor and manage each system, the baseboard management control system may need to collect the logs of systems such as the basic input / output system and the network security system. Based on Figure 1 the log management method shown, the baseboard management control system needs to obtain the storage address planning logic of each system and collect logs from the memories connected to each system based on the storage address planning logic. It can be seen that the entire log collection process is relatively complex and time-consuming. On the other hand, when the firmware and logs of each system are saved in the same memory, there will be a problem of uneven erasure counts in different storage areas of the same memory. For example, since log reading and writing are relatively frequent and firmware reading and writing are less frequent, in the log storage area and the firmware storage area of the same memory, the erasure count of the log storage area will be relatively large, and the erasure count of the firmware storage area will be relatively small. In this way, the log storage area may be damaged while the firmware storage area is not damaged yet, and the memory needs to be replaced.

[0019] Referring to Figure 2 , it is a schematic diagram of log management for a server in some other technologies. Figure 2 In it, the baseboard management control system is connected to a log memory, and the baseboard management control system and each of the other systems outside the baseboard management control system are respectively connected to a firmware memory. The firmware memory is used to save the firmware of the connected system, and the log memory is used to save the logs of all systems.

[0020] Specifically, the baseboard management control system can divide the log memory into multiple partitions, and each partition is used to store the logs of one of the systems. For example, the log memory can be divided into partition 1, partition 2, ……, partition n. Among them, partition 1 is used to store the logs of the baseboard management control system, partition 2 is used to store the logs of the basic input / output system, and so on. Each system outside the baseboard management control system (such as the basic input / output system, network security system) can send the logs to the baseboard management control system based on the ESPI (Enhanced Serial Peripheral Interface) protocol. The baseboard management control system can plan the log storage addresses of each system and save the logs generated by itself and the logs sent by other systems to the log memory according to the planned log storage addresses. In this way, the baseboard management control system can uniformly manage the logs generated by each system without collecting the logs from the memories connected to each system, thus greatly reducing the complexity of log collection. In addition, Figure 2 In the shown solution, since the logs of multiple systems are stored in different partitions of the log memory, and the logs of the system and the firmware are saved to different memories, therefore, the number of erasure times of each partition of the log memory can be relatively balanced, thus avoiding Figure 1 the problem of unbalanced number of erasure times in different partitions of the same memory.

[0021] However, Figure 2 in the shown solution, there are still some problems. For example, since the log storage addresses of each system are planned by the baseboard management control system, after each system outside the baseboard management control system sends the logs to the baseboard management control system, it cannot obtain the accurate log storage addresses, and thus these systems cannot directly generate log operation instructions such as log read / write instructions, log deletion instructions (because the log operation instructions usually need to include the log storage addresses), that is, these systems cannot perform log operations (such as log read / write, deletion, etc.) based on the log storage addresses, restricting the functions of these systems.

[0022] In view of this, the present application provides a log operation method, which can uniformly manage the logs generated by multiple systems and supports each system to directly generate log operation instructions according to actual needs. The log operation method can be applied to the baseboard management control system or to an electronic device running the baseboard management control system. The electronic device can include but is not limited to a baseboard management controller. In the method of the present application, the architectural relationship between the baseboard management control system and other systems can be the same as Figure 2 the similar one, which will not be elaborated hereinafter.

[0023] Refer to in combination Figure 3, which is a schematic flow chart of the log operation method provided for some embodiments of the present application. Figure 3 In this method, the log operation method includes the following steps: Step S301, receive a log operation instruction sent by the target system. The log operation instruction is used to indicate the target log to be operated by the target system and the first storage address of the target log. The target log is the log generated by the target system, and the first storage address is the storage address planned by the target system for the target log.

[0024] Specifically, with reference to Figure 2 , the target system refers to other systems outside the baseboard management control system, such as the basic input / output system, network security system, etc.

[0025] The log operation instruction may include, but is not limited to, a log write instruction, a log read instruction, a log modification instruction, a log deletion instruction, etc. In a complete log operation instruction, it may include an operation keyword, the log information of the target log, and the first storage address. Among them, the operation keyword is used to indicate the operation type to be performed on the target log, such as write, read, modify, delete, etc. The log information is used to indicate the target log to be operated. In different types of log operation instructions, the log information may be different. For example, in the log write instruction, the log information may include the entity content of the target log, indicating that the log in the log operation instruction is saved to the log memory. And in the log read instruction, the log information may include the size of the target log or the generation time of the target log, etc., indicating to read the log of the specified size or the specified generation time from the log memory. The first storage address refers to the log storage address planned for the target log according to the first address planning logic of the target system.

[0026] In this embodiment, the first storage address specifically refers to the starting storage address of the target log planned by the target system, that is, the target log is operated starting from the first storage address. For example, starting from the first storage address, the target log is sequentially saved to the log memory. Another example is to start from the first storage address and read the specified size of content as the target log.

[0027] For ease of understanding, the following is an example of a log operation instruction. For example, a log write instruction can be expressed as write_log logM address1. Here, write_log is the operation keyword indicating a write operation, logM is the entity content of the target log to be saved, and address1 is the storage address planned by the target system for the target log logM. Another example, a log read instruction can be expressed as read_log 20250517 address2. Here, read_log is the operation keyword indicating a read operation, 20250517 is the log information, indicating to read the target log with a generation time of 20250517, and address2 is the storage address planned by the target system for the target log with a generation time of 20250517. It should be noted that the above logM, address1, 20250517, and address2 are just examples. When generating a log operation instruction, replace logM, address1, 20250517, and address2 according to actual needs.

[0028] Furthermore, in the log operation instruction, it can also include, but is not limited to, information such as the log level and the system identifier of the target system. Taking the system identifier as an example. Based on the system identifier, the baseboard management control system can identify log operation instructions sent by different target systems. For example, the above log write instruction write_log logM address1 can be further written as write_log S1 logM address1, where S1 is the system identifier of target system 1. In this way, based on the system identifier S1, the baseboard management control system can determine that the target operation instruction is sent by target system 1.

[0029] Step S302, according to the first conversion logic, convert the first storage address into a second storage address, where the second storage address is the storage address planned by the baseboard management control system for the target log, and the baseboard management control system is used to operate and manage the logs of at least one target system.

[0030] Specifically, the second storage address refers to the log storage address planned for the target log according to the second address planning logic of the baseboard management control system. Similar to the first storage address, the second storage address can specifically refer to the starting storage address of the target log planned by the baseboard management control system. The first storage address and the second storage address can be the same or different.

[0031] In the baseboard management control system, a first conversion logic can be preset. Based on the first conversion logic, the first storage address planned by the target system can be converted into the second storage address planned by the baseboard management control system. Specifically, the first conversion logic can include the storage address mapping relationship between the target system and the baseboard management control system. After receiving the log operation instruction sent by the target system, the baseboard management control system can convert the first storage address indicated by the log operation instruction into the second storage address based on this storage address mapping relationship. For example, the storage address mapping relationship can be as shown in Table 1.

[0032] Table 1 Storage address mapping relationship

[0033] Taking the second row in Table 1 as an example, it means that in the log operation instruction sent by the target system, if the first storage address is Address11, the converted second storage address can be Address12.

[0034] For another example, the storage address mapping relationship can be as shown in Expression (1).

[0035] AddressY = AddressX + 2 (1) In Expression (1), AddressX represents the first storage address planned by the target system for the target log, and AddressY represents the second storage address planned by the baseboard management control system for the target log.

[0036] It should be noted that the storage address mapping relationship can include but is not limited to the forms of Table 1 and Expression (1), and this application does not limit this.

[0037] In this embodiment, between each target system and the baseboard management control system, there can be their respective corresponding storage address mapping relationships. For example, the storage address mapping relationship between Target System 1 and the baseboard management control system can be as shown in Expression (2).

[0038] AddressY1 = AddressX1 + 5 (2) In Expression (2), AddressX1 represents the first storage address planned by Target System 1 for its target log, and AddressY1 represents the second storage address planned by the baseboard management control system for the target log of Target System 1.

[0039] For another example, the storage address mapping relationship between Target System 2 and the baseboard management control system can be as shown in Expression (3).

[0040] AddressY2 = AddressX2 + 8 (3) In expression (3), AddressX2 represents the first storage address planned by the target system 2 for its target log, and AddressY2 represents the second storage address planned by the baseboard management control system for the target log of the target system 2.

[0041] Step S303: Operate the target log according to the second storage address.

[0042] In this embodiment, the storage address of the target log can be uniformly managed based on the second address planning logic in the baseboard management control system. For example, the target log can be saved to the second storage address determined according to the second address planning logic, or the target log can be collected from the second storage address. Also, since the baseboard management control system has the function of converting storage addresses, the target system can still plan the first storage address of the target log according to the first address planning logic and generate a log operation instruction for the target log based on the first storage address, that is, the target system does not need to be aware of the second storage address.

[0043] For example, assume that the target system determines based on the first address planning logic that the target log L1 should be saved at the first storage address addrees1 in the log memory. Then, the target system can generate a log write instruction for the target log L1 based on the first storage address addrees1. After receiving the log write instruction, the baseboard management control system can convert the first storage address address1 to the second storage address address2 based on the first conversion logic, save the target log L1 at the second storage address address2, and then return a successful save response to the target system. When the target system needs to query the target log L1, the target system determines based on the first address planning logic that the target log L1 is saved at the first storage address addrees1 in the log memory. Therefore, it can generate a log read instruction for the target log L1 based on the first storage address addrees1. After receiving the log read instruction, the baseboard management control system can convert the first storage address address1 to the second storage address address2 based on the first conversion logic and return the read target log L1 from the second storage address address2 to the target system.

[0044] In summary, in the technical solutions of some embodiments of the present application, on the one hand, when receiving a log operation instruction sent by a target system, the first storage address indicated by the log operation instruction is converted into a second storage address. In this way, the target log indicated by the log operation instruction can be uniformly managed according to the storage address planning of the baseboard management control system. On the other hand, based on the storage address conversion function, while the target log is uniformly managed according to the second storage address, the target system can still generate an operation instruction for the target log based on the first storage address, that is, it does not affect the log processing logic on the target system side. Based on the above two aspects, the technical solution of the present application can solve the problem in some technologies that the logs generated by each target system cannot be uniformly managed.

[0045] Specifically, uniformly managing the target log indicated by the log operation instruction according to the storage address planning of the baseboard management control system mainly includes the following two aspects: 1) In the log memory, log storage partitions are divided for each target system; 2) After receiving the log operation instruction of the target system, through storage address conversion, the first storage address in the log operation instruction is converted into a second storage address in the log storage partition corresponding to the target system. Based on the above description, in some embodiments, before receiving the log operation instruction, the method of the present application may further include: In the log memory, log storage partitions are divided for each target system. The log storage partition includes a partition header, and the partition header represents the partition range of each log storage partition and the target system corresponding to each log storage partition. Each log storage partition is used to store the logs of the corresponding target system, and the second storage address is the storage address of the target log in the log memory.

[0046] Among them, the partition range refers to the address range of the log storage partition. For easy understanding, please refer to Figure 4 , a schematic diagram of the log storage partition provided for some embodiments of the present application. Figure 4In this case, the log memory is exemplarily divided into four log storage partitions D1, D2, D3, and D4. Among them, the log storage partition D1 can represent the log storage partition of the target system 1, and the log storage partition D2 can represent the log storage partition of the target system 2. And so on. Each log storage partition may respectively include a partition header. The partition header may record the partition information of the log storage partition. The partition information may include but is not limited to the start address, end address, partition size, partition name, etc. of the log storage partition. Based on the start address and end address of the log storage partition, the address range of the log storage partition can be determined. Or, based on the start address and partition size of the log storage partition, the address range of the log storage partition can be determined. The partition name is used to identify the target system corresponding to the log storage partition. For example, the partition name of the log storage partition D1 can be sy1, and the partition name of the log storage partition D2 can be sy2. Among them, sy1 can be the system identifier of the target system 1, indicating that the log storage partition D1 corresponds to the target system 1, that is, the log storage partition D1 is used to store the logs of the target system 1; sy2 can be the system identifier of the target system 2, indicating that the log storage partition D2 corresponds to the target system 2, that is, the log storage partition D2 is used to store the logs of the target system 2. In this way, based on the system identifier in the log operation instruction, the baseboard management control system can identify the target system that sends the log operation instruction. Then, based on the partition headers of each log storage partition, the target log storage partition corresponding to the target system can be found, and further, through storage address conversion, the first storage address in the log operation instruction can be converted into the second storage address located in the target log storage partition.

[0047] In some embodiments, the first storage address may include the first offset address of the target log. The above conversion of the first storage address into the second storage address according to the first conversion logic may include: Converting the first offset address into the second offset address according to the first conversion logic; Based on the partition header, finding the target log storage partition corresponding to the target system; Based on the base address and the second offset address of the target log storage partition, obtaining the second storage address.

[0048] Specifically, for the principle of converting the first offset address into the second offset address, reference can be made to the relevant descriptions in Table 1 and Expression (1) above, which will not be elaborated here. The following will illustrate how to obtain the second storage address based on the second offset address by way of example. For example Figure 3In this case, assume that the size of each partition header is 64 KB, and the size of the log storage partition D1 is 10 M (including the size of the partition header of the log storage partition D1). If the target log storage partition is the log storage partition D2, the base address of the target log storage partition is at the position of 10 M + 64 KB, and the second storage address is at the position of 10 M + 64 KB + the first offset address.

[0049] In the above embodiments, the partition ranges of each log storage partition and the target system corresponding to each log storage partition are recorded in the partition header, which is convenient for quickly finding the target log storage partition corresponding to the target system when receiving a log operation instruction, and the search efficiency is relatively high.

[0050] Specifically, in some embodiments, for any log storage partition, the partition header of the log storage partition includes the partition size, the start address, and the partition name of the log storage partition. The above method for finding the target log storage partition corresponding to the target system based on the partition header includes: Based on the partition size and the start address in the partition header, determine the partition ranges of each log storage partition; Based on the partition ranges of each log storage partition and the partition name in the partition header, determine the target log storage partition.

[0051] Specifically, the target partition header corresponding to the target system can be found based on the partition name in each partition header, and then the partition range of the target log storage partition can be determined based on the partition size and the start address in the target partition header. For example, assume that in the log operation instruction sent by the target system, the system identifier is sy2. Then, based on the system identifier sy2 and the partition names in each partition header, the log storage partition D2 corresponding to the target system can be found. Assume that the start address of the log storage partition D2 is address1 and the partition size of the log storage partition D2 is 10 M. Then, the end address of the log storage partition D2 is at the position of address1 + 10 M, that is, the partition range of the log storage partition D2 is between address1 and address1 + 10 M.

[0052] In the above embodiments, the partition size and the start address of the log storage partition are recorded in the partition header, and the end address of the log storage partition is calculated based on the start address and the partition size. In this way, it is not necessary to record the end address of the log storage partition in the partition header, thereby reducing the data volume of the partition header.

[0053] In some embodiments, the log memory includes a partition table. The partition table may include the partition size and the start address of each log storage partition. The partition header of each log storage partition may include a partition table identifier and a partition name. The above method for finding the target log storage partition corresponding to the target system based on the partition header may include: Locate the partition table based on the partition table identifier in the partition header; Determine the partition ranges of each log storage partition based on the partition table; Determine the target log storage partition based on the partition ranges of each log storage partition and the partition name in the partition header.

[0054] Specifically, based on the partition names in each partition header, the target partition header corresponding to the target system for the target log storage partition can be located. Furthermore, based on the partition table identifier in the target partition header, the starting address and partition size of the target log storage partition can be found in the partition table. Based on the starting address and partition size of the target log storage partition, the partition range of the target log storage partition can be determined.

[0055] Since the partition table in this embodiment can include the partition sizes and starting addresses of each log storage partition, the partition table identifiers in each partition header are the same.

[0056] In the above embodiment, by recording the partition table identifier in each partition header, the data volume of the partition header can be further reduced.

[0057] In some embodiments, the log operation instruction is further used to indicate the operation type to be performed on the target log. Specifically, as described in the above step S301, based on the operation keywords in each log operation instruction, the operation type can be determined. After receiving the log operation instruction sent by the target system, the method of the present application may further include: Cache the log operation instruction in the first buffer; When the number of log operation instructions cached in the first buffer reaches the quantity threshold, batch-operate on the target logs indicated by the log operation instructions in the log memory according to the operation types indicated by each log operation instruction.

[0058] Specifically, in some embodiments, batch-operating on the target logs indicated by the log operation instructions in the log memory may include: Parallelly execute multiple log operation instructions among the log operation instructions cached in the first buffer.

[0059] The so-called parallel execution of multiple log operation instructions means operating on the target logs indicated by multiple log operation instructions simultaneously in the log memory. In this way, the operation efficiency of the logs can be improved.

[0060] In some embodiments, before operating the target logs indicated by multiple log operation instructions at the same time, it can be determined whether there is a same second storage address among the second storage addresses corresponding to the multiple log operation instructions. If not, the target logs indicated by the multiple log operation instructions can be operated in parallel. If so, the target logs indicated by the multiple log operation instructions are not operated in parallel. In this way, hardware conflicts, data conflicts, and other problems caused by executing different log operations at the same storage address can be avoided.

[0061] In some embodiments, the target log indicated by the batch operation log operation instruction in the log storage may include: In the first buffer area, if there are multiple log operation instructions indicating the same operation type, and the second storage addresses of the target logs indicated by the multiple log operation instructions are continuous storage addresses, the target logs indicated by the multiple log operation instructions are batch operated in the log memory.

[0062] Specifically, if the operation types indicated by multiple log operation instructions are the same, and the second storage addresses of the target logs indicated by the multiple log operation instructions are continuous storage addresses, the multiple log operation instructions can be merged into one log operation instruction, and the target logs indicated by the multiple log operation instructions are operated once, so that the number of erasures and writes of the log memory can be greatly reduced, and the service life of the log memory can be extended. For example, assuming that the operation types of log operation instructions A and log operation instructions B are both write operations, and log operation instruction A indicates that the target log a is written at the first storage address address1, and log operation instruction B indicates that the target log b is written at the first storage address address2. After converting the first storage address address1, the second storage address address3 is obtained, and after converting the first storage address address2, the second storage address address4 is obtained. If the second storage address address3 and the second storage address address4 are continuous storage addresses, the target log a and the target log b can be written into the log memory at one time. Compared with writing the target log a and the target log b into the log storage in batches, this merged writing method can greatly reduce the number of erasures and writes of the log memory, thereby extending the service life of the log memory.

[0063] In some embodiments, considering that the log memory is a non-volatile memory, reading and writing data in the log memory is relatively slow, therefore, the log operation instruction can also be cached in the first cache area, and the log in the log memory can be cached in the second cache area. The first cache area and the second cache area can be different memory areas. The above operation target log based on the second storage address can include: According to the second conversion logic, convert the second storage address to the third storage address, where the third storage address is the storage address of the target log in the second buffer; Operate on the target log in the second buffer according to the third storage address.

[0064] Since the second buffer can be memory, the speed of reading and writing logs from the second buffer can be much higher than that of reading and writing logs from the log memory. In this way, the log reading and writing efficiency can be improved.

[0065] Specifically, when the operation type represented by the log operation instruction is a read operation, after reading the target log from the second buffer, the corresponding log operation instruction in the first buffer can be deleted. In this way, repeated execution of the log operation instruction can be avoided.

[0066] When the operation type represented by the log operation instruction is a write operation, when writing the target log in the second buffer, the target log can be written in the log memory at the same time. In this way, the data in the log memory and the second buffer can be unified. After the write operation of the target log is completed in the second buffer and the log memory, the corresponding log operation instruction in the first buffer can be deleted. In this way, repeated execution of the log operation instruction can be avoided.

[0067] In some embodiments, when writing the target log in the second buffer, the above-mentioned writing the target log in the log memory may include: When the number of log operation instructions cached in the first buffer reaches the quantity threshold, if there are multiple log operation instructions indicating that the operation type is a write operation, and the second storage addresses of the target logs indicated by the multiple log operation instructions are consecutive storage addresses, then batch write the target logs indicated by the multiple log operation instructions in the log memory.

[0068] The principle of batch operation is similar to the above-related description and will not be elaborated here.

[0069] In some embodiments, during the process of caching the logs in the log memory to the second buffer, if a log operation instruction sent by the target system is received, before the caching operation is completed, do not operate on the target log indicated by the log operation instruction in the second buffer. In this way, hardware conflicts and data conflict problems caused by operating logs at the same storage address are avoided.

[0070] In some embodiments, before operating on the target log indicated by the log operation instruction in the log memory, the method of the present application further includes: Determine whether there is a log operation in progress in the log memory. If so, before the log operation in progress is completed, do not operate on the target log indicated by the log operation instruction in the log memory. In this way, hardware conflicts and data conflicts caused by performing log operations at the same storage address are avoided.

[0071] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.

[0072] The embodiments of the present application also provide a log operation device. Referring to Figure 5 , it is a schematic diagram of the modules of the log operation device provided in some embodiments of the present application. Figure 5 In The instruction receiving module 501 is configured to receive a log operation instruction sent by a target system. The log operation instruction is used to indicate the target log to be operated by the target system and the first storage address of the target log. The target log is the log generated by the target system, and the first storage address is the storage address planned by the target system for the target log; The address conversion module 502 is configured to convert the first storage address into a second storage address according to the first conversion logic. The second storage address is the storage address planned by the baseboard management control system for the target log. The baseboard management control system is used to operate and manage the logs of at least one target system; The log operation module 503 is configured to operate on the target log according to the second storage address.

[0073] In some embodiments, the logs of at least one target system are stored in the log memory; Before receiving the log operation instruction, the instruction receiving module 501 is further configured to: In the log memory, divide a log storage partition for each target system. The log storage partition includes a partition header, and the partition header represents the partition range of each log storage partition and the target system corresponding to each log storage partition. Each log storage partition is used to store the logs of the corresponding target system, and the second storage address is the storage address of the target log in the log memory.

[0074] In some embodiments, the first storage address includes the first offset address of the target log; specifically, the address conversion module 502 is configured to: Convert the first offset address into a second offset address according to the first conversion logic; Based on the partition header, find the target log storage partition corresponding to the target system; Obtain a second storage address based on the base address of the target log storage partition and the second offset address.

[0075] In some embodiments, the partition header includes a partition table identifier and a partition name; the address conversion module 502 is specifically configured to: Based on the partition table identifier in the partition header, look up the partition table, where the partition table includes the partition sizes and starting addresses of each log storage partition; Based on the partition table, determine the partition ranges of each log storage partition; Based on the partition ranges of each log storage partition and the partition name in the partition header, determine the target log storage partition.

[0076] In some embodiments, the partition header includes the partition size, starting address, and partition name of the log storage partition; the address conversion module 502 is specifically configured to: Based on the partition size and starting address in the partition header, determine the partition ranges of each log storage partition; Based on the partition ranges of each log storage partition and the partition name in the partition header, determine the target log storage partition.

[0077] In some embodiments, the log operation instruction is further used to indicate the operation type to be performed on the target log; After receiving the log operation instruction sent by the target system, the log operation module 503 is specifically configured to: Cache the log operation instruction in the first buffer; When the number of log operation instructions cached in the first buffer reaches the quantity threshold, batch-operate on the target logs indicated by the log operation instructions in the log memory according to the operation types indicated by each log operation instruction.

[0078] In some embodiments, the log operation module 503 is specifically configured to In the first buffer, if there are multiple log operation instructions indicating the same operation type, and the second storage addresses of the target logs indicated by the multiple log operation instructions are consecutive storage addresses, batch-operate on the target logs indicated by the multiple log operation instructions in the log memory.

[0079] In some embodiments, the instruction receiving module 501 is further used to: Cache the log operation instruction in the first buffer, and cache the logs in the log memory in the second buffer; The log operation module 503 is specifically configured to: According to the second conversion logic, convert the second storage address into a third storage address, where the third storage address is the storage address of the target log in the second buffer; Operate on the target log in the second buffer according to the third storage address.

[0080] In some embodiments, the log operation instruction further characterizes the operation type to be performed on the target log, and the operation type includes a read operation and a write operation; the log operation module 503 is further configured to: If the operation type is a write operation, when writing the target log in the second buffer, write the target log in the log memory.

[0081] In some embodiments, the log operation module 503 is specifically configured to: When the number of log operation instructions cached in the first buffer reaches the quantity threshold, if there are multiple log operation instructions indicating that the operation type is a write operation and the second storage addresses of the target logs indicated by the multiple log operation instructions are consecutive storage addresses, then batch-write the target logs indicated by the multiple log operation instructions in the log memory.

[0082] In some embodiments, the log operation module 503 is further configured to: During the process of caching the logs in the log memory to the second buffer, if a log operation instruction sent by the target system is received, before the caching operation is completed, do not operate on the target log indicated by the log operation instruction in the second buffer.

[0083] In some embodiments, before operating on the target log indicated by the log operation instruction in the log memory, the log operation module 503 is further configured to: Determine whether there is a log operation in progress in the log memory. If so, before the log operation in progress is completed, do not operate on the target log indicated by the log operation instruction in the log memory.

[0084] For the description of the features in the corresponding embodiments of the log operation device, reference can be made to the relevant descriptions in the corresponding embodiments of the log operation method, which will not be elaborated here one by one.

[0085] With reference to Figure 6 , an embodiment of the present application further provides an electronic device, including a memory 10 and a processor 20. A computer program is stored in the memory 10, and the processor 20 is configured to run the computer program to execute the steps in any one of the above embodiments of the log operation method.

[0086] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the above embodiments of the log operation method when running.

[0087] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disks, magnetic disks, or optical discs.

[0088] An embodiment of the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above-described embodiments of the log operation method are implemented.

[0089] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-described embodiments of the log operation method are implemented.

[0090] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0091] The above has introduced in detail a log operation method, device, storage medium, and program product provided by the present application. Specific examples are used herein to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

Claims

1. A log operation method, characterized in that, The method includes: Receiving a log operation instruction sent by a target system, where the log operation instruction is used to indicate a target log to be operated by the target system and a first storage address of the target log. The target log is a log generated by the target system, and the first storage address is a storage address planned by the target system for the target log; Converting the first storage address to a second storage address according to a first conversion logic. The second storage address is a storage address planned by a baseboard management control system for the target log. The baseboard management control system is used to operate and manage the logs of at least one target system; Operating the target log according to the second storage address.

2. The method according to claim 1, wherein The logs of the at least one target system are stored in a log memory; Before receiving the log operation instruction, the method further includes: In the log memory, dividing a log storage partition for each target system. The log storage partition includes a partition header, and the partition header represents the partition range of each log storage partition and the target system corresponding to each log storage partition. Each log storage partition is used to store the logs of the corresponding target system, and the second storage address is the storage address of the target log in the log memory.

3. The method according to claim 2, wherein The first storage address includes a first offset address of the target log; The converting the first storage address to a second storage address according to the first conversion logic includes: Converting the first offset address to a second offset address according to the first conversion logic; Based on the partition header, searching for the target log storage partition corresponding to the target system; Based on the base address of the target log storage partition and the second offset address, obtaining the second storage address.

4. The method according to claim 3, wherein The partition header includes a partition table identifier and a partition name; The searching for the target log storage partition corresponding to the target system based on the partition header includes: Based on the partition table identifier in the partition header, searching for a partition table, where the partition table includes the partition size and start address of each log storage partition; Based on the partition table, determining the partition range of each log storage partition; Based on the partition range of each log storage partition and the partition name in the partition header, determining the target log storage partition.

5. The method according to claim 3, wherein The partition header includes the partition size, start address, and partition name of the log storage partition; The searching for the target log storage partition corresponding to the target system based on the partition header includes: Based on the partition size and start address in the partition header, determining the partition range of each log storage partition; Based on the partition range of each log storage partition and the partition name in the partition header, determining the target log storage partition.

6. The method according to claim 2, characterized in that, The log operation instruction is further used to indicate the operation type to be performed on the target log; After receiving the log operation instruction sent by the target system, the method further includes: Caching the log operation instruction in a first buffer; When the number of log operation instructions cached in the first buffer reaches the quantity threshold, batch-operate on the target logs indicated by the log operation instructions in the log memory according to the operation types indicated by each of the log operation instructions.

7. The method according to claim 6, wherein The batch-operating on the target logs indicated by the log operation instructions in the log memory includes: In the first buffer, if there are multiple log operation instructions indicating the same operation type and the second storage addresses of the target logs indicated by the multiple log operation instructions are consecutive storage addresses, batch-operate on the target logs indicated by the multiple log operation instructions in the log memory.

8. The method according to claim 2, wherein The method further includes: Caching the log operation instructions in the first buffer and caching the logs in the log memory in the second buffer; The operating on the target logs according to the second storage address includes: Converting the second storage address into a third storage address according to a second conversion logic, where the third storage address is the storage address of the target log in the second buffer; Operating on the target log in the second buffer according to the third storage address.

9. The method according to claim 8, wherein The log operation instruction also represents the operation type to be performed on the target log, and the operation type includes a read operation and a write operation; The method further includes: If the operation type is a write operation, then when writing the target log in the second buffer, write the target log in the log memory.

10. The method according to claim 9, characterized in that, The writing the target log in the log memory includes: When the number of log operation instructions cached in the first buffer reaches the quantity threshold, if there are multiple log operation instructions indicating that the operation types are all write operations and the second storage addresses of the target logs indicated by the multiple log operation instructions are consecutive storage addresses, batch-write the target logs indicated by the multiple log operation instructions in the log memory.

11. The method according to claim 8, wherein The method further includes: During the process of caching the logs in the log memory into the second buffer, if receiving the log operation instruction sent by the target system, do not operate on the target log indicated by the log operation instruction in the second buffer before the caching operation is completed.

12. The method according to any one of claims 6, 7, 9, and 10, characterized in that, Before operating on the target log indicated by the log operation instruction in the log memory, the method further includes: Judging whether there is a log operation in execution in the log memory. If so, do not operate on the target log indicated by the log operation instruction in the log memory before the log operation in execution is completed.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method as described in any one of claims 1 to 12 is implemented.

14. An electronic device, characterized in that, The electronic device includes a processor and a memory. The memory is used to store a computer program, and when the computer program is executed by the processor, the method as described in any one of claims 1 to 12 is implemented.

15. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, the method as described in any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Storage device log generation method and storage device thereof

    CN112765006A

  • Log data processing method and device

    CN115470066A

  • Serial port information monitoring method and system based on BMC, terminal and storage medium

    CN116204383A

  • Server log storage method and device, storage medium and electronic device

    CN116662285A