Log information analysis method, device, computer equipment, medium and program product
By pre-setting log analysis rules and selecting corresponding rules based on target log files, and analyzing log information using keywords, data types and data formats, the problem of manual parsing in the existing technology is solved, and efficient and accurate log information analysis is achieved.
Patent Information
- Application Number
- CN202410507657.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-04-25
AI Technical Summary
In the prior art, manually identifying and analyzing the correspondence between the character string of hexadecimal data and the original structure information is time-consuming and easy to cause mistakes, with low accuracy, and it is difficult to efficiently parse log information.
By presetting different log analysis rules, selecting corresponding log analysis rules based on the target log file, and analyzing the target information using keywords, data types and data formats to generate analysis results.
It improves the efficiency and accuracy of log information analysis, reduces manual intervention, and ensures the accuracy of analysis results.
Smart Images

Figure CN118349385B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a log information parsing method, device, computer equipment, medium and program product. Background Art
[0002] In the process of developing automotive software, various software operation failures will occur. Log files are one of the important bases for developers to analyze the causes of failures. Log files often record software information and debugging information during the operation of software programs. When a failure occurs, this information will be saved. Developers can analyze these log files to eliminate and solve program failures.
[0003] When developers add log debugging information, in order to save resources or deal with some software and hardware limitations, they often encapsulate more debugging information in a structure or array, and then save it through a log message. However, the log information is composed of a long string of hexadecimal data. When performing fault analysis, it is necessary to match the hexadecimal data string with the original structure information and parse the log information to obtain useful information.
[0004] In the related art, log information is parsed by manually identifying and analyzing the correspondence between the hexadecimal data string and the original structure information, which is time-consuming, prone to errors, and has low accuracy. Summary of the invention
[0005] In view of this, the present invention provides a log information parsing method, apparatus, computer equipment, medium and program product to solve the problem that manual log information parsing is time-consuming and has low accuracy.
[0006] In a first aspect, the present invention provides a log information parsing method, the method comprising: obtaining a target log file; selecting a corresponding log parsing rule based on the target log file; the log parsing rule comprising a keyword, a data type and a data format; searching the target log file based on the keyword to obtain target information; parsing the target information based on the data type and the data format to display the parsing result.
[0007] The above scheme pre-sets different log parsing rules for different log files, selects the log parsing rules corresponding to the target log file when parsing log information, extracts target information from the target log file according to the keywords in the corresponding log parsing rules, and parses the extracted target information according to the data type and data format in the corresponding log parsing rules to obtain the parsing result corresponding to the target log file, thereby ensuring the accuracy of log information parsing.
[0008] In an optional implementation, the keywords include a front keyword, a back keyword, and a target keyword.
[0009] In an optional implementation, the prefix of the target information corresponds to the front keyword; the suffix of the target information corresponds to the back keyword; and the number of times the keyword appears in the target information is greater than a first threshold.
[0010] The above scheme further limits the keywords to include the front keyword, the back keyword and the target keyword, and combines the front keyword, the back keyword and the target keyword to jointly search for the target information, thereby further ensuring the accuracy of the log information analysis.
[0011] In an optional implementation, the target information includes at least one structure / array member; the data type includes the data type of each member.
[0012] In an optional embodiment, the data format includes corresponding coefficients and corresponding offsets of each member; parsing the target information according to the data type and the data format to display the parsing result includes: matching the data type of each member with each structure / array member in the target information; calculating the log data of each member according to the corresponding coefficients and corresponding offsets of each member to generate the parsing result.
[0013] The above scheme further limits the data format to include the corresponding coefficient and the corresponding offset of each member, and parses the target information in combination with the corresponding coefficient and the corresponding offset of each member, thereby further ensuring the accuracy of log information parsing.
[0014] In an optional implementation, displaying the parsing result includes: creating target row data in a target table according to the target keyword; and displaying the data type, log data and timestamp of each member in the target row data.
[0015] In a second aspect, the present invention provides a log information parsing device, the device comprising:
[0016] File acquisition module, used to obtain target log files;
[0017] A rule selection module, used to select corresponding log parsing rules according to the target log file; the log parsing rules include keywords, data types and data formats;
[0018] An information acquisition module, used to search the target log file according to the keyword and acquire target information;
[0019] The parsing module is used to parse the target information according to the data type and the data format to display the parsing result.
[0020] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the log information parsing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0021] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the log information parsing method of the first aspect or any corresponding embodiment thereof.
[0022] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the log information parsing method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 is a flow chart of a log information parsing method according to an embodiment of the present invention;
[0025] Figure 2 is a flow chart of another log information parsing method according to an embodiment of the present invention;
[0026] Figure 3 is a flow chart of another log information parsing method according to an embodiment of the present invention;
[0027] Figure 4 A schematic diagram showing a tool configuration interface involved in an embodiment of the present invention is shown;
[0028] Figure 5 is a structural block diagram of a log information parsing device according to an embodiment of the present invention;
[0029] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0031] Log refers to a collection of certain operations and operation results of objects specified by the system in a time-ordered manner. In the process of developing automotive software, various software operation failures will occur, and log files are one of the important bases for developers to analyze the causes of failures. Log files often record software information and debugging information during the operation of software programs. When a failure occurs, this information will be saved, and developers can analyze these log files to troubleshoot and solve program failures.
[0032] When developers add log debugging information, in order to save resources or deal with some software and hardware limitations, they often encapsulate more debugging information in a structure or array, and then save it through a log message. However, the log information is composed of a long string of hexadecimal data. When performing fault analysis, it is necessary to match the hexadecimal data string with the original structure information and parse the log information to obtain useful information.
[0033] In the related art, log information is parsed by manually identifying and analyzing the correspondence between the hexadecimal data string and the original structure information, which is time-consuming, prone to errors, and has low accuracy.
[0034] Therefore, an embodiment of the present invention provides a log information parsing method, which achieves the effect of improving the efficiency and accuracy of log information parsing by selecting log parsing rules.
[0035] According to an embodiment of the present invention, a log information parsing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0036] In this embodiment, a log information parsing method is provided, which can be used for notebook computers, desktop computers, etc. Figure 1 is a flow chart of a log information parsing method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0037] Step S101, obtaining a target log file.
[0038] When developers are tracing the source of software operation failures during software development, they first need to obtain the target log file generated during the software operation. The target log file records the error information, warning information, debugging information, etc. during the software operation. The log files can be filtered according to needs, for example, the log file that records debugging information can be filtered out as the target log file.
[0039] Step S102: selecting a corresponding log parsing rule according to the target log file.
[0040] The log parsing rules include keywords, data types and data formats. Keywords can be used as the basis for extracting required information from the target log file. For example, the keywords are set to time, file address, file type, etc. The data type and data format are used to indicate the correspondence between character strings and valid information and the parsing rules, such as what data type and data format are parsed, and what data type and data format are the parsed results. The target log file can be parsed according to the log parsing rules, and the character strings in the target log file that are difficult to directly understand the meaning can be parsed into valid log information.
[0041] Optionally, the corresponding log parsing rule is selected according to the file name of the target log file. The file name of the target log may contain the approximate type of the target log file. The correspondence between the file name and the log parsing rule can be pre-set to select the corresponding log parsing rule by reading the file name of the target log file. Alternatively, keyword analysis is performed on the target log file in advance to determine the target number of keywords that appear most frequently in the target log file. These keywords can reflect the type or function of the target log file, so the corresponding log parsing rule can be selected according to the target number of keywords.
[0042] Optionally, in response to the user selecting a log parsing rule, the log parsing rule selected by the user is used as the basis for parsing the target log file. The user can perform interactive operations for log information parsing through a pre-developed log parsing interface, and select the required log parsing rule by operating the log parsing rule selection control in the log parsing interface.
[0043] Optionally, log parsing rules are selected according to the timeline of the target log file. The types of log files generated by the software at different times may be different. For example, when the software starts running, it generates logs of the startup status of each startup item, logs of whether updates are performed, etc., and logs of whether there are operating failures and warning messages in the middle, and logs of whether the operation ends normally when the operation ends. Therefore, the corresponding relationship between the timeline and the log parsing rules can be established in advance, and then the corresponding log parsing rules can be selected according to the timeline corresponding to the target log file.
[0044] Step S103, searching the target log file according to the keyword to obtain target information.
[0045] The desired target information is filtered out from the target log file according to the set keywords. For example, if the keywords are April 1 and XX information, the XX information in the log file of April 1 is filtered out from the target log file as the target information.
[0046] Step S104: parsing the target information according to the data type and the data format to display the parsing result.
[0047] The data type and the data format can be the characteristics that the target information needs to have before parsing, or can be the characteristics of the parsing result after parsing. For example, before parsing, it is stipulated that only the target information with an integer data type and a hexadecimal data format is to be parsed, and the data type after parsing is stipulated to be a floating point number and the data format is a decimal number.
[0048] The log information parsing method provided in this embodiment pre-sets different log parsing rules for different log files, selects the log parsing rule corresponding to the target log file when performing log information parsing, extracts target information from the target log file according to the keywords in the corresponding log parsing rule, parses the extracted target information according to the data type and data format in the corresponding log parsing rule, and obtains the parsing result corresponding to the target log file, thereby ensuring the accuracy of log information parsing.
[0049] In this embodiment, a log information parsing method is provided, which can be used for notebook computers, desktop computers, etc. Figure 2 is a flow chart of a log information parsing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0050] Step S201 : when a log information parsing instruction triggered by a user is received, a target table is generated, and log parsing rules are generated in response to the user's input operation.
[0051] The log parsing rules include keywords, data types, and data formats.
[0052] Optionally, the keyword includes a front keyword, a back keyword, and a target keyword. The front keyword is used to indicate the keyword at the beginning of the string, the back keyword is used to indicate the keyword at the end of the string, and the target keyword is used to indicate the keyword required for the search, that is, the target of the log information parsing task. For example, first set the target keyword to X month X day and ECU directory, the front keyword is AAA, and the back keyword is BBB. When performing log parsing, the string from AAA to BBB in the ECU directory on X month X day is parsed.
[0053] Optionally, the keyword corresponds to at least one structure / array member, and the structure / array member is used to indicate an object when parsing log information.
[0054] Optionally, the data type includes the data types of each member.
[0055] Optionally, the data format includes corresponding coefficients and corresponding offsets of each member. The corresponding coefficients of each member are used to indicate the coefficients that need to be taken into account when analyzing the member, and the corresponding offsets of each member are used to indicate the offsets that need to be taken into account when analyzing the member.
[0056] Optionally, when a log information parsing instruction triggered by a user is received, a preset target table is generated. The target table has various input controls, such as a keyword input control, a data type input control, and a data format data control. When an input operation is received on each control, a corresponding log parsing rule is generated. In other words, a target table for filling in log parsing rules can be preset. When log information parsing is required, the keywords, data types, data formats, etc. that need to be set are input through various input controls in the target table according to the needs. Then, log parsing rules are generated based on the filled target table. Subsequently, keyword search, target information parsing, etc. can be performed based on the log parsing rules. Exemplarily, the target table is an EXCEL table.
[0057] Optionally, the log information parsing instruction corresponds to multiple log parsing rules, that is, the user may need multiple log parsing rules in one log information parsing. In this case, multiple target tables are generated to generate multiple log parsing rules.
[0058] It should be noted that multiple log parsing rules can be generated and stored in advance according to needs. When log information is subsequently parsed, if the required target log parsing rule has been generated, it can be directly selected and called without generating it again. That is, when the target log parsing rule exists, step S201 can be omitted.
[0059] Step S202, obtaining a target log file.
[0060] Optionally, in response to a selection operation by the user through the tool configuration interface, the target log file is read. The tool configuration interface has multiple input controls, such as a log file directory selection control, a log parsing rule file selection control, a storage directory selection control for the generated target table, a selection control for whether the generated data is big endian (big endian means that the high-order bytes are stored in the low address), a selection control for whether the generated data is displayed in hexadecimal or decimal, and a selection control for the number of decimal places retained for the decimal displayed data.
[0061] Step S203: selecting a corresponding log parsing rule according to the target log file.
[0062] After the target log file is obtained, a log parsing rule corresponding to the target log file may be selected from the log parsing rules.
[0063] Step S204: search the target log file according to the keyword to obtain target information.
[0064] Optionally, the target information includes at least one structure / array member. That is, the structure / array member included in the target information is filtered out according to the keywords in the log parsing rule.
[0065] Optionally, the prefix of the target information corresponds to the front keyword, the suffix of the target information corresponds to the back keyword, and the number of times the keyword appears in the target information is greater than a first threshold. In other words, the starting keyword of the target information corresponds to the front keyword in the log parsing rule, the ending keyword of the target information corresponds to the back keyword in the log parsing rule, and the keyword whose number of appearances in the target information is greater than the first threshold corresponds to the keyword in the log parsing rule. The first threshold can be set according to demand, for example, set to 3 times.
[0066] Step S205: parsing the target information according to the data type and the data format to display the parsing result.
[0067] Specifically, the above step S205 includes:
[0068] Step S2051, matching the data type of each member with each structure / array member in the target information.
[0069] Based on the data type of each member in the log parsing rule, determine the corresponding information of each structure / array member in the target information in the string.
[0070] Step S2052, calculating the log data of each member according to the corresponding coefficient and the corresponding offset of each member to generate the analysis result.
[0071] The corresponding information of each structure / array member in the target information in the string is combined with the corresponding coefficient and offset to perform mapping calculation and parse out the corresponding log data.
[0072] Step S2053, creating target row data in the target table according to the target keyword.
[0073] The target table is used for generating log parsing rules and displaying parsing results. Target row data is established according to the target keyword, and the target row data is used to display the parsing results corresponding to the target keyword.
[0074] Step S2054: Display the data type, log data and timestamp of each member in the target row data.
[0075] The specific display items of the target row data are set according to the requirements, such as displaying the data type, log data and timestamp of each member, and also displaying the directory source, event number, event description, etc. corresponding to each member.
[0076] The log information parsing method provided in this embodiment pre-sets different log parsing rules for different log files, selects the log parsing rule corresponding to the target log file when performing log information parsing, extracts target information from the target log file according to the keywords in the corresponding log parsing rule, parses the extracted target information according to the data type and data format in the corresponding log parsing rule, and obtains the parsing result corresponding to the target log file, thereby ensuring the accuracy of log information parsing.
[0077] As one or more specific application embodiments of the embodiments of the present invention, the optimal implementation scheme or the scheme that the inventor most wants to embody is described below in combination with specific application scenarios.
[0078] Optionally, the target log file is a log file in the dlt (Diagnostic Log and Trace) format during the development of automotive software. Figure 3 is a flow chart of a log information parsing method according to an embodiment of the present invention. Figure 3 As shown, the UI interface is the user interaction interface, and the dlt format file input is to obtain the dlt format file. The function of the dlt file parsing module is to parse the obtained dlt format file and extract the required log information. The log configuration Excel input is that the user fills in the target form according to the needs. The user needs to fill in the keyword KeyWord used to search for the corresponding log, the keyword LogStart when obtaining the start of the log data string, the keyword LogEnd when obtaining the end of the log data string, the byte alignment Alignment, the structure / array member list Member, the data type DataType of each member, the corresponding coefficient Factor of each member, and the corresponding offset Offset of each member. The log configuration Excel parsing module is used to parse the target form filled in by the user and extract the valid information in the form. The tool configuration information is selected and filled in by the user according to the needs, including selecting the input dlt file directory, selecting the log configuration Excel file, selecting the output directory of the generated Excel file, selecting whether dltlog is big endian, selecting whether the generated data is displayed in hexadecimal or decimal, and selecting the number of decimal places to be retained when displaying decimal data. Figure 4 The schematic diagram of the tool configuration interface involved in the embodiment of the present invention is shown. The function of the dlt log information and log configuration Excel information mapping processing module is to match the log information extracted from the dlt file with the configuration information in the target table, retrieve the required log information according to the KeyWord, LogStart, and LogEnd parameters, match the member information to the string contained in the log information according to the Alignment, Member, DataType, and the big and small ends in the tool configuration information, and calculate the log data of each member through Factor, Offset, and the format settings in the tool configuration information. After log parsing, it is output to Excel, that is, the log data of each member is calculated and displayed in the target table.
[0079] In this embodiment, a log information parsing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0080] This embodiment provides a log information parsing device, such as Figure 5 As shown, including:
[0081] The file acquisition module 501 is used to acquire the target log file;
[0082] A rule selection module 502 is used to select a corresponding log parsing rule according to the target log file; the log parsing rule includes keywords, data types and data formats;
[0083] The information acquisition module 503 is used to search the target log file according to the keyword and acquire the target information;
[0084] The parsing module 504 is used to parse the target information according to the data type and the data format to display the parsing result.
[0085] In an optional implementation, the keyword includes a front keyword, a back keyword and a target keyword.
[0086] In an optional implementation, the prefix of the target information corresponds to the front keyword; the suffix of the target information corresponds to the rear keyword; and the number of times the keyword appears in the target information is greater than a first threshold.
[0087] In an optional implementation, the target information includes at least one structure / array member; the data type includes the data type of each member.
[0088] In an optional implementation, the data format includes corresponding coefficients and corresponding offsets of each member;
[0089] Based on the data type and the data format, the parsing module is also used to: correspond the data type of each member to each structure / array member in the target information; calculate the log data of each member according to the corresponding coefficient and corresponding offset of each member to generate the parsing result.
[0090] In an optional implementation, the parsing module is further used to: create target row data in a target table according to the target keyword; and display the data type, log data and timestamp of each member in the target row data.
[0091] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0092] The log information parsing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0093] The embodiment of the present invention also provides a computer device having the above Figure 5 The log information parsing device shown.
[0094] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0095] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0096] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0097] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0098] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0099] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0100] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0101] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0102] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0103] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A log information parsing method, characterized in that: The method comprises: Receive a log information parsing instruction triggered by a user, and generate a preset target table; the target table includes various input controls for filling in log parsing rules; Receive input operations on each input control and generate corresponding log parsing rules; Get the target log file; According to the target log file, a corresponding log parsing rule is selected; the log parsing rule includes keywords, data types and data formats; Search the target log file according to the keyword to obtain target information; the keyword includes a target keyword, which is used to indicate a keyword whose number of appearances in the target information is greater than a first threshold; Parsing the target information according to the data type and the data format to display the parsing result; The target information includes at least one structure / array member; the data type includes the data type of each member; the data format includes the corresponding coefficient and the corresponding offset of each member; and the target information is parsed according to the data type and the data format to display the parsing result, including: Match the data type of each member with each structure / array member in the target information; Calculate the log data of each member according to the corresponding coefficient and the corresponding offset of each member; According to the target keyword, creating target row data in the target table; The data type, log data and timestamp of each member are displayed in the target row data.
2. The method according to claim 1, characterized in that The keywords include the front keywords and the back keywords.
3. The method according to claim 2, characterized in that The prefix of the target information corresponds to the front keyword; the suffix of the target information corresponds to the back keyword.
4. A log information analysis device, characterized in that: The device comprises: An instruction receiving module is used to receive a log information parsing instruction triggered by a user and generate a preset target table; the target table includes various input controls for filling in log parsing rules; A rule generation module is used to receive input operations on various input controls and generate corresponding log parsing rules; File acquisition module, used to obtain target log files; A rule selection module, used to select corresponding log parsing rules according to the target log file; the log parsing rules include keywords, data types and data formats; An information acquisition module, used to search the target log file according to the keyword to acquire target information; the keyword includes a target keyword, which is used to indicate a keyword whose number of appearances in the target information is greater than a first threshold; A parsing module, used for parsing the target information according to the data type and the data format to display the parsing result; The target information includes at least one structure / array member; the data type includes the data type of each member; the data format includes the corresponding coefficient and the corresponding offset of each member; the parsing module is also used for: Match the data type of each member with each structure / array member in the target information; Calculate the log data of each member according to the corresponding coefficient and the corresponding offset of each member; According to the target keyword, creating target row data in the target table; The data type, log data and timestamp of each member are displayed in the target row data.
5. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the log information parsing method according to any one of claims 1 to 3 by executing the computer instructions.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the log information parsing method according to any one of claims 1 to 3.
7. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the log information parsing method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Vehicle-mounted equipment log analysis method and device, electronic equipment and storage medium
CN115983235A
POS device log extraction and analysis method, device and medium
CN116126661A