Log message management method and device, electronic equipment and storage medium
By using a unique identifier in the log message instead of duplicate string information and restoring it on the receiving end, the problem of duplicate strings occupying storage space and increasing communication load in the log message is solved, and the compression and communication performance of log messages are improved.
Patent Information
- Application Number
- CN202311506868.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-13
- Publication Date
- 2025-05-13
AI Technical Summary
The log messages sent by the vehicle electronic control unit contain a large number of repeated string information, resulting in excessive storage space and increased communication bus load.
By using a unique identifier to replace the repeated string information in the log message, and generating a mapping relationship list between the unique identifier and its corresponding string information, the mapping relationship list and the replacement log message are sent to the receiving end. The receiver uses the mapping relationship list to restore the replacement log message to the original log message.
The compression of log messages is realized, which reduces the storage space usage, reduces the load on the communication bus, and improves the performance of the communication bus.
Smart Images

Figure CN119988338A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of software engineering, and in particular to a log message management method and device, an electronic device, and a storage medium. Background Art
[0002] The log messages sent by the vehicle's Electronic Control Unit (ECU) usually contain a large amount of data, which is reflected in the log message in the form of strings. In different log messages, some strings may be the same. If the same strings are not compressed, a large amount of storage space will be occupied and the load of the communication bus will also be increased. Summary of the invention
[0003] The present invention provides a log message management method and device, an electronic device and a storage medium.
[0004] According to a first aspect of the present disclosure, a log message management method is provided, comprising:
[0005] In response to at least one first information being contained in the string information of the log message, each first information in the at least one first information is replaced with a unique identifier to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers;
[0006] Generate a mapping relationship list between unique identifiers and their corresponding first information;
[0007] The mapping relationship list and the replacement log message are sent to the receiving end of the log message; the replacement log message refers to the log message after the first information is replaced by the unique identifier.
[0008] In some embodiments of the present disclosure, before replacing each first information in the at least one first information with a unique identifier, the method includes:
[0009] Determining a macro corresponding to each first information in the log message, and generating a unique identifier for the macro corresponding to each first information; and replacing each first information in at least one first information with the unique identifier, comprising:
[0010] The macro corresponding to the first information is replaced by the unique identifier.
[0011] In some embodiments of the present disclosure, determining a macro corresponding to each first information in a log message includes:
[0012] A macro definition created for each first information is obtained to obtain a macro corresponding to each first information.
[0013] In some embodiments of the present disclosure, generating a unique identifier for a macro corresponding to each first information includes:
[0014] A unique identifier is generated for each macro corresponding to the first information in an incremental generation manner.
[0015] In some embodiments of the present disclosure, replacing each first information in the at least one first information with a unique identifier includes:
[0016] Using a variable parameter list method, convert the unique identifier corresponding to each first information into an integer;
[0017] Each of the at least one first information is replaced with a unique identifier of an integer type.
[0018] In some embodiments of the present disclosure, after replacing each first information in the at least one first information with an integer unique identifier, the method further includes:
[0019] The replacement log message is stored in a four-byte aligned manner.
[0020] According to a second aspect of the present disclosure, a log message management method is provided, comprising:
[0021] A mapping relationship list and a replacement log message sent by a sender of a log message are received; the mapping relationship list is used to indicate a mapping relationship between a unique identifier and its corresponding first information, and the replacement log message refers to a log message after the first information is replaced by the unique identifier;
[0022] The replacement log message is restored to the log message by using the mapping relationship between the unique identifier in the mapping relationship list and the corresponding first information.
[0023] According to a third aspect of the present disclosure, a log message management device is provided, comprising:
[0024] A replacement unit, configured to replace each first information in the at least one first information with a unique identifier in response to at least one first information contained in the string information of the log message, so as to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers;
[0025] A generating unit, configured to generate a mapping relationship list between a unique identifier and its corresponding first information;
[0026] The sending unit is used to send a mapping relationship list and a replacement log message to a receiving end of the log message; the replacement log message refers to a log message after the first information is replaced by a unique identifier.
[0027] According to a fourth aspect of the present disclosure, a log message management device is provided, comprising:
[0028] A receiving unit, configured to receive a mapping relationship list and a replacement log message sent by a sender of a log message; the mapping relationship list is used to indicate a mapping relationship between a unique identifier and its corresponding first information, and the replacement log message refers to a log message after the first information is replaced by the unique identifier;
[0029] The restoration unit is used to restore the replacement log message to the log message by using the mapping relationship between the unique identifier in the mapping relationship list and the corresponding first information.
[0030] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:
[0031] at least one processor; and
[0032] a memory communicatively connected to at least one processor; wherein,
[0033] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to execute the method of the first aspect described above.
[0034] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method of the aforementioned first aspect.
[0035] The present disclosure provides a log message management method, device, electronic device and storage medium. The method includes: in response to at least one first information contained in the string information of the log message, the sending end replaces each first information in the at least one first information with a unique identifier to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers; the sending end generates a mapping relationship list between the unique identifier and its corresponding first information; the sending end sends the mapping relationship list and the replacement log message to the receiving end of the log message; the replacement log message refers to the log message after the first information is replaced by the unique identifier. The receiving end receives the mapping relationship list and the replacement log message sent by the sending end of the log message; the mapping relationship list is used to indicate the mapping relationship between the unique identifier and its corresponding first information, and the replacement log message refers to the log message after the first information is replaced by the unique identifier; the receiving end uses the mapping relationship between the unique identifier and the corresponding first information in the mapping relationship list to restore the replacement log message to the log message.
[0036] According to the scheme of the present disclosure, a replacement log message is generated by replacing repeated first information in a log message with a unique identifier; wherein the first information refers to a string of information contained in at least two log messages. A mapping relationship list between a unique identifier and its corresponding first information is generated, and the mapping relationship list and the replacement log message are sent to a receiving end of the log message. The receiving end receives the mapping relationship list and the replacement log message sent by the sending end of the log message, and restores the replacement log message to the log message using the mapping relationship between the unique identifier and its corresponding first information in the mapping relationship list. The scheme provided by the present disclosure achieves compression of log messages by replacing repeated first information in log messages with a unique identifier, reduces storage space occupancy, reduces the load on the communication bus, and improves the performance of the communication bus.
[0037] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0039] Figure 1 A flowchart of a first log message management method provided by an embodiment of the present disclosure;
[0040] Figure 2 A flowchart of a method for replacing a macro corresponding to first information with a unique identifier provided by an embodiment of the present disclosure;
[0041] Figure 3 A flowchart of a method for replacing each first information in at least one first information with an integer unique identifier provided in an embodiment of the present disclosure;
[0042] Figure 4 A flow chart of a second log message management method provided by an embodiment of the present disclosure;
[0043] Figure 5 A schematic diagram of the structure of a first log message management device provided in an embodiment of the present disclosure;
[0044] Figure 6 A schematic diagram of the structure of a second log message management device provided by an embodiment of the present disclosure;
[0045] Figure 7 A flow chart of a log message management method provided for an application example of the present disclosure;
[0046] Figure 8A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0047] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0048] In order to help those skilled in the art to better understand the technical solutions described in the embodiments of the present disclosure, the technical terms in the embodiments of the present disclosure are explained as follows before introducing the embodiments of the present disclosure.
[0049] ECU: It consists of two parts: hardware and software. The hardware part is usually composed of a microprocessor, memory, input and output interfaces, etc., which are used to receive and process various input signals and output control signals. The software part is usually composed of an operating system, driver, application program, etc., which are used to control and manage hardware devices and systems.
[0050] Diagnostic Log and Trace (DLT): DLT is a log message format used to collect and transmit system or application operating status and fault information. The DLT format usually includes information such as the timestamp, message type, message source, and message content of the log message. The use of DLT can help us collect and transmit a large number of log messages, and organize and store them in a central database for subsequent analysis and processing. In addition, DLT also supports some advanced functions, such as filtering, sorting, merging, and compression of log messages, which can improve the efficiency and effectiveness of log management.
[0051] The following describes the log message management method, device, electronic device, and storage medium according to the embodiments of the present disclosure with reference to the accompanying drawings.
[0052] The log messages sent by the vehicle ECU usually contain a large amount of data, which is reflected in the log message in the form of strings. In different log messages, some strings may be the same. If the same strings are not compressed, a large amount of storage space will be occupied and the load of the communication bus will be increased.
[0053] In the present disclosure, in order to avoid repeated data information occupying a large amount of storage space when sending log messages, increase the load of the communication bus, and thus reduce the performance of the communication bus, before sending the log message, the present disclosure uses a unique identifier to replace each first information in at least one first information, combines the mapping relationship list between the unique identifier and the first information corresponding to it, and sends the mapping relationship list and the log message after the first information is replaced by the unique identifier to the receiving end of the log message, so as to achieve compression of the log message, reduce the storage space occupied, reduce the load of the communication bus, and improve the performance of the communication bus.
[0054] Based on this, a log message management method provided by an embodiment of the present disclosure can be applied to software development, system management, operation and maintenance management, database management, network analysis, data analysis and cloud computing.
[0055] Figure 1 A flowchart of a first log message management method provided in an embodiment of the present disclosure.
[0056] like Figure 1 As shown, the first log message management method provided by the embodiment of the present disclosure is executed by the sender of the log message, such as an ECU. The method includes the following steps:
[0057] Step 101, in response to at least one first information being contained in the string information of the log message, each first information in the at least one first information is replaced with a unique identifier to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers;
[0058] In one embodiment, log messages refer to information recorded during software development, system operation and maintenance, etc., including operating status, error information, performance data, etc. Log messages are usually stored in a file or database in text form and can be used for troubleshooting, performance monitoring, security auditing, etc.
[0059] In one embodiment, the string information of the log message refers to the string contained in the log message, such as error information, warning information, performance data, etc. In practical applications, the string information of the log message usually needs to be compressed to reduce storage space occupation, increase transmission speed, etc.
[0060] In one embodiment, a string is a sequence consisting of a series of characters, which is usually used to represent text information and can be subjected to various operations, such as comparison, concatenation, search, replacement, etc.
[0061] In one embodiment, an identifier is a symbol used to identify an entity. In different application environments, an identifier has different meanings. An identifier is usually composed of letters, numbers and other characters, is case-sensitive, and has a limited length.
[0062] In one embodiment, a unique identifier is an identifier used to identify a unique object. It has the characteristics of uniqueness, stability, portability, etc., and can be used to identify various objects, such as files, directories, network addresses, users, devices, etc. In practical applications, a unique identifier is usually used to replace string information to reduce storage space usage, increase transmission speed, etc.
[0063] In one embodiment, there may be one first information or multiple first information in the log message, which is not limited in the present disclosure.
[0064] Based on this, in one embodiment, if Figure 2 As shown, before step 101, the log message management method further includes:
[0065] Step 201, determining a macro corresponding to each first information in a log message, and generating a unique identifier for the macro corresponding to each first information; and replacing each first information in at least one first information with the unique identifier;
[0066] In one embodiment, macros are usually defined by users and can be expanded and modified according to user needs. They can automate repetitive tasks or perform complex operations, which can reduce the workload of programmers and improve programming efficiency.
[0067] In one embodiment, the unique identifier corresponding to each piece of first information is used to replace the corresponding first information.
[0068] Step 202, using a unique identifier to replace the macro corresponding to the first information;
[0069] In one embodiment, replacing each first information in the at least one first information with a unique identifier comprises:
[0070] The macro corresponding to the first information is replaced by the unique identifier.
[0071] Based on this, in order to ensure the uniqueness of the unique identifier corresponding to each first message, in one embodiment, a macro corresponding to each first information in the log message is determined.
[0072] In one embodiment, a macro definition created for each first information is acquired to obtain a macro corresponding to each first information.
[0073] In one embodiment, a macro definition is a preprocessor instruction in a programming language, which is used to replace macro names and macro expansions during compilation. Macro definitions can be used to simplify code, improve code readability, improve code maintainability, etc.
[0074] In one embodiment, a unique identifier is generated for each macro corresponding to the first information.
[0075] In one embodiment, a unique identifier is generated for each macro corresponding to the first information by incremental generation.
[0076] In one embodiment, the incremental method is a method of processing data, which is usually used for data storage and retrieval. The incremental method of processing data is to store only new data or updated data each time during the data storage process, rather than all data. This method can effectively reduce the storage space occupied and improve the efficiency of data retrieval. The incremental method of processing data is usually used in the fields of database systems, file systems, distributed systems, etc.
[0077] In one embodiment, incremental generation can generate program code step by step, avoiding problems such as insufficient memory caused by generating a large amount of code at one time. At the same time, incremental generation can also improve the efficiency of program generation and reduce the time of program generation. It usually includes four steps: initialization, parsing, optimization and generation.
[0078] In one embodiment, the uniqueness of unique identifiers corresponding to different first messages can be guaranteed by using an incremental generation method; for example, if the unique identifier of the first first message is 0, then the unique identifier of the second first message is 1.
[0079] In one embodiment, the unique identifier is an integer.
[0080] In one embodiment, an integer is a data type commonly used in computer programming and is used to store integers. Integer data types generally include two types: signed and unsigned. Integer data types are widely used in computer programming and can be used to store values, perform arithmetic operations, etc. In the present disclosure, a unique identifier is a positive integer.
[0081] Based on this, in one embodiment, if Figure 3 As shown, step 101 includes:
[0082] Step 301, using a variable parameter list method, converting a unique identifier corresponding to each first information into an integer;
[0083] In one embodiment, a variable parameter list is a function call mechanism in a programming language that allows a function to receive any number and type of parameters, which can improve the flexibility and scalability of the function and enable the function to handle parameters of different types and numbers. In actual programming, variable parameter lists are often used to write general functions, log functions, etc.
[0084] In one embodiment, a variable parameter list function interface may be added to the processor of the log message sending end; after generating a unique identifier for the macro corresponding to each first information through incremental generation, the processor of the log message sending end calls the variable parameter list function interface to convert the unique identifier corresponding to each first information into an integer.
[0085] Step 302: Replace each first information in at least one first information with an integer unique identifier.
[0086] In one embodiment, an integer unique identifier is used to reduce the load on the communication bus and the usage of storage space.
[0087] Step 102, generating a mapping relationship list between a unique identifier and its corresponding first information;
[0088] In one embodiment, the mapping relationship list refers to a list that maps a set of elements to another set of elements. The mapping relationship list is usually used to describe the relationship between elements, for example, describing the relationship between students and classes, describing the relationship between commodities and prices, etc.
[0089] In one embodiment, an empty mapping relationship list is first created, and each log message in the log message queue is traversed. For each log message, it is checked whether it contains repeated first information. If the log message contains repeated first information, a unique identifier is generated and added to the mapping relationship list. The unique identifier and its corresponding first information are added to the mapping relationship list, and the mapping relationship list is returned.
[0090] In one embodiment, there are several log messages as follows: log message 1 is "Today is Monday", log message 2 is "Today is Friday", log message 3 is "voltage is%d", and log message 4 is "voltage is%d". The first information "Today is" corresponds to a unique identifier of 0, and the first information "voltage is%d" corresponds to a unique identifier of 1. The mapping relationship list between the unique identifier and its corresponding first information is shown in Table 1:
[0091] Table 1 Mapping relationship list
[0092] Unique identifier First Information 0 Today is 1 voltage is%d
[0093] Step 103, sending a mapping relationship list and a replacement log message to a receiving end of the log message; the replacement log message refers to a log message after the first information is replaced by a unique identifier.
[0094] In one embodiment, replacing a log message means using a unique identifier to replace repeated first information in a log message. For example, if a log message contains two identical log messages, a unique identifier can be generated and used to replace the repeated first information in the two log messages. This can reduce storage space and improve the efficiency of log message processing.
[0095] In one embodiment, the replacement log messages are stored in a four-byte aligned manner.
[0096] In one embodiment, the execution subject of the present disclosure, such as the ECU sending the log message, is taken as an example: when the ECU is a 32-bit processor, the word length is four bytes. When it reads data in the storage space, it reads in units of four bytes. Therefore, when the replacement log message is stored in a four-byte aligned manner, the reading efficiency of the replacement log message can be improved, and the access time and cost of the storage space can be reduced.
[0097] like Figure 4 As shown, the second log message management method provided by the embodiment of the present disclosure is executed by a receiving end of the log message, such as a vehicle computer or a central control unit of the vehicle. The method includes the following steps:
[0098] Step 401, receiving a mapping relationship list and a replacement log message sent by a sender of a log message; the mapping relationship list is used to indicate a mapping relationship between a unique identifier and its corresponding first information, and the replacement log message refers to a log message after the first information is replaced by the unique identifier;
[0099] Step 402: restore the replaced log message to the log message by using the mapping relationship between the unique identifier and the corresponding first information in the mapping relationship list.
[0100] In one embodiment, the receiving end parses and restores the replacement log message using the unique identifier into the log message according to the mapping relationship list between the unique identifier and the first information.
[0101] The log message management method provided by the embodiment of the present disclosure includes: in response to at least one first information contained in the string information of the log message, the sending end replaces each first information in the at least one first information with a unique identifier to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers; a mapping relationship list between the unique identifier and its corresponding first information is generated; the mapping relationship list and the replacement log message are sent to the receiving end of the log message; the replacement log message refers to the log message after the first information is replaced by the unique identifier. The receiving end receives the mapping relationship list and the replacement log message sent by the sending end of the log message; the mapping relationship list is used to indicate the mapping relationship between the unique identifier and its corresponding first information, and the replacement log message refers to the log message after the first information is replaced by the unique identifier; the replacement log message is restored to the log message by using the mapping relationship between the unique identifier and its corresponding first information in the mapping relationship list.
[0102] According to the solution disclosed in this disclosure:
[0103] First, the sending end replaces each repeated first information in the log message by using a unique identifier, wherein the first information refers to a string of information contained in at least two log messages. By generating a mapping relationship list between the unique identifier and its corresponding first information, the sending end sends these mapping relationship lists and the replacement log message to the receiving end of the log message. The receiving end receives the mapping relationship list and the replacement log message sent by the sending end of the log message, and uses the mapping relationship between the unique identifier and the corresponding first information in the mapping relationship list to restore the replacement log message to the log message. The solution provided by the present disclosure realizes the compression of log messages, reduces the storage space occupied, reduces the load of the communication bus, and improves the performance of the communication bus.
[0104] Secondly, by adopting an incremental generation method, a different unique identifier is generated for the macro corresponding to each first information, thereby ensuring the uniqueness of the unique identifier.
[0105] Again, by replacing each first information in at least one first information with an integer unique identifier and storing the replaced log message in a four-byte aligned manner, repeated information in the log message can be compressed, thereby reducing the communication bus load and reducing the storage space occupied.
[0106] Figure 5 A schematic diagram of the structure of a first log message management device provided by an embodiment of the present disclosure, such as Figure 4 As shown, the log message management device 500 includes:
[0107] A replacement unit 501 is configured to replace each first information in the at least one first information with a unique identifier in response to at least one first information being contained in the string information of the log message, so as to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers;
[0108] A generating unit 502, configured to generate a mapping relationship list between a unique identifier and its corresponding first information;
[0109] The sending unit 503 is used to send a mapping relationship list and a replacement log message to a receiving end of the log message; the replacement log message refers to a log message after the first information is replaced by a unique identifier.
[0110] In one embodiment, the log message management device 500 further includes a determination unit, which is used to:
[0111] A macro corresponding to each first information in the log message is determined, and a unique identifier is generated for the macro corresponding to each first information; and each first information in the at least one first information is replaced by the unique identifier.
[0112] Accordingly, the replacement unit 501 is specifically used for:
[0113] The macro corresponding to the first information is replaced by the unique identifier.
[0114] In one embodiment, the replacement unit 501 is specifically configured to:
[0115] Determine the macro corresponding to each first information in the log message, including:
[0116] A macro definition created for each first information is obtained to obtain a macro corresponding to each first information.
[0117] In one embodiment, the generating unit 502 is specifically configured to:
[0118] Generate a unique identifier for each macro corresponding to the first information, including:
[0119] A unique identifier is generated for each macro corresponding to the first information in an incremental generation manner.
[0120] In one embodiment, the log message management device 500 further includes a conversion unit, which is used to:
[0121] Using a variable parameter list method, convert the unique identifier corresponding to each first information into an integer;
[0122] Each of the at least one first information is replaced with a unique identifier of an integer type.
[0123] In one embodiment, the log message management device 500 further includes a storage unit, which is used to:
[0124] The replacement log message is stored in a four-byte aligned manner.
[0125] Figure 6 A schematic diagram of the structure of a second log message management device provided in an embodiment of the present disclosure, such as Figure 6 As shown, the log message management device 600 includes:
[0126] The receiving unit 601 is used to receive a mapping relationship list and a replacement log message sent by a sender of a log message; the mapping relationship list is used to indicate a mapping relationship between a unique identifier and its corresponding first information, and the replacement log message refers to a log message after the first information is replaced by the unique identifier;
[0127] The restoring unit 602 is configured to restore the replacement log message to the log message by using the mapping relationship between the unique identifier in the mapping relationship list and the corresponding first information.
[0128] In one embodiment, the receiving unit 601 is specifically configured to:
[0129] In one embodiment, the sending end and the receiving end of the log message may be any device or program capable of data transmission.
[0130] In one embodiment, the sending end of the log message may be an application program, a database system, a network device, etc.; the receiving end of the log message may be an operating system, an application program, a database system, etc.
[0131] The log message management method disclosed in the present invention is further described below with reference to a specific application example.
[0132] like Figure 7 As shown, Figure 7 A flow chart of a log message management method provided for an example of the present disclosure, the log message management method comprising the following steps:
[0133] Step 701, determining a macro corresponding to each first information in a log message at a sending end;
[0134] In one embodiment, macros corresponding to the first information are created, such as #define A_1 "Today is", #define A_2 "voltage is%d", a macro named A_1 is defined, and the value of A_1 is "Today is"; a macro named A_2 is defined, and the value of A_2 is "voltage is%d".
[0135] Step 702, the sending end incrementally generates a unique identifier;
[0136] Step 703, the sending end converts the unique identifier into an integer using a variable parameter list method;
[0137] Step 704: The sending end replaces the macro corresponding to the first information in the log message with the unique identifier, generates a replacement log message, and generates a mapping relationship list between the unique identifier and the first information corresponding to it;
[0138] Step 705, the sending end stores the replacement log message in a four-byte aligned manner;
[0139] In one embodiment, the replacement log message containing the unique identifier is stored in a four-byte aligned manner.
[0140] In one embodiment, according to the four-byte alignment method, the first address of the replacement log message in the memory must be a multiple of 4, such as 0x00, 0x04, 0x08, 0x0c, etc.
[0141] Step 706, the sending end sends the mapping relationship list and the replacement log message to the receiving end of the log message;
[0142] In one embodiment, the sending end sends a list including mapping relationships between unique identifiers and their corresponding first information, and a replacement log message including the unique identifier to the receiving end.
[0143] Step 707, the receiving end receives the mapping relationship list and the replacement log message sent by the sending end;
[0144] In one embodiment, the receiving end receives a list including mapping relationships between unique identifiers and their corresponding first information, and a replacement log message including the unique identifier.
[0145] Step 708: The receiving end uses the mapping relationship between the unique identifier in the mapping relationship list and the corresponding first information to restore the replaced log message to the log message.
[0146] In one embodiment, the mapping relationship between the unique identifier and the first information is searched according to the mapping relationship list, and the replacement log information containing the unique identifier is restored to the log information containing the first information.
[0147] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and the principle is the same, which is not limited in this embodiment.
[0148] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a non-transitory computer-readable storage medium storing computer instructions.
[0149] Specifically, an embodiment of the present disclosure provides an electronic device, including:
[0150] at least one processor; and
[0151] a memory communicatively connected to at least one processor; wherein,
[0152] The memory stores instructions that can be executed by at least one processor. The instructions are executed by the at least one processor so that the at least one processor can perform the steps of the aforementioned log message management method.
[0153] An embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the steps of the aforementioned log message management method.
[0154] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, vehicle-mounted devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0155] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 802 or a computer program loaded from a storage unit 808 to a RAM (Random Access Memory) 803. In RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An I / O (Input / Output) interface 805 is also connected to the bus 804.
[0156] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 804, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0157] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, CPU (Central Processing Unit), GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the log message management method. For example, in some embodiments, the log message management method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via ROM 802 and / or the communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the aforementioned log message management method in any other appropriate manner (for example, by means of firmware).
[0158] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0159] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0160] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0161] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0162] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A log message management method, characterized in that: include: In response to at least one first information being contained in the string information of the log message, each first information in the at least one first information is replaced with a unique identifier to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers; Generate a mapping relationship list between unique identifiers and their corresponding first information; The mapping relationship list and the replacement log message are sent to a receiving end of the log message.
2. The method according to claim 1, characterized in that Before replacing each of the at least one first information with a unique identifier, the method comprises: Determine a macro corresponding to each of the first information in the log message, and generate a unique identifier for each of the macros corresponding to the first information; and replace each of the first information in the at least one first information with the unique identifier, including: The macro corresponding to the first information is replaced by the unique identifier.
3. The method according to claim 2, characterized in that The determining a macro corresponding to each of the first information in the log message includes: A macro definition created for each of the first information is obtained to obtain a macro corresponding to each of the first information.
4. The method according to claim 2 or 3, characterized in that: Generating a unique identifier for each macro corresponding to the first information includes: A unique identifier is generated for each macro corresponding to the first information in an incremental generation manner.
5. The method according to claim 1, characterized in that The step of replacing each first information in the at least one first information with a unique identifier comprises: Using a variable parameter list method, converting the unique identifier corresponding to each first information into an integer; Each of the at least one first information is replaced with an integer unique identifier.
6. The method according to claim 5, characterized in that After replacing each first information in the at least one first information with an integer unique identifier, the method further comprises: The replacement log message is stored in a four-byte aligned manner.
7. A log message management method, characterized in that: include: Receive the mapping relationship list and the replacement log message sent by the sender of the log message; The mapping relationship list is used to indicate the mapping relationship between the unique identifier and the first information corresponding to it, and the replacement log message refers to the log message after the first information is replaced by the unique identifier; The replacement log message is restored to a log message by using the mapping relationship between the unique identifier and the first information corresponding to it in the mapping relationship list.
8. A log message management device, characterized in that: include: A replacement unit, configured to, in response to at least one first information being contained in the string information of the log message, replace each first information in the at least one first information with a unique identifier to obtain a replacement log message; wherein the first information refers to the string information contained in at least two log messages, and different first information corresponds to different unique identifiers; A generating unit, configured to generate a mapping relationship list between a unique identifier and its corresponding first information; The sending unit is used to send the mapping relationship list and the replacement log message to the receiving end of the log message; the replacement log message refers to the log message after the first information is replaced by the unique identifier.
9. A log message management device, characterized in that: include: A receiving unit, configured to receive the mapping relationship list and the replacement log message sent by a sending end of the log message; The mapping relationship list is used to indicate the mapping relationship between the unique identifier and the first information corresponding to it, and the replacement log message refers to the log message after the first information is replaced by the unique identifier; The restoration unit is used to restore the replacement log message to a log message by using the mapping relationship between the unique identifier and the corresponding first information in the mapping relationship list.
10. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6 or claim 7.
11. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6 or claim 7.