Log storage method and device based on Flash, equipment and medium
By splitting logs into character fields and parameter fields, storing the parameter fields in Flash space, and using the address as an index value for compilation, the problem of low SSD log storage space utilization is solved, achieving more efficient storage and security.
Patent Information
- Application Number
- CN202410820037.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-10
AI Technical Summary
Existing SSD log storage methods suffer from low storage space utilization.
The log is split into a character field and a parameter field. The parameter field is stored in the Flash storage space. The storage address is obtained as an index value and mapped to the character field for compilation to obtain the executable file, which is then stored in the target storage area of the ELF file.
It effectively reduces the consumption of Flash storage space by log information, improves the utilization of storage space, and enhances log security, preventing log leakage.
Smart Images

Figure CN118626017A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a Flash-based log storage method, device, equipment and medium. Background Art
[0002] SSD (Solid State Drive) is a semiconductor-based storage device that typically uses NAND flash memory to store persistent data. It is now widely used in mobile terminals, servers, data centers and other occasions.
[0003] SSD generates a large number of logs during operation, which are mainly used to record the operation process and status of the SSD disk. However, the Flash space of the SSD disk is limited. As the number of logs increases, the Flash space of the SSD disk also decreases. Therefore, it is particularly important to store more logs in the limited Flash space.
[0004] Therefore, the existing SSD log storage method has the problem of low storage space utilization. Summary of the invention
[0005] The embodiments of the present invention provide a Flash-based log storage method, device, equipment and medium, aiming to solve the problem of low storage space utilization in the existing SSD log storage method.
[0006] In a first aspect, an embodiment of the present invention provides a Flash-based log storage method, the method comprising:
[0007] If a log storage instruction is detected, the corresponding log is obtained according to the log storage instruction;
[0008] Splitting the log into a character field and a parameter field, and storing the parameter field in a Flash storage space;
[0009] Obtaining a storage address of the parameter domain in the Flash storage space, and using the storage address as an index value of the parameter domain;
[0010] Mapping the storage address to the character domain, so as to use the storage address as an index value of the character domain;
[0011] The character domain is compiled to obtain a corresponding to-be-executed file, and the to-be-executed file is stored in a target storage area in an ELF file.
[0012] In a second aspect, an embodiment of the present invention further provides a Flash-based log storage device, the device comprising:
[0013] A first acquisition unit, configured to acquire a corresponding log according to the log storage instruction if a log storage instruction is detected;
[0014] A splitting unit, used for splitting the log into a character field and a parameter field, and storing the parameter field in a Flash storage space;
[0015] A second acquisition unit, configured to acquire a storage address of the parameter domain in the Flash storage space, and use the storage address as an index value of the parameter domain;
[0016] A mapping unit, used for mapping the storage address to the character domain, so as to use the storage address as an index value of the character domain;
[0017] The storage unit is used to compile the character domain to obtain a corresponding to-be-executed file, and store the to-be-executed file in a target storage area in the ELF file.
[0018] In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and wherein the program instructions, when executed by a processor, can implement the method described in the first aspect above.
[0020] The embodiment of the present invention provides a Flash-based log storage method, device, equipment and medium, the method comprising: if a log storage instruction is detected, then the corresponding log is obtained according to the log storage instruction; the log is split into a character domain and a parameter domain, and the parameter domain is stored in the Flash storage space; the storage address of the parameter domain in the Flash storage space is obtained, and the storage address is used as the index value of the parameter domain; the storage address is mapped to the character domain, so as to use the storage address as the index value of the character domain; the character domain is compiled to obtain the corresponding to-be-executed file, and the to-be-executed file is stored in the target storage area in the ELF file. The embodiment of the present invention can effectively reduce the consumption of the Flash storage space by the log information and improve the utilization rate of the Flash storage space by splitting the log into a character domain and a parameter domain, storing the parameter domain in the Flash storage space, and compiling the character domain to obtain the corresponding to-be-executed file. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of a Flash-based log storage method according to an embodiment of the present invention;
[0023] Figure 2 A schematic block diagram of a Flash-based log storage device provided by an embodiment of the present invention;
[0024] Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0027] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0028] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0029] See also Figure 1 , Figure 1A flow chart of a Flash-based log storage method provided by an embodiment of the present invention. The Flash-based log storage method is applied to a controller of an intelligent terminal, the controller is in communication connection with a solid-state drive (SSD), and the intelligent terminal can be an electronic device such as a tablet computer, a laptop computer, or a desktop computer.
[0030] Figure 1 The following is a flow chart of a Flash-based log storage method provided by an embodiment of the present invention. Figure 1 As shown, the method includes the following steps S110-S150.
[0031] S110: If a log storage instruction is detected, obtain a corresponding log according to the log storage instruction.
[0032] In this embodiment, the solid-state hard disk generates a large number of logs during operation. The logs are mainly used to record the operation process and status of the solid-state hard disk. If a log storage instruction is detected, at least one log is obtained according to the log storage instruction to implement the corresponding log storage operation.
[0033] S120: Split the log into a character field and a parameter field, and store the parameter field in a Flash storage space.
[0034] In this embodiment, the log is split into a character domain and a parameter domain, wherein one log corresponds to one character domain and one parameter domain; and the parameter domain is stored in the Flash storage space of the solid state drive.
[0035] In one embodiment, after splitting the log into the character domain and the parameter domain, the method further includes: determining whether the Flash storage space is full to obtain a first determination result; if the first determination result is yes, issuing a prompt indicating that the available storage space is insufficient.
[0036] In this embodiment, before storing the executable file in the target storage area in the ELF file, it is also necessary to determine whether the Flash storage space is full to obtain a first judgment result; if the first judgment result is yes, a prompt indicating that the available storage space is insufficient is issued. At this time, the user can implement the log storage function by deleting the parameter domain stored in the Flash storage space.
[0037] In one embodiment, after determining whether the Flash storage space is full and obtaining a first determination result, the step further includes: if the first determination result is no, determining whether the available space of the Flash storage space is greater than or equal to the storage space required to store the file to be executed, and obtaining a second determination result; if the second determination result is yes, executing the step of storing the parameter domain in the Flash storage space.
[0038] In this embodiment, if the first judgment result is no, it is determined whether the available space of the Flash storage space is greater than or equal to the storage space required to store the file to be executed, and a second judgment result is obtained; if the second judgment result is yes, the step of storing the parameter domain in the Flash storage space is executed; if the second judgment result is no, a prompt is issued that the available storage space is insufficient.
[0039] S130: Obtain a storage address of the parameter domain in the Flash storage space, and use the storage address as an index value of the parameter domain.
[0040] In this embodiment, the storage address of the parameter domain in the Flash storage space is obtained, wherein the storage address is the first address of the character array in the parameter domain; the storage address is used as the index value of the parameter domain. The embodiment of the present invention can improve the log query efficiency by using the storage address of the parameter domain in the Flash storage space as the index value of the parameter domain.
[0041] S140: Map the storage address to the character domain, so as to use the storage address as an index value of the character domain.
[0042] In this embodiment, the storage address is mapped to the character field, so that the storage address is used as the index value of the character field, that is, the character field and parameter field of each log are set with a same and unique index value.
[0043] In one embodiment, after using the storage address as the index value of the character field, the method further includes: storing the index value in a log header of the character field.
[0044] In this embodiment, the character field and parameter field of each log are matched with an identical and unique log header, and the log header is used to store an index value. The character field and parameter field of each log are set with an identical and unique index value, and the index value is the storage address of the parameter field of the log in the Flash storage space.
[0045] S150, compile the character domain to obtain a corresponding to-be-executed file, and store the to-be-executed file in a target storage area in the ELF file.
[0046] In this embodiment, the character domain is compiled to obtain a corresponding to-be-executable file, and the to-be-executable file is stored in a target storage area of an ELF (Executable and Linkable Format) file. The target storage area may be a log library of the ELF file. The ELF file does not occupy the Flash storage space, which can effectively reduce the consumption of the Flash storage space by the log information and improve the utilization rate of the Flash storage space.
[0047] Furthermore, the embodiment of the present invention can compile the character domain to obtain the corresponding to-be-executed file, thereby effectively improving the security of the log and preventing the log from being leaked, that is, as long as the character domain is not leaked, the corresponding log cannot be obtained.
[0048] In one embodiment, after storing the to-be-executable file in the target storage area in the ELF file, it also includes: if a log export instruction is detected, obtaining the corresponding target parameter field from the Flash storage space according to the log export instruction; obtaining the target character field from the target storage area according to the index value of the target parameter field; merging the target parameter field and the target character field to obtain a target log.
[0049] In this embodiment, if a log export instruction is detected, the corresponding target parameter domain is obtained from the Flash storage space according to the keyword in the log export instruction; wherein the keyword may be an index word; the target character domain is obtained from the target storage area according to the index value of the target parameter domain, and since the character domain and parameter domain of the log are both set with a same and unique index value, the target character domain can be obtained from the target storage area according to the index value of the target parameter domain; the target parameter domain and the target character domain are merged to obtain a target log, and the target log is a complete log.
[0050] In one embodiment, obtaining the target character domain from the target storage area according to the index value of the target parameter domain includes: obtaining a target to-be-executed file whose index value is consistent with the index value of the target parameter domain from the target storage area through a preset script recognition tool; and decompiling the target to-be-executed file to obtain the target character domain.
[0051] In this embodiment, a target to-be-executable file whose index value is consistent with the index value of the target parameter field is obtained from the target storage area of the ELF file through a preset script recognition tool; further, each character field and parameter field of the log are matched with an identical and unique log header, and the log header is used to store the index value. Each character field and parameter field of the log are set with an identical and unique index value, and the index value is the storage address of the parameter field of the log in the Flash storage space. Therefore, the target to-be-executable file whose log header is consistent with the log header of the target parameter field can be obtained from the target storage area of the ELF file through a script recognition tool; the target to-be-executable file is decompiled to obtain the target character field.
[0052] In one embodiment, after storing the to-be-executable file in the target storage area in the ELF file, the method further includes: if a log deletion instruction is detected, deleting the parameter domain stored in the Flash storage space according to the log deletion instruction.
[0053] In this embodiment, if a log deletion instruction is detected, the parameter field stored in the Flash storage space is deleted according to the keyword in the log deletion instruction; wherein the keyword may be the index value of the parameter field to be deleted; since the ELF file does not occupy the Flash storage space, there is no need to delete the character field, and the log deletion operation can be implemented by simply deleting the parameter field according to the log deletion instruction.
[0054] In summary, the embodiment of the present invention can effectively reduce the consumption of Flash storage space by log information and improve the utilization rate of Flash storage space by splitting the log into a character domain and a parameter domain, storing the parameter domain in the Flash storage space, and compiling the character domain to obtain the corresponding executable file.
[0055] Figure 2 A schematic block diagram of a Flash-based log storage device provided by an embodiment of the present invention. Figure 2 As shown, corresponding to the above Flash-based log storage method, the present invention also provides a Flash-based log storage device. The Flash-based log storage device includes a unit for executing the above Flash-based log storage method. The device is configured in a controller of a smart terminal. The controller is in communication connection with a solid-state drive (SSD). The smart terminal can be an electronic device such as a tablet computer, a laptop computer, or a desktop computer. For details, please refer to Figure 2 , the Flash-based log storage device 700 includes:
[0056] A first acquisition unit 701 is configured to acquire a corresponding log according to the log storage instruction if a log storage instruction is detected;
[0057] A splitting unit 702 is used to split the log into a character field and a parameter field, and store the parameter field in a Flash storage space;
[0058] A second obtaining unit 703 is used to obtain a storage address of the parameter domain in the Flash storage space, and use the storage address as an index value of the parameter domain;
[0059] A mapping unit 704, configured to map the storage address to the character domain, so as to use the storage address as an index value of the character domain;
[0060] The storage unit 705 is used to compile the character domain to obtain a corresponding to-be-executed file, and store the to-be-executed file in a target storage area in the ELF file.
[0061] In some embodiments, after executing the step of storing the to-be-executable file in the target storage area of the ELF file, the storage unit 705 is further used to:
[0062] If a log export instruction is detected, the corresponding target parameter domain is obtained from the Flash storage space according to the log export instruction; the target character domain is obtained from the target storage area according to the index value of the target parameter domain; the target parameter domain and the target character domain are merged to obtain a target log.
[0063] In some embodiments, when executing the step of acquiring the target character field from the target storage area according to the index value of the target parameter field, the storage unit 705 is specifically used to:
[0064] A target to-be-executed file whose index value is consistent with the index value of the target parameter field is obtained from the target storage area through a preset script recognition tool; and the target to-be-executed file is decompiled to obtain the target character field.
[0065] In some embodiments, after executing the step of splitting the log into the character domain and the parameter domain, the splitting unit 702 is further configured to:
[0066] It is determined whether the Flash storage space is full to obtain a first determination result; if the first determination result is yes, a prompt indicating that the available storage space is insufficient is issued.
[0067] In some embodiments, after executing the step of determining whether the Flash storage space is full and obtaining a first determination result, the splitting unit 702 is further configured to:
[0068] If the first judgment result is no, then determine whether the available space of the Flash storage space is greater than or equal to the storage space required to store the file to be executed, and obtain a second judgment result; if the second judgment result is yes, execute the step of storing the parameter domain in the Flash storage space.
[0069] In some embodiments, after executing the step of using the storage address as the index value of the character field, the mapping unit 704 is further configured to:
[0070] The index value is stored in the log header of the character field.
[0071] In some embodiments, after executing the step of storing the to-be-executable file in the target storage area of the ELF file, the storage unit 705 is further used to:
[0072] If a log deletion instruction is detected, the parameter domain stored in the Flash storage space is deleted according to the log deletion instruction.
[0073] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned Flash-based log storage device and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.
[0074] The above-mentioned Flash-based log storage device can be implemented in the form of a computer program, which can be used in Figure 3 Runs on the computer device shown.
[0075] See also Figure 3 , Figure 3 800 is a schematic block diagram of an electronic device provided by an embodiment of the present invention. The electronic device 800 may be a controller of a smart terminal, the controller is in communication connection with a solid-state drive (SSD), and the smart terminal may be an electronic device such as a tablet computer, a laptop computer, or a desktop computer.
[0076] See also Figure 3 The electronic device 800 includes a processor 802 , a memory and a network interface 805 connected via a system bus 801 , wherein the memory may include a non-volatile storage medium 803 and an internal memory 804 .
[0077] The non-volatile storage medium 803 can store an operating system 8031 and a computer program 8032. The computer program 8032 includes program instructions, and when the program instructions are executed, the processor 802 can execute a Flash-based log storage method.
[0078] The processor 802 is used to provide computing and control capabilities to support the operation of the entire electronic device 800 .
[0079] The internal memory 804 provides an environment for the operation of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can execute a Flash-based log storage method.
[0080] The network interface 805 is used to communicate with other devices over the network. Figure 3 The structure shown in the figure is merely a block diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the electronic device 800 to which the solution of the present invention is applied. The specific electronic device 800 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0081] The processor 802 is used to run the computer program 8032 stored in the memory to implement the following steps:
[0082] If a log storage instruction is detected, the corresponding log is obtained according to the log storage instruction; the log is split into a character domain and a parameter domain, and the parameter domain is stored in a Flash storage space; the storage address of the parameter domain in the Flash storage space is obtained, and the storage address is used as the index value of the parameter domain; the storage address is mapped to the character domain, so as to use the storage address as the index value of the character domain; the character domain is compiled to obtain a corresponding to-be-executable file, and the to-be-executable file is stored in a target storage area in an ELF file.
[0083] In some embodiments, after implementing the step of storing the to-be-executable file in the target storage area of the ELF file, the processor 802 further implements the following steps:
[0084] If a log export instruction is detected, the corresponding target parameter domain is obtained from the Flash storage space according to the log export instruction; the target character domain is obtained from the target storage area according to the index value of the target parameter domain; the target parameter domain and the target character domain are merged to obtain a target log.
[0085] In some embodiments, when the processor 802 implements the step of acquiring the target character field from the target storage area according to the index value of the target parameter field, the processor 802 specifically implements the following steps:
[0086] A target to-be-executed file whose index value is consistent with the index value of the target parameter field is obtained from the target storage area through a preset script recognition tool; and the target to-be-executed file is decompiled to obtain the target character field.
[0087] In some embodiments, after implementing the step of splitting the log into a character domain and a parameter domain, the processor 802 further implements the following steps:
[0088] It is determined whether the Flash storage space is full to obtain a first determination result; if the first determination result is yes, a prompt indicating that the available storage space is insufficient is issued.
[0089] In some embodiments, after implementing the step of determining whether the Flash storage space is full and obtaining a first determination result, the processor 802 further implements the following steps:
[0090] If the first judgment result is no, then determine whether the available space of the Flash storage space is greater than or equal to the storage space required to store the file to be executed, and obtain a second judgment result; if the second judgment result is yes, execute the step of storing the parameter domain in the Flash storage space.
[0091] In some embodiments, after implementing the step of using the storage address as the index value of the character field, the processor 802 further implements the following steps:
[0092] The index value is stored in the log header of the character field.
[0093] In some embodiments, after implementing the step of storing the to-be-executable file in the target storage area of the ELF file, the processor 802 further implements the following steps:
[0094] If a log deletion instruction is detected, the parameter domain stored in the Flash storage space is deleted according to the log deletion instruction.
[0095] It should be understood that in the embodiment of the present invention, the processor 802 may be a central processing unit (CPU), and the processor 802 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0096] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0097] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the following steps:
[0098] If a log storage instruction is detected, the corresponding log is obtained according to the log storage instruction; the log is split into a character domain and a parameter domain, and the parameter domain is stored in a Flash storage space; the storage address of the parameter domain in the Flash storage space is obtained, and the storage address is used as the index value of the parameter domain; the storage address is mapped to the character domain, so as to use the storage address as the index value of the character domain; the character domain is compiled to obtain a corresponding to-be-executable file, and the to-be-executable file is stored in a target storage area in an ELF file.
[0099] In one embodiment, after executing the program instruction to implement the step of storing the to-be-executable file in the target storage area of the ELF file, the processor further implements the following steps:
[0100] If a log export instruction is detected, the corresponding target parameter domain is obtained from the Flash storage space according to the log export instruction; the target character domain is obtained from the target storage area according to the index value of the target parameter domain; the target parameter domain and the target character domain are merged to obtain a target log.
[0101] In one embodiment, when the processor executes the program instructions to implement the step of acquiring the target character field from the target storage area according to the index value of the target parameter field, the processor specifically implements the following steps:
[0102] A target to-be-executed file whose index value is consistent with the index value of the target parameter field is obtained from the target storage area through a preset script recognition tool; and the target to-be-executed file is decompiled to obtain the target character field.
[0103] In one embodiment, after executing the program instructions to implement the step of splitting the log into a character domain and a parameter domain, the processor further implements the following steps:
[0104] It is determined whether the Flash storage space is full to obtain a first determination result; if the first determination result is yes, a prompt indicating that the available storage space is insufficient is issued.
[0105] In one embodiment, the processor executes the program instructions to determine whether the Flash storage space is full, and after obtaining the first determination result, further implements the following steps:
[0106] If the first judgment result is no, then determine whether the available space of the Flash storage space is greater than or equal to the storage space required to store the file to be executed, and obtain a second judgment result; if the second judgment result is yes, execute the step of storing the parameter domain in the Flash storage space.
[0107] In one embodiment, after executing the program instruction to implement the step of using the storage address as the index value of the character field, the processor further implements the following steps:
[0108] The index value is stored in the log header of the character field.
[0109] In one embodiment, after executing the program instruction to implement the step of storing the to-be-executable file in the target storage area of the ELF file, the processor further implements the following steps:
[0110] If a log deletion instruction is detected, the parameter domain stored in the Flash storage space is deleted according to the log deletion instruction.
[0111] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0112] Those of ordinary skill in the art will 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 composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0113] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0114] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0115] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0116] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A Flash-based log storage method. It is characterized in that The method comprises: If a log storage instruction is detected, the corresponding log is obtained according to the log storage instruction; Splitting the log into a character field and a parameter field, and storing the parameter field in a Flash storage space; Obtaining a storage address of the parameter domain in the Flash storage space, and using the storage address as an index value of the parameter domain; Mapping the storage address to the character domain, so as to use the storage address as an index value of the character domain; The character domain is compiled to obtain a corresponding to-be-executed file, and the to-be-executed file is stored in a target storage area in an ELF file.
2. According to the Flash-based log storage method of claim 1, It is characterized in that After storing the to-be-executable file in the target storage area in the ELF file, the method further includes: If a log export instruction is detected, obtaining a corresponding target parameter domain from the Flash storage space according to the log export instruction; Obtaining a target character field from the target storage area according to the index value of the target parameter field; The target parameter field and the target character field are merged to obtain a target log.
3. According to the Flash-based log storage method of claim 2, It is characterized in that The step of acquiring a target character field from the target storage area according to the index value of the target parameter field comprises: Acquire a target to-be-executed file whose index value is consistent with the index value of the target parameter field from the target storage area through a preset script recognition tool; Decompile the target to-be-executable file to obtain the target character domain.
4. According to the Flash-based log storage method of claim 1, It is characterized in that After splitting the log into the character domain and the parameter domain, the method further includes: Determine whether the Flash storage space is full, and obtain a first determination result; If the first judgment result is yes, a prompt indicating that the available storage space is insufficient is issued.
5. According to the Flash-based log storage method of claim 4, It is characterized in that The determining whether the Flash storage space is full, after obtaining a first determination result, further includes: If the first judgment result is no, then judging whether the available space of the Flash storage space is greater than or equal to the storage space required for storing the to-be-executed file, and obtaining a second judgment result; If the second judgment result is yes, the step of storing the parameter domain in the Flash storage space is executed.
6. The Flash-based log storage method according to claim 1, It is characterized in that After taking the storage address as the index value of the character field, the method further includes: The index value is stored in the log header of the character field.
7. The Flash-based log storage method according to claim 1, It is characterized in that After storing the to-be-executable file in the target storage area in the ELF file, the method further comprises: If a log deletion instruction is detected, the parameter domain stored in the Flash storage space is deleted according to the log deletion instruction.
8. A Flash-based log storage device, It is characterized in that The device comprises: A first acquisition unit, configured to acquire a corresponding log according to the log storage instruction if a log storage instruction is detected; A splitting unit, used for splitting the log into a character field and a parameter field, and storing the parameter field in a Flash storage space; A second acquisition unit, configured to acquire a storage address of the parameter domain in the Flash storage space, and use the storage address as an index value of the parameter domain; A mapping unit, used for mapping the storage address to the character domain, so as to use the storage address as an index value of the character domain; The storage unit is used to compile the character domain to obtain a corresponding to-be-executed file, and store the to-be-executed file in a target storage area in the ELF file.
9. An electronic device, It is characterized in that The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 7 can be implemented.
