Log record storage method and device, electronic equipment and storage medium
By storing the location of log records according to the log level in the serial interface extender, the problem of overwritten fault logging in the existing technology is solved, simplifying log parsing and timely solving faults to avoid losses.
Patent Information
- Application Number
- CN202510629702.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-08-15
AI Technical Summary
The prior art cannot effectively find overwritten fault logging, and complex log parsing tools are required to develop.
By setting different memory areas in the extender of the serial interface to store log records at different log levels, the storage location is determined based on the severity of the log level, including the first memory area and the second memory area, ensuring that high-level log records are stored and retained in a timely manner.
It realizes logging of the severity of the failure when the log level is known, avoiding losses, and simplifying the log parsing process.
Smart Images

Figure CN120492207A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of storage devices, and in particular to a log record storage method, device, electronic device, and storage medium. Background Art
[0002] As a connection device between the controller and the hard drive, the serial interface expander can function as both a relay device and a management device. Since all interactions between the controller and the hard drive occur through the serial interface expander, any faults that occur during this interaction can be recorded through the serial interface expander.
[0003] Currently, there are two ways to record faults through a serial interface expander. Specifically, the first method can be to allocate a section of memory when initializing the serial interface expander, record logs and define log levels at key locations in the code, and then record the logs in memory, appending them one by one and looping over them. The second method is to register important variable data in the program with a log collection module. When an anomaly is detected, the variables of the program are recorded in the log collection module according to the format of the address storage. However, due to the loop overwriting of log records, the above method cannot find the overwritten fault log records, and requires the development of a relatively complex log parsing tool.
[0004] Therefore, there is an urgent need for a log record storage method that can find log records related to faults in a timely manner and use simpler log parsing tools. Summary of the Invention
[0005] The present application provides a log record storage method, device, electronic device and storage medium to at least solve the problem in the related art that overwritten fault log records cannot be found and that relatively complex log parsing tools need to be developed.
[0006] This application provides a log record storage method, the method comprising:
[0007] In response to a startup operation of the serial interface expander, executing an operating operation of a system associated with the serial interface expander; wherein the system includes at least one subsystem;
[0008] Obtaining at least one log record of the running operation of the at least one subsystem and at least one log level corresponding to the at least one log record; wherein the log level is used to indicate whether there is a fault in the log record or the severity of the existing fault;
[0009] If the log level is not greater than the preset level, storing the log record in the first memory area;
[0010] If the log level is greater than the preset level, the log record is stored in the first memory area and the second memory area.
[0011] The present application also provides a log record storage device, the device comprising:
[0012] An execution module, configured to execute, in response to a startup operation of the serial interface expander, an operation of a system associated with the serial interface expander; wherein the system includes at least one subsystem;
[0013] an acquisition module, configured to acquire at least one log record of the operation of the at least one subsystem and at least one log level corresponding to the at least one log record; wherein the log level is used to indicate whether there is a fault in the log record or the severity of the existing fault;
[0014] A first storage module, configured to store the log record in a first memory area if the log level is not greater than a preset level;
[0015] The second storage module is configured to store the log record in the first memory area and the second memory area if the log level is greater than the preset level.
[0016] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned log record storage methods when executing the computer program.
[0017] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned log record storage methods are implemented.
[0018] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned log record storage methods when the computer program is executed by a processor.
[0019] By the present application, after starting the expander of the serial interface, the operation of the system associated with the expander of the serial interface is performed. Then, at least one log record of the operation of the at least one subsystem and at least one log level corresponding to the at least one log record are obtained. If the log level is not greater than the preset level, the log record is stored in the first memory area. If the log level is greater than the preset level, the log record is stored in the first memory area and the second memory area. By adopting the present technical solution, since the log records corresponding to different log levels are stored in different locations, it is possible to find the log records related to the corresponding fault severity in a timely manner when the log level is known, and then the fault can be solved in time according to the log record to avoid loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0021] Figure 1 A schematic diagram of the structure of a control cabinet provided in an embodiment of the present application;
[0022] Figure 2 A flowchart of a log record storage method provided in an embodiment of the present application;
[0023] Figure 3 A flowchart of a log record storage method provided in an embodiment of the present application;
[0024] Figure 4 A schematic diagram of the structure of a log recording storage device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0026] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0027] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0028] The specific hardware architecture that the log record storage method relies on is described here. Figure 1 The schematic diagram of the structure of a control cabinet is shown in FIG. Figure 1 It can be seen that the controller system is connected to the serial interface controller, and the serial interface controller is connected to the serial interface expander. The serial interface expander is connected to multiple hard disks. Specifically, the serial interface controller and the serial interface expander communicate via the SAS protocol standard. The serial interface expander is connected to the system, which includes at least one subsystem. Among them, the serial interface expander can be expanded through multiple physical layer interfaces, and can expand the limited interface to more hard disks. Furthermore, the serial interface expander triggers link reset or path switching when it monitors physical layer interface errors, link interruptions or protocol timeouts. The serial interface expander can also collect information such as the hard disk's in-place status, temperature, voltage, link status, etc., and report it to the controller system through a preset command channel.
[0029] Currently, serial interface expanders support multiple physical layer interfaces, each of which has multiple independent registers. When an abnormal situation occurs, such as a hard drive in place but a disconnected link, a CRC error count, or an invalid Dword count, a single physical layer interface records a large amount of information. Furthermore, link control instructions originate from multiple sources, so when a link anomaly occurs, a large amount of information needs to be recorded at each layer. For the protocol stack and multiple threads, if a controller system instruction timeout occurs, it is necessary to record the corresponding state machine's abnormal information.
[0030] The embodiment of the present application provides a method for storing log records. For details, please refer to Figure 2 A flow chart of a log record storage method is shown. The steps are as follows:
[0031] S201. In response to a startup operation of a serial interface expander, execute an operation of a system associated with the serial interface expander; wherein the system includes at least one subsystem.
[0032] In one example, a new log subsystem is first created in the storage space of the expander of the serial interface, which is mainly used to store the log records of each subsystem. Wherein, each subsystem can be a temperature acquisition subsystem, a serial small computer system interface (Serial Attached Small Computer System Interface, abbreviated as SAS) transmission subsystem and a dual-control synchronization subsystem. Wherein, the temperature acquisition subsystem includes a temperature alarm module, a temperature acquisition module and a driver module. The SAS transmission subsystem includes an expander transmission layer module, a port layer module, a link layer module, a physical layer interface module and a physical layer interface fault detection module of the serial interface. The dual-control synchronization subsystem includes a synchronous transmission application, a synchronous transmission module and a transmission interface driver module.
[0033] In this embodiment, the system associated with the serial interface expander includes the above subsystems and may also include other subsystems, which are not limited here.
[0034] In this embodiment, after the serial interface expander is started, the operation of each of the above subsystems is executed.
[0035] S202. Obtain at least one log record of an operation of at least one subsystem and at least one log level corresponding to the at least one log record; wherein the log level is used to indicate whether there is a fault in the log record or the severity of the existing fault.
[0036] In one example, at least one subsystem generates log records during operation, and different log records correspond to different log levels, wherein the log level is used to indicate whether a fault exists in the log record or the severity of the fault.
[0037] In one example, the log levels include a no-fault level, a debug level, a message level, a warning level, an error level, and a fatal level; wherein the no-fault level is used to characterize that there is no fault in the log record; the debug level is used to characterize that the data information in the log record is in a state to be debugged; the message level is used to characterize that the data information in the log record is notification information or indication information; the warning level is used to characterize that the data information in the log record is abnormal information, but the data information does not affect the operation of the subsystem; the error level is used to characterize that the data information in the log record is abnormal information and the data information affects the operation of the subsystem; the fatal level is used to characterize that the data information in the log record is abnormal information and the data information affects the operation of at least one subsystem; the preset level is the debug level.
[0038] Among them, the severity of the log level fault is sorted as follows: no fault level < debug level < message level < warning level < error level < fatal level.
[0039] In this embodiment, debug-level logging can include the processing flows and interactions between different subsystems, threads, and functional modules, as well as the contents of data packets sent and received by preset commands, internal state machine changes, and low-level protocol interaction details. It can also include changes in the normal range of chassis management detection, temperature changes, and fan speed changes. Message-level logging can include link rate negotiation completion, firmware boot success, hard drive hot-swap event detection, device presence signal changes caused by plugging and unplugging, physical layer interface link connection / disconnection, and main program control instructions. Main program control instructions can include Inquiry instructions, TestUnitReady instructions, firmware upgrade instructions, port kick instructions, LunReset and PhyReset instructions, etc. Warning-level logging can include chassis management detection of temperature, voltage, exceeding alarm thresholds, occasional CRC errors, occasional changes in the change_count of the physical layer interface link, SSP protocol timeouts, etc. Error-level logging can include physical layer interface link interruption when the hard drive is in place, persistent CRC errors, routing table update failures, and hard drive response timeouts. Hardware failures (such as power supply anomalies, power supply level anomalies, firmware crashes), simultaneous failure of multiple physical layer interface ports, and SAS address conflicts. Fatal-level logging can include firmware fatal assertion failures, critical memory overflows causing serial interface expander restarts, firmware version information, and fault types, such as firmware exceptions, stack overflows, and single MIPS processor executions. Other logging options include MIPS coprocessor information, such as the EPC (address at the time of the exception), the Exception Code in the Cause register, stack information at the time of the exception (locating the function that caused the exception), system-level thread information, memory pool information, and ISR interrupt context information.
[0040] S203: If the log level is not greater than the preset level, store the log record in the first memory area.
[0041] In one example, log records corresponding to different log levels need to be stored in different storage areas. The preset level is a debug level, that is, a log level no greater than the preset level indicates that the log level is a fault-free level or a debug level. The first memory area is used to store at least one log record generated by at least one subsystem during operation.
[0042] S204: If the log level is greater than the preset level, the log record is stored in the first memory area and the second memory area.
[0043] In one example, the first memory area is used to store at least one log record generated during the operation of at least one subsystem; the second memory area is used to store at least one log record to be retained. In this embodiment, the first memory area is used to temporarily store log records, and the at least one log record stored in the second memory area is a log record for subsequent use.
[0044] The present application provides a method for storing log records, which, after starting the expander of the serial interface, executes the operating operation of the system associated with the expander of the serial interface. Then, at least one log record of the operating operation of at least one subsystem and at least one log level corresponding to the at least one log record are obtained, and if the log level is not greater than the preset level, the log record is stored in the first memory area. If the log level is greater than the preset level, the log record is stored in the first memory area and the second memory area. With the present technical solution, since the log records corresponding to different log levels are stored in different locations, it is possible to find the log records related to the corresponding fault severity in a timely manner when the log level is known, and then the fault can be solved in a timely manner according to the log record to avoid loss.
[0045] The embodiment of the present application provides a method for storing log records. For details, please refer to Figure 3 A flow chart of a log record storage method is shown. The steps are as follows:
[0046] S301. In response to a startup operation of a serial interface expander, execute an operation of a system associated with the serial interface expander; wherein the system includes at least one subsystem.
[0047] In one example, this step can refer to the content of step S201 and will not be repeated here.
[0048] S302. Obtain at least one log record of an operation of at least one subsystem and at least one log level corresponding to the at least one log record; wherein the log level is used to indicate whether there is a fault in the log record or the severity of the existing fault.
[0049] In one example, the log levels include a no-failure level, a debug level, a message level, a warning level, an error level, and a fatal level.
[0050] S303: If the log level is a fault-free level or a debugging level, store the log record in a first memory area; wherein the first memory area is used to store at least one log record generated by at least one subsystem during operation.
[0051] In one example, the first memory area may be a LogDetailBuffer. The specific space may be 128KB, and there may be two such areas, each acting as a primary and backup for the other. In this embodiment, if the log level is debug, the log record is stored in the first memory area. Specifically, the log record may be stored in first memory area A. Once first memory area A is full, the log record is stored in first memory area B.
[0052] S304. If the log level is a message level or a warning level, the log record is stored in the first memory area and synchronously stored in the second memory area; wherein the first memory area is used to store at least one log record generated by at least one subsystem during the operation process; the second memory area is used to store at least one log record to be retained.
[0053] In one example, the second memory area may be a LogRecordBuffer. Specifically, the second memory area may be 16KB, and the number may be two, each serving as a primary and backup for the other. In this embodiment, if the log level is a message level or a warning level, the log record is stored in the LogDetailBuffer and synchronously stored in the LogRecordBuffer.
[0054] S305. If the log level is an error level, store the log record in the first memory area; traverse the historical log records in the first memory area, and determine the associated historical log records from the historical log records; wherein the associated historical log records are used to represent the historical log records of the subsystem where the log record corresponding to the error level is located and the historical log records of other subsystems; wherein the other subsystems are subsystems associated with the subsystem; obtain the log record corresponding to the error level from the register list corresponding to the subsystem; store the associated historical log record and the log record in the second memory area, and synchronously store the associated historical log record and the log record in the first memory.
[0055] In one example, if the log level is an error level, after the log record is stored in the first memory area, the historical log records in the first memory area are first traversed. The advantage of this setting is to capture detailed information related to the fault before the fault occurs. Specifically, the associated historical log records are determined from the historical log records, wherein the associated historical log records are log records of multiple subsystems. The advantage of this setting is that the subsystem that fails may be caused by the failure of the previous subsystem associated with the subsystem, and therefore, the log records of multiple subsystems need to be captured.
[0056] In this embodiment, the log record corresponding to the error level is obtained from the register list corresponding to the subsystem. The advantage of this setting is that the current log record process is obtained from the register. Then the associated historical log record and the log record are stored in LogRecordBuffer, and the associated historical log record and the log record are synchronously stored in the first memory. The first memory can be logFlash. Specifically, there can be two first memories, and the space can be 128KB, defined as LogFlash1 and LogFlash2, and the two first memories are primary and backup to each other. First, LogFlash1 is the primary and LogFlash2 is the backup. Log records are recorded in LogFlash1. When LogFlash1 is full, it becomes the backup. At this time, LogFlash2 is the primary, and log records are recorded in LogFlash2 as the primary. When LogFlash2 is full, it becomes the backup. Log records are then written in LogFlash1, and so on.
[0057] In one example, after synchronously storing the associated historical log record and the log record in the first memory, the method further includes:
[0058] A first abnormal state associated with a historical log record and a second abnormal state associated with the log record are obtained, and the first abnormal state and the second abnormal state are sent to a controller system; wherein the controller system is electrically connected to an expander of a serial interface.
[0059] In one example, the system queries the associated historical log records for any abnormal conditions. If so, it determines the condition as a first abnormal condition. The system then queries the log records for any abnormal conditions. If so, it determines the condition as a second abnormal condition. The first and second abnormal conditions are then sent to the controller system. This arrangement provides the advantage of promptly sending serious faults to the controller system, enabling it to address them promptly.
[0060] S306. If the log level is a fatal level, store the log record in the first memory area; traverse the historical log records in the first memory area, and determine the associated historical log records from the historical log records; wherein the associated historical log records are used to represent the historical log records of the subsystem where the log record corresponding to the error level is located and the historical log records of other subsystems; wherein the other subsystems are subsystems associated with the subsystem; obtain the log record corresponding to the error level from the register list corresponding to the subsystem; store the associated historical log record and the log record in the second memory area, and synchronously store the associated historical log record and the log record in the first memory; in response to the preset instruction information, store the associated historical log record and the log record in the second memory.
[0061] In one example, if the log level is a fatal level, after the log record is stored in the first memory area, the historical log records in the first memory area are first traversed. The advantage of this setting is to capture detailed information related to the fault before the fault occurs. Specifically, the associated historical log records are determined from the historical log records, wherein the associated historical log records are log records of multiple subsystems. The advantage of this setting is that the subsystem that fails may be caused by the failure of the previous subsystem associated with the subsystem, and therefore, the log records of multiple subsystems need to be captured.
[0062] In this embodiment, the log record corresponding to the error level is obtained from the register list corresponding to the subsystem. This configuration has the advantage of obtaining the current logging process from the register. The associated historical log record and the log record are then stored in the LogRecordBuffer, and the associated historical log record and the log record are synchronously stored in the first memory. The first memory can be logFlash.
[0063] Specifically, there can be two first memories, each with a space of 128KB, defined as LogFlash1 and LogFlash2. The two first memories are mutually primary and backup. LogFlash1 is the primary and LogFlash2 is the backup. Log records are stored in LogFlash1. When LogFlash1 is full, it becomes the backup. At this time, LogFlash2 is the primary. Log records are stored in LogFlash2, which is the primary. When LogFlash2 is full, it becomes the backup. Log records are then written to LogFlash1, and so on. When a LogFlash1 is full or a fatal level is written to LogFlash2, various CLI instructions are executed and information (global information of all PHYs, all hard disks, all ports, and all systems) is written to the second memory, and then the controller system is notified to read the log records.
[0064] In one example, the serial interface expander reports a full status to the controller system (BMC connected via an external interface, or a storage master connected via a SAS internal interface). Upon receiving the full status indication, the controller system triggers log collection, reading data from the serial interface expander into the first and second memories. The data is recorded in separate bin files. If the controller system is unable to collect data, LogFlash1 is written after it is full, and then LogFlash2 is written. Once LogFlash2 is full, LogFlash1 is erased, and then LogFlash1 is written again, repeating the cycle.
[0065] In this embodiment, the storage format of the log record includes multiple elements, wherein the elements include a timestamp, a subsystem ID, a log level, a log content, the number of parameters, and the values of each parameter. The log content can be a visual plaintext string format. Specifically, the string of each log record can be extracted, and then the corresponding string can be converted into an enumeration variable. The timestamp can be two int types. The advantage of this setting is that the amount of data occupied by the log record can be compressed, the format of the log record can be optimized, the original visual {string + parameter} format can be adjusted to the {enumeration number of the string + parameter} format, and a parsing tool for log records under a general platform can be provided.
[0066] For a clearer explanation, please refer to the storage format of the log records shown below.
[0067] Table 1 Storage format of log records without parameters
[0068]
[0069] Table 2 Storage format of a parameter log record
[0070]
[0071] Table 3 Storage format of log records of two parameters
[0072]
[0073] The present application provides a method for storing log records, which performs different storage methods depending on whether the log level of the log record is a fault-free level, a debug level, a message level, a warning level, an error level, or a fatal level. Using this technical solution, log records of all levels are first efficiently recorded in a first memory area. When there are high-level log records, the relevant data that needs to be permanently recorded in the memory is dynamically filtered according to the log level. Through the cached data, information before and after the fault occurs is recorded; this information can include the process before and after the fault occurs, and can directly locate the problem.
[0074] The embodiment of the present application provides a storage device for log records. For details, please refer to Figure 4 FIG. 4 is a schematic diagram of a log storage device, wherein the device 40 includes:
[0075] An execution module 401 is configured to execute an operation of a system associated with the serial interface expander in response to a startup operation of the serial interface expander; wherein the system includes at least one subsystem;
[0076] An acquisition module 402 is configured to acquire at least one log record of an operation of at least one subsystem and at least one log level corresponding to the at least one log record; wherein the log level is used to indicate whether a fault exists in the log record or the severity of the fault.
[0077] The first storage module 403 is configured to store the log record in the first memory area if the log level is not greater than the preset level;
[0078] The second storage module 404 is configured to store the log record in the first memory area and the second memory area if the log level is greater than a preset level.
[0079] In one example, the log levels include a no-fault level, a debug level, a message level, a warning level, an error level, and a fatal level; wherein the no-fault level is used to characterize that there is no fault in the log record; the debug level is used to characterize that the data information in the log record is in a state to be debugged; the message level is used to characterize that the data information in the log record is notification information or indication information; the warning level is used to characterize that the data information in the log record is abnormal information, but the data information does not affect the operation of the subsystem; the error level is used to characterize that the data information in the log record is abnormal information and the data information affects the operation of the subsystem; the fatal level is used to characterize that the data information in the log record is abnormal information and the data information affects the operation of at least one subsystem; the preset level is the debug level.
[0080] In one example, if the log level is a fault-free level or a debugging level, the first storage module 403 is configured to:
[0081] The log record is stored in a first memory area; wherein the first memory area is used to store at least one log record generated during the operation of at least one subsystem.
[0082] In one example, if the log level is a message level or a warning level, the second storage module 404 is configured to:
[0083] The log records are stored in a first memory area and synchronously stored in a second memory area; wherein the first memory area is used to store at least one log record generated by at least one subsystem during operation; and the second memory area is used to store at least one log record to be retained.
[0084] In one example, if the log level is an error level, the second storage module 404 is configured to:
[0085] Storing the log record in the first memory area;
[0086] Traversing the historical log records in the first memory area, and determining associated historical log records from the historical log records; wherein the associated historical log records are used to represent historical log records of the subsystem where the log record corresponding to the error level is located and historical log records of other subsystems; wherein the other subsystems are subsystems associated with the subsystem;
[0087] Get the log record corresponding to the error level from the register list corresponding to the subsystem;
[0088] The associated historical log record and the log record are stored in the second memory area, and the associated historical log record and the log record are synchronously stored in the first memory.
[0089] In one example, after synchronously storing the associated historical log record and the log record in the first memory, the apparatus 40 further includes:
[0090] The sending module 405 is used to:
[0091] A first abnormal state associated with a historical log record and a second abnormal state associated with the log record are obtained, and the first abnormal state and the second abnormal state are sent to a controller system; wherein the controller system is electrically connected to an expander of a serial interface.
[0092] In one example, if the log level is a fatal level, the second storage module 404 is configured to:
[0093] Storing the log record in the first memory area;
[0094] Traversing the historical log records in the first memory area, and determining associated historical log records from the historical log records; wherein the associated historical log records are used to represent historical log records of the subsystem where the log record corresponding to the error level is located and historical log records of other subsystems; wherein the other subsystems are subsystems associated with the subsystem;
[0095] Get the log record corresponding to the error level from the register list corresponding to the subsystem;
[0096] storing the associated historical log record and the log record in the second memory area, and synchronously storing the associated historical log record and the log record in the first memory;
[0097] In response to the preset instruction information, the associated history log record and the log record are stored in the second memory.
[0098] For the description of the features in the embodiment corresponding to a log record storage device, please refer to the relevant description of the embodiment corresponding to the log record storage method, which will not be repeated here.
[0099] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned log record storage method embodiments.
[0100] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned log record storage method embodiments when running.
[0101] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0102] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned log record storage method embodiments are implemented.
[0103] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein 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-mentioned log record storage method embodiments are implemented.
[0104] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0105] The above is a detailed introduction to a log record storage method provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A method for storing log records, characterized in that: The method comprises: In response to a startup operation of the serial interface expander, executing an operating operation of a system associated with the serial interface expander; wherein the system includes at least one subsystem; Obtaining at least one log record of the running operation of the at least one subsystem and at least one log level corresponding to the at least one log record; wherein the log level is used to indicate whether there is a fault in the log record or the severity of the existing fault; If the log level is not greater than the preset level, storing the log record in the first memory area; If the log level is greater than the preset level, the log record is stored in the first memory area and the second memory area.
2. The method according to claim 1, characterized in that The log levels include a fault-free level, a debug level, a message level, a warning level, an error level, and a fatal level; wherein the fault-free level is used to characterize that there is no fault in the log record; the debug level is used to characterize that the data information in the log record is in a state to be debugged; the message level is used to characterize that the data information in the log record is notification information or indication information; the warning level is used to characterize that the data information in the log record is abnormal information, but the data information does not affect the operation of the subsystem; the error level is used to characterize that the data information in the log record is abnormal information and the data information affects the operation of the subsystem; the fatal level is used to characterize that the data information in the log record is abnormal information and the data information affects the operation of at least one subsystem; the preset level is the debug level.
3. The method according to claim 2, characterized in that If the log level is the fault-free level or the debugging level, and if the log level is not greater than a preset level, storing the log record in the first memory area includes: The log record is stored in the first memory area; wherein the first memory area is used to store the at least one log record generated by the at least one subsystem during operation.
4. The method according to claim 2, characterized in that If the log level is the message level or the warning level, and if the log level is greater than the preset level, storing the log record in the first memory area and the second memory area includes: The log record is stored in the first memory area and synchronously stored in the second memory area; wherein the first memory area is used to store the at least one log record generated by the at least one subsystem during the operation process; the second memory area is used to store the at least one log record to be retained.
5. The method according to claim 2, characterized in that If the log level is the error level, and if the log level is greater than the preset level, storing the log record in the first memory area and the second memory area includes: Storing the log record in the first memory area; Traversing the historical log records in the first memory area, and determining associated historical log records from the historical log records; wherein the associated historical log records are used to represent historical log records of the subsystem where the log record corresponding to the error level is located and historical log records of other subsystems; wherein the other subsystems are subsystems associated with the subsystem; Obtain the log record corresponding to the error level from the register list corresponding to the subsystem; The associated history log record and the log record are stored in a second memory area, and the associated history log record and the log record are synchronously stored in a first memory.
6. The method according to claim 5, characterized in that After synchronously storing the associated historical log record and the log record in the first memory, the method further includes: Acquire a first abnormal state of the associated historical log record and a second abnormal state of the log record, and send the first abnormal state and the second abnormal state to a controller system; wherein the controller system is electrically connected to the expander of the serial interface.
7. The method according to claim 2, characterized in that If the log level is the fatal level, and if the log level is greater than the preset level, storing the log record in the first memory area and the second memory area includes: Storing the log record in the first memory area; Traversing the historical log records in the first memory area, and determining associated historical log records from the historical log records; wherein the associated historical log records are used to represent historical log records of the subsystem where the log record corresponding to the error level is located and historical log records of other subsystems; wherein the other subsystems are subsystems associated with the subsystem; Obtain the log record corresponding to the error level from the register list corresponding to the subsystem; storing the associated history log record and the log record in a second memory area, and synchronously storing the associated history log record and the log record in a first memory; In response to preset instruction information, the associated history log record and the log record are stored in a second memory.
8. A log storage device, characterized in that: The device comprises: An execution module, configured to execute, in response to a startup operation of the serial interface expander, an operation of a system associated with the serial interface expander; wherein the system includes at least one subsystem; an acquisition module, configured to acquire at least one log record of the operation of the at least one subsystem and at least one log level corresponding to the at least one log record; wherein the log level is used to indicate whether there is a fault in the log record or the severity of the existing fault; A first storage module, configured to store the log record in a first memory area if the log level is not greater than a preset level; The second storage module is configured to store the log record in the first memory area and the second memory area if the log level is greater than the preset level.
9. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.