Log matching methods, devices, storage media, and products
By extracting meta-program logs from key source code print logs and using a dynamic programming algorithm to determine whether they can be converted into target program logs, the problems of low log matching accuracy and high time complexity in the existing technology are solved, and more efficient log matching is achieved.
Patent Information
- Application Number
- CN202210266871.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-17
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-03-17
AI Technical Summary
The keyword combination matching algorithm in the prior art has low accuracy and high time complexity when matching logs, resulting in low matching efficiency.
By extracting meta-program logs from key source code print logs, a dynamic programming algorithm is used to determine whether the meta-program logs can be converted into target program logs through instrumentation words, and the corresponding logs are determined in the matching target program logs.
The accuracy of log matching is improved and the time complexity is reduced, thereby improving matching efficiency.
Smart Images

Figure CN114595207B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data processing technology, and in particular to a log matching method, device, storage medium, and product. Background Art
[0002] Network devices, systems, and service programs all generate corresponding program logs during operation. These logs chronologically record the runtime processes of these objects. Therefore, program logs are widely used in scenarios such as daily monitoring, health analysis, and fault location.
[0003] The target object generates a large number of program logs every day, which are called target program logs. To perform daily monitoring, health analysis, and fault location operations, it is necessary to pre-configure a large number of key program logs that are important for these operations. These key program logs are then matched with target program logs, and the aforementioned operations are then performed based on the matching target program logs.
[0004] Currently, when matching key program logs with target program logs, key program logs are generally manually extracted from source code print logs using keywords, and matched using a keyword combination matching algorithm. Since key program logs only include keywords, one key program log may match multiple target program logs, resulting in low matching accuracy. In addition, when using the keyword combination matching algorithm for matching, the time complexity is high, which in turn leads to low matching efficiency. Summary of the Invention
[0005] The present application provides a log matching method, device, storage medium and product to solve the problem in the prior art that when a keyword combination matching algorithm is used for matching, the matching result has low accuracy and high time complexity, which leads to low matching efficiency.
[0006] In a first aspect, the present application provides a log matching method, comprising:
[0007] Obtaining a key source code print log and a first target program log corresponding to the target object, wherein the key source code print log is a pre-configured program log that has a locating function for at least one target sub-object in the target object or log search answer data of the target object, and the first target program log is a log generated by running the target object;
[0008] Extracting a corresponding metaprogram log from the key source code print log, wherein the metaprogram log includes all non-parameter words in the corresponding key source code print log;
[0009] Using a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word;
[0010] If it is determined that the log can be converted into the first target program log, the log that can be converted into the first target program log is determined as the second target program log, and a target program log matching the meta-program log is determined in the second target program log.
[0011] In a second aspect, the present application provides a log matching method, comprising:
[0012] Receiving a monitoring request for a target object triggered by a user, wherein the target object includes a plurality of target sub-objects;
[0013] Obtaining a metaprogram log and a first target program log corresponding to the target object according to the monitoring request, wherein the metaprogram log is obtained by pre-extracting non-parameter words from a key source code print log; the key source code print log is a pre-configured program log that has a locating effect on at least one target sub-object in the target object;
[0014] Using a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word;
[0015] If it is determined that the log can be converted into the first target program log, the log that can be converted into the first target program log is determined as the second target program log, and a target program log matching the meta-program log is determined in the second target program log;
[0016] Determine the target sub-object corresponding to the matching target program log to obtain the monitoring result corresponding to the target sub-object.
[0017] In a third aspect, the present application provides a log matching method, comprising:
[0018] Receive a log search request corresponding to a target object triggered by a user, wherein the log search request includes a target program log;
[0019] Acquiring a plurality of pre-stored meta-program logs according to the log search request, wherein the meta-program logs are obtained by pre-extracting non-parameter words from key source code print logs; the key source code print logs are pre-configured program logs that have a positioning effect on log search answer data of a target object;
[0020] A dynamic programming algorithm is used to determine whether each meta-program log can be converted into a target program log by inserting a word.
[0021] If it is determined that it can be converted into the target program log, the corresponding meta-program log is determined as the meta-program log that matches the target program log;
[0022] Output the answer data corresponding to the matching meta-program log to the user.
[0023] In a fourth aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0024] The memory stores computer-executable instructions;
[0025] The processor executes the computer-executable instructions stored in the memory to implement the log matching method described in any one of the above aspects.
[0026] In a fifth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the log matching method described in any one of the above aspects.
[0027] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the log matching method described in any one of the above aspects.
[0028] The log matching method, device, storage medium, and product provided in this application obtain a key source code print log and a first target program log corresponding to a target object; extract a corresponding metaprogram log from the key source code print log; use a dynamic programming algorithm to determine whether the metaprogram log can be converted into the first target program log by inserting a stub word; if it is determined that it can be converted into the first target program log, the log that can be converted into the first target program log is determined as a second target program log, and a target program log that matches the metaprogram log is determined in the second target program log. By extracting the metaprogram log from the key source code print log, determining whether the target program log matches the metaprogram log, and determining the target program log that matches the corresponding key source code print log, the accuracy of the matching result can be improved because the metaprogram log contains all non-parameter words in the key source code print log. The dynamic programming algorithm is used to match the metaprogram log with the first target program log by inserting a stub word to determine whether the metaprogram log can be converted into the first target program log. Since the dynamic programming algorithm has a very low algorithm time complexity when performing text matching, the time complexity of the matching algorithm is greatly reduced, thereby improving the matching efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0030] Figure 1 Flowchart of the log matching method provided in Example 1 of this application;
[0031] Figure 2 A schematic diagram of determining the value of the parameter for the number of instrumented words provided by the embodiment of the present application;
[0032] Figure 3 Flowchart of the log matching method provided in Example 3 of this application;
[0033] Figure 4 A schematic diagram of determining the value of the current instrumentation word quantity parameter when the current meta log word provided by this application is not equal to the current target log word;
[0034] Figure 5 Schematic diagram of determining the value of the current instrumentation word quantity parameter when the current meta log word provided by this application is equal to the current target log word;
[0035] Figure 6 Flowchart of the log matching method provided in Example 7 of this application;
[0036] Figure 7 Schematic diagram of the target object monitoring operation interface provided for this application;
[0037] Figure 8 Flowchart of the log matching method provided in Example 8 of this application;
[0038] Figure 9 Diagram of the conversational robot provided for this application;
[0039] Figure 10 A schematic diagram of the structure of a log matching device provided in Example 9 of the present application;
[0040] Figure 11 This is a structural diagram of the electronic device provided in Example 10 of the present application.
[0041] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0042] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0043] The terms "first," "second," etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. In the description of the following embodiments, "plurality" means more than two, unless otherwise specifically defined.
[0044] In order to clearly understand the technical solution of the present application, the solution of the prior art is first introduced in detail.
[0045] In the prior art, when performing log matching, a keyword combination matching algorithm is usually used to match the key program log with the target program log. The keyword combination matching algorithm requires manual input of keywords in the source code print log as the key program log, and the keyword combination matching algorithm is used to traverse each key program log in the target program log to determine whether the keywords in the key program log are in any line of the target program log, and to search for the target program log that matches the key program log. Since the manually input keywords cannot contain all the words in the source code print log, the target program log that matches the key program log found based on the keywords in the key program log may not match the source code print log, and the target program log cannot correspond one-to-one with the source code print log, resulting in a low accuracy of the matching result. In addition, when the keyword combination matching algorithm is used for matching, the time complexity is high, which in turn leads to low matching efficiency.
[0046] Since the matching process requires matching target program logs that are consistent with the words in the key program log except for the parameter words, and the keyword combination matching algorithm requires manual input of keywords in the source code print log as the key program log, the manually input keywords cannot include all non-parameter words in the source code print log. Therefore, extracting all non-parameter words in the source code print log as the key program log can accurately match a key program log with a target program log. In addition, since the time complexity of the keyword combination matching algorithm is relatively high, a method that reduces the time complexity of the keyword combination matching algorithm can be used to match the key program log with the target program log. The inventors discovered that by identifying the parameter words in the source code print log and removing the parameter words from the source code print log to obtain a meta-program log, the meta-program log can contain all the non-parameter words in the source code print log. Using the meta-program log as the key program log and matching it with the target program log can determine the target program log that is consistent with the words in the key program log except for the parameter words, thereby improving the accuracy of the matching results. In addition, since the time complexity of the dynamic programming algorithm is lower than that of the keyword combination matching algorithm, using the dynamic programming algorithm for matching can reduce the time complexity and improve the efficiency of matching.
[0047] The following is an introduction to the application scenarios of the log matching method provided by this application.
[0048] The present application can be applied to daily monitoring scenarios of target objects. The target object can be a network device, system, or service program that generates a large number of target program logs during operation. Log information above the warning level can be scanned in real time to obtain monitoring results for the target object. Specifically, the target program log generated by the target object can be obtained in real time, along with a meta-program log extracted from non-parameter words that are crucial for locating faults. By determining whether the meta-program log can be converted into a target program log, it can be determined whether the target program log matches the meta-program log, thereby enabling daily monitoring.
[0049] This application can also be applied to knowledge base searches for target program logs. Specifically, users can enter the target program log text in the input box provided by the knowledge base. By determining whether the meta-program log can be converted into the target program log, matching meta-program logs are determined, and then the corresponding issues and handling experiences of the target program log are determined. This allows for more accurate retrieval of issues and handling experiences, while also improving knowledge search efficiency.
[0050] It is understandable that the log matching method provided in this application can also be applied to other related application scenarios, which will not be described in detail here.
[0051] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0052] Example 1
[0053] Figure 1 This is a flow chart of the log matching method provided in Example 1 of the present application. This example provides a log matching method to address the problem in the prior art of using keyword combination matching algorithms, which results in low matching accuracy and high time complexity, leading to low matching efficiency. The method in this example is applied to a log matching device, which can be located in an electronic device. The electronic device can be a digital computer in various forms, such as a cellular phone, smartphone, laptop computer, desktop computer, workstation, personal digital assistant, server, blade server, mainframe computer, and other suitable computers.
[0054] like Figure 1 As shown, the specific steps of this method are as follows:
[0055] Step S101: Acquire a key source code print log and a first target program log corresponding to a target object.
[0056] The key source code print log is a pre-configured program log that has a positioning function for at least one target sub-object in the target object or log search answer data of the target object, and the first target program log is a log generated by running the target object.
[0057] For example, during routine monitoring of a target object, the key source code print log can be a program log corresponding to at least one target sub-object, which can be used to locate and monitor the at least one target sub-object. The key source code print log can also be a program log with a warning level or higher, which can monitor the target object for faults and locate the at least one target sub-object that has a fault. When performing a knowledge base search for a first target program log, the key source code print log can be a program log that helps locate the answer data for the first target program log.
[0058] The embodiment of the present application does not specifically limit the method of obtaining the key source code print log and the first target program log corresponding to the target object.
[0059] Exemplarily, when obtaining the first target program log, a program log acquisition request can be initiated to the target object or the device corresponding to the target object, and the first target program log can be obtained by receiving the program log sent by the target object or the device corresponding to the target object. When obtaining the key source code print log corresponding to the target object, the corresponding key source code print log can be obtained from the database storing the source code print log according to the source code print log category selected by the user. For example, the source code print log can be classified according to the log level. The user can select the source code print log of the warning level as the key source code print log, obtain the source code print log of the warning level from the database storing the source code print log, and determine the source code print log of the warning level as the key source code print log.
[0060] Optionally, the first target program log and the key source code printing log may be stored in preset files respectively, and the first target program log and the key source code printing log may be obtained by the user inputting the preset file storage path.
[0061] Step S102: extract the corresponding meta-program log from the key source code print log.
[0062] The meta-program log includes all non-parameter words in the corresponding key source code print log.
[0063] In the embodiment of the present application, in the key source code print log, the first target program log, the meta-program log, and other logs, characters separated by a preset delimiter are words. The preset delimiter may be a space, a colon, or the like.
[0064] In the embodiment of the present application, the source code print log is a log print source code in the program code. The source code print log includes parameter words and non-parameter words. Among them, the words after the preset symbols are parameter words. The preset symbols are the percent sign "%" and the English semicolon " / ".
[0065] Specifically, the preset symbols in the key source code printing log can be identified, thereby identifying the parameter words in the key source code printing log, deleting the preset symbols and the non-parameter words after the preset symbols in the key source code printing log, and determining the key source code printing log after deleting the non-parameter words as a meta-program log.
[0066] It is understandable that other methods may be used to extract the corresponding meta-program log from the key source code print log, which is not limited in this embodiment.
[0067] For example, a key source code print log may be EXT4-fs error (device %s) in %s: %d: %s\n. %s, %d, and %s\n are parameter words. After removing the parameter words, the corresponding meta-program log is extracted as EXT4-fserror (device) in::.
[0068] Step S103: Using a dynamic programming algorithm, it is determined whether the meta-program log can be converted into the first target program log by inserting words.
[0069] Among them, the dynamic programming algorithm decomposes a problem into several sub-problems and seeks the best solution for each sub-problem. The best solution to the previous sub-problem provides effective information for the following sub-problems. The sub-problems are solved in sequence, and the last sub-problem is the best solution to the initial problem.
[0070] In an embodiment of the present application, the problem of determining whether a meta-program log can be converted into a first target program log can be decomposed into a sub-problem of determining whether the meta-program log can be converted into a first target program log for each word added to the meta-program log and / or the first target program log. The answer to whether the meta-program log can be converted into the first target program log before the word is added can provide a basis for determining whether the meta-program log can be converted into the first target program log after the word is added. For example, if the meta-program log cannot be converted into the first target program log before the word is added, then the meta-program log cannot be converted into the first target program log after the word is added.
[0071] In the embodiment of the present application, a word can be inserted into the meta-program log in the form of a stub word to obtain a matching first target program log. Therefore, by determining whether the first target program log can be obtained after inserting the word into the meta-program log, it can be determined whether the meta-program log can be converted into the first target program log.
[0072] Exemplarily, the meta-program log is EXT4-fs error(device)in::, if the first target program log is EXT4-fs error(device dm-0)in ext4_ext_truncate:4655:I0-failure, by entering the words dm-0, ext4_ext_truncate, 4655, and I0-failure into the meta-log program, the first target program log can be obtained, and the meta-program log can be converted into the first target program log; if the first target program log includes non-parameter words different from EXT4-fs, error, device, and in, the first target program log cannot be obtained by simply inserting words into the meta-program log, and the meta-program log cannot be converted into the first target program log.
[0073] Step S104: If it is determined that the log can be converted into the first target program log, the log that can be converted into the first target program log is determined as the second target program log, and a target program log matching the meta-program log is determined in the second target program log.
[0074] The second target program log is a program log that can be obtained by inserting a word into the meta-program log.
[0075] The matched target program log is a second target program log that matches the meta-program log, that is, a program log obtained by replacing parameter words in the key source code print log corresponding to the meta-program log with corresponding parameter values.
[0076] In the embodiment of the present application, there is no specific limitation on the method of determining the target program log that matches the meta-program log in the second target program log.
[0077] For example, the target program log that matches the meta-program log can be determined by determining whether the number of words inserted when converting the meta-program log to the first target program log is consistent with the number of parameter words in the corresponding key source code print log. Alternatively, the target program log that matches the meta-program log can be determined by determining the number of words in the second target program log and the number of words in the corresponding key source code print log.
[0078] In an embodiment of the present application, a key source code print log and a first target program log corresponding to a target object are obtained; a corresponding metaprogram log is extracted from the key source code print log; a dynamic programming algorithm is used to determine whether the metaprogram log can be converted into the first target program log by inserting a stub word; if it is determined that it can be converted into the first target program log, the log that can be converted into the first target program log is determined as the second target program log, and a target program log that matches the metaprogram log is determined in the second target program log. By extracting the metaprogram log from the key source code print log, it is determined whether the target program log matches the metaprogram log, and the target program log that matches the corresponding key source code print log is determined. Since the metaprogram log contains all non-parameter words in the key source code print log, the accuracy of the matching result can be improved. A dynamic programming algorithm is used to determine whether the metaprogram log can be converted into the first target program log by inserting a stub word to match the metaprogram log with the first target program log. Since the dynamic programming algorithm has a very low algorithm time complexity when performing text matching, the time complexity of the matching algorithm is greatly reduced, thereby improving the matching efficiency.
[0079] Example 2
[0080] Based on the first embodiment, this embodiment relates to an implementation method in which step S103 uses a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word, specifically including the following steps:
[0081] Step S201: Use a dynamic programming algorithm to traverse and calculate the value of the instrumented word quantity parameter corresponding to each meta-log word in the meta-program log and each target log word in the first target program log until the value of the instrumented word quantity parameter corresponding to the last meta-log word and the last target log word is traversed and calculated.
[0082] In the embodiment of the present application, the words included in the meta-program log are meta-log words, and the words included in the first target program log are target log words.
[0083] The embodiment of the present application does not specifically limit the method for determining the value of the instrumentation word quantity parameter corresponding to each meta-log word and each target log word in the first target program log.
[0084] The value of the instrumented word count parameter is: the number of words in the meta-log word and its preceding words that can be converted to the target log word and its preceding words through the instrumented word. Exemplarily, the meta-log word and its preceding words are the meta-log word and the words preceding it in the order of words in the meta-program log. The target log word and its preceding words are the target log word and the words preceding it in the order of words in the first target program log.
[0085] Specifically, the traversed meta log word and the traversed target log word are determined. When calculating the value of the next instrumentation word quantity parameter, the value of the instrumentation word quantity parameter corresponding to the next meta log word and the target log word can be calculated, or the value of the instrumentation word quantity parameter corresponding to the meta log word and the next target log word can be calculated, or the value of the instrumentation word quantity parameter corresponding to the next meta log word and the next target log word can be calculated.
[0086] Optionally, if it is determined that the meta log word and / or the target log word has not been traversed, the following steps are performed:
[0087] If the meta-log word in the meta-program log is not traversed, and the current target log word in the first target program log is traversed, the value of the corresponding instrumented word quantity parameter is determined to be the ranking value of the current target log word in the first target program log; if the meta-log word in the meta-program log is not traversed, and the target log word in the first target program log is not traversed, the value of the corresponding instrumented word quantity parameter is determined to be zero; if the meta-log word in the meta-program log is traversed, and the target log word in the first target program log is not traversed, the value of the corresponding instrumented word quantity parameter is determined to be a preset value, which represents a value that cannot be converted.
[0088] Figure 2 The embodiment of the present application provides a schematic diagram of the value of the parameter for determining the number of inserted words, as shown in FIG. Figure 2 As shown, the metalog word is the first row, and the order of the metalog words is: s1 is EXT4-fs, s2 is error, s3 is device, s4 is in, the target log word is the first column, and the order of the target log words is t1 is EXT4-fs, t2 is error, t3 is device, t4 is dm-0, t5 is in, t6 is ext4_ext_truncate, t7 is 4655, t8 is I0-failure, and the default value is -1. When the metalog word in the metaprogram log is not traversed, such as Figure 2The second column of each dynamic programming table shows that when the current meta-log word is s0 and the current target log words are t1-t8, the values of the instrumentation word quantity parameter are 1, 2, 3, 4, 5, 6, 7, and 7 respectively; when the meta-log word in the meta-program log is not traversed and the target log word in the first target program log is not traversed, as shown in FIG. Figure 2 The second column and second row of each dynamic programming table shown in the figure determines that the current meta-log word is s0 and the current target log word is t0, and the value of the number of instrumented words parameter is 0; when the target log word in the first target program log is not traversed, as shown in the figure, Figure 2 The second line shows that when the current meta-log words are s1-s4 and the current target log word is t0, the value of the instrumentation word quantity parameter is -1.
[0089] Optionally, if it is determined that the meta-log word and the target log word are traversed, a dynamic programming algorithm is used to traverse and calculate the value of the instrumentation word quantity parameter corresponding to each meta-log word in the meta-program log and each target log word in the first target program log, including the following steps:
[0090] Step S2011: Obtain a current meta-log word traversed in the meta-program log and a current target log word traversed in the first target program log.
[0091] In the embodiment of the present application, the meta-log words and the target log words are traversed in the order in the meta-program log and the first target program log until the meta-log words and the target log words are traversed in pairs.
[0092] For example, when traversing to the meta log word s i and target log word t j , and determine the metalog word s i and a target log word t j After the corresponding instrumentation word number parameter is taken, the meta log word s i Determine the current meta log word and set the target log word t j The target log word after t j+1 Determine the current meta log word and get the current meta log word s i and the current target log word t j+1 , and determine the current meta log word s i and the current target log word t j+1 The value of the instrumentation word count parameter.
[0093] The subscript of the meta-log word s indicates the order of the meta-log word in the meta-program log, and the subscript of the target log word t indicates the order of the target log word in the first target program log.
[0094] like Figure 2 As shown, after determining that the meta-log word and / or the target log word have not been traversed, the value of the instrumentation word quantity parameter corresponding to the target log word is not traversed. Figure 2 The third column of each dynamic programming table in the table determines the value of the instrumentation word quantity parameter when the current meta log word is s1 and the current target log words are t1-t8, as well as Figure 2 The third row of each dynamic programming table determines the value of the instrumentation word quantity parameter when the current meta log words are s2-s4 and the current target log word is t1; until the value of the instrumentation word quantity parameter is determined when the current meta log word is s4 and the current target log word is t8.
[0095] Step S2012: Determine the calculated instrumented word quantity parameter based on which the current instrumented word quantity parameter is calculated according to the current meta log word and the current target log word.
[0096] In an embodiment of the present application, depending on whether the current meta log word is equal to the current target log word, when calculating the current instrumented word quantity parameter, it is necessary to determine whether to use the instrumented word quantity parameter calculated based on the previous meta log word and the previous target log word, or the instrumented word quantity parameter calculated based on the current meta log word and the previous target log word.
[0097] Step S2013: Determine the current value of the instrumented word quantity parameter according to the calculated value of the instrumented word quantity parameter.
[0098] In an embodiment of the present application, one can be added to the calculated instrumented word number parameter, and the calculated instrumented word number parameter after adding one can be determined as the value of the current instrumented word number parameter, or the calculated instrumented word number parameter can be determined as the value of the current instrumented word number parameter.
[0099] The embodiment of the present application does not specifically limit the method for determining the value of the current instrumented word quantity parameter based on the calculated value of the instrumented word quantity parameter.
[0100] Step S202 : judging whether the meta-program log can be converted into the first target program log in the form of the instrumented words according to the values of the instrumented word quantity parameters corresponding to the last meta-log word and the last target log word.
[0101] In the implementation of this application, if the parameter for the number of instrumented words corresponding to the last meta-log word and the last target log word is a positive integer or zero, it can be determined that the meta-program log can be converted into the first target program log in the form of instrumented words. If the parameter for the number of instrumented words corresponding to the last meta-log word and the last target log word is a preset value, the meta-program log cannot be converted into the first target program log in the form of instrumented words. The preset value can be any non-positive integer and non-zero value.
[0102] In an embodiment of the present application, by using a dynamic programming algorithm with low time complexity to determine whether the word inserted in the meta-program log can be converted into the first target program log, and matching the meta-program log with the target program log, the time complexity of the matching algorithm can be reduced, thereby improving the matching efficiency.
[0103] Example 3
[0104] Figure 3 This is a flow chart of the log matching method provided in Example 3 of the present application. After determining the value of the instrumented word quantity parameter corresponding to the meta-log word that has not been traversed and / or the target log word that has not been traversed, the embodiment of the present application provides a detailed description of the use of a dynamic programming algorithm to traverse and calculate the value of the current instrumented word quantity parameter corresponding to the current meta-log word and the current target log word.
[0105] like Figure 3 As shown, the specific steps of this method are as follows:
[0106] Step S301: Obtain a current meta-log word traversed in a meta-program log and a current target log word traversed in a first target program log.
[0107] In the embodiment of the present application, the method of obtaining the current meta-log word traversed in the meta-program log and the current target log word traversed in the first target program log is similar to that in the second embodiment, and will not be repeated here.
[0108] Step S302: Determine whether the current meta log word is equal to the current target log word.
[0109] The embodiment of the present application does not specifically limit the method for determining whether the current meta log word is equal to the current target log word.
[0110] Exemplarily, a string matching method can be used to determine whether the current meta log word is equal to the current target log word. Specifically, a determination is made as to whether the characters and character arrangement order of the current meta log word and the current target log word are consistent. If the characters and character arrangement order of the current meta log word and the current target log word are consistent, the current meta log word and the current target log word are determined to be equal. If the characters and / or character arrangement order of the current meta log word and the current target log word are inconsistent, the current meta log word and the current target log word are determined to be unequal.
[0111] In the embodiment of the present application, if it is determined that the current meta log word is equal to the current target log word, step S303 is executed; if it is determined that the current meta log word is not equal to the current target log word, step S304 is executed.
[0112] Step S303: If it is determined that the current meta log word is equal to the current target log word, the calculated instrumented word quantity parameter used in calculating the current instrumented word quantity parameter is determined to be the instrumented word quantity parameter corresponding to the previous meta log word and the previous target log word.
[0113] In an embodiment of the present application, if the current meta log word is equal to the current target log word, the current meta log word is added after the previous meta log word. After the current target log word is added after the previous target log word, there is no need to insert any more words between the current meta log word and the words before it in the order. The current target log word and the words before it in the order can be obtained. The current instrumented word quantity parameter can be determined based on the instrumented word quantity parameters corresponding to the previous meta log word and the previous target log word.
[0114] In the embodiment of the present application, after determining the calculated instrumented word quantity parameter based on which the current instrumented word quantity parameter is calculated, step S305 is executed.
[0115] Step S304: If it is determined that the current meta log word is not equal to the current target log word, the calculated instrumented word quantity parameter used in calculating the current instrumented word quantity parameter is determined to be the instrumented word quantity parameter corresponding to the current meta log word and the previous target log word.
[0116] In an embodiment of the present application, if the current meta-log word is not equal to the current target log word, after determining that the current meta-log word is converted to the instrumented word quantity parameter corresponding to the previous target log word, a word is inserted after the previous target log word. This word is the current target log word, and the current target log word and the word before it can be obtained. Therefore, the current instrumented word quantity parameter can be determined based on the instrumented word quantity parameter corresponding to the current meta-log word and the previous target log word.
[0117] Figure 4 This is a diagram of determining the value of the current instrumentation word quantity parameter when the current meta log word provided by this application is not equal to the current target log word. Figure 4 As shown in the figure, the current meta log word is s3, the current target log word is t4, and s3 is device, t4 is dm-0, then the current meta log word s3 is not equal to the current target log word t4; after determining the number of instrumentation words corresponding to s1, s2, and s3 converted to t1, t2, and t3, as shown in the figure, Figure 2 If the value of the instrumentation word quantity parameter is 0, and the current meta-log word s3 is determined to be unequal to the current target log word t4, the value of the instrumentation word quantity parameter corresponding to the current meta-log word s3 and the previous target log word t3 can be used to determine the value of the current instrumentation word quantity parameter. Since s1, s2, and s3 are converted to t1, t2, and t3, the word dm-0 is inserted after t1, t2, and t3. In other words, after adding 1 to the instrumentation word quantity parameter corresponding to the conversion of s1, s2, and s3 to t1, t2, and t3, the value of the instrumentation word quantity parameter corresponding to the conversion of s1, s2, and s3 to t1, t2, and t3 can be obtained. Specifically, the value of the instrumentation word quantity parameter corresponding to the current meta-log word s3 and the current target log word t4 is determined to be 1.
[0118] In the embodiment of the present application, if it is determined that the current meta-log word is not equal to the current target log word, after determining the calculated instrumented word quantity parameter based on which the current instrumented word quantity parameter is calculated, step S306 and subsequent steps are executed.
[0119] Step S305: If it is determined that the current meta log word is equal to the current target log word, the value of the calculated instrumented word quantity parameter is determined as the value of the current instrumented word quantity parameter.
[0120] In an embodiment of the present application, if the current meta log word is equal to the current target log word, then after adding the same word after the previous meta log word and the previous target log word, there is no need to insert any more words into the current meta log word and the words before it. The corresponding instrumented word quantity parameter value remains unchanged, and it can be converted into the current target log word and the words before it. Therefore, by obtaining the current target log word and the words before it, the instrumented word quantity parameter corresponding to the previous meta log word and the previous target log word can be determined as the value of the current instrumented word quantity parameter.
[0121] Specifically, if the current meta-log word is s i , current target log word t j , and s i =t j, then d[i,j]=d[i-1,j-1]. Where d[i,j] represents the meta-log word s i , the target log word is t j Parameter for the number of words to be instrumented, d[i-1,j-1] indicates that the meta log word is s i-1 , the target log word is t j-1 The number of words to instrument.
[0122] Figure 5 This is a schematic diagram of determining the value of the current instrumentation word quantity parameter when the current meta log word provided by this application is equal to the current target log word. Figure 5 As shown, for example, the current meta log word is s4, the current target log word is t5, and s4 is in, t5 is also in, then the current meta log word s4 is equal to the current target log word t5; the previous meta log word is s3, the previous target log word is t4, in the previous meta log word and the previous meta log words s1, s2, s3, that is, EXT4-fs, error, device, insert a word dm-0, you can get the previous target log word and the previous target log words t1, t2, t3, t4, that is, get EXT4-fs, error, device, dm-0, the previous meta log word and the previous target log word corresponding to the number of plug-in words parameter is 1; in the previous meta log word and the previous meta log word Based on s1, s2, s3, and the previous target log word and its previous target log words t1, t2, t3, and t4, the current meta log word s4 and the current target log word t5, which are equal, are added at the same time. Without inserting other words, the words s1, s2, s3, s4 before the current meta log word and the words t1, t2, t3, t4, and t5 before the current target log word can be obtained. The instrumentation words for converting s1, s2, s3, and s4 to t1, t2, t3, t4, and t5 are the same as the instrumentation words for converting s1, s2, and s3 to t1, t2, t3, and t4, both of which are words dm-0. Adding the same meta log word and target log word at the same time does not affect the corresponding instrumentation word quantity parameter, and the current instrumentation word quantity parameter is also 1.
[0123] Step S306: If it is determined that the current meta log word is not equal to the current target log word, it is determined whether the value of the calculated instrumented word quantity parameter is a preset value.
[0124] The preset value indicates a value that cannot be converted.
[0125] Specifically, if it is determined that the current meta log word is not equal to the current target log word, it is determined whether the instrumented word quantity parameter corresponding to the current meta log word and the previous target log word is a preset value; if the instrumented word quantity parameter corresponding to the current meta log word and the previous target log word is a preset value, step S307 is executed; if the instrumented word quantity parameter corresponding to the current meta log word and the previous target log word is not a preset value, step S308 is executed.
[0126] Step S307: If the value of the calculated instrumented word quantity parameter is determined to be the preset value, then the value of the current instrumented word quantity parameter is determined to be the preset value.
[0127] In an embodiment of the present application, if the parameter for the number of inserted words corresponding to the current meta-log word and the previous target log word is a preset value, the previous target log word and the word before it cannot be obtained by inserting words into the current meta-log word and the word before it, and the current target log word, the previous target log word and the previous target log word cannot be obtained by inserting words into the current meta-log word and the word before it. It can be determined that the value of the current parameter for the number of inserted words is the preset value.
[0128] Step S308: If it is determined that the value of the calculated instrumented word quantity parameter is not the preset value, the value of the current instrumented word quantity parameter is determined to be the sum of the calculated value of the instrumented word quantity parameter and the value 1.
[0129] In an embodiment of the present application, if the number of inserted words parameter corresponding to the current meta log word and the previous target log word is not a preset value, the previous target log word and the word before it can be obtained by inserting the calculated number of words of the number of inserted words parameter into the current meta log word and the word before it, and the current target log word can be obtained by inserting the calculated number of words of the number of inserted words parameter into the current meta log word and the word before it, as well as the current target log word, and the current target log word can be used to determine that the value of the current number of inserted words parameter is the value of the calculated number of inserted words parameter. value and the value 1.
[0130] In an embodiment of the present application, the value of the current instrumented word quantity parameter corresponding to the current meta-log word and the current target log word is determined, and a dynamic programming algorithm is used to determine whether the value of the instrumented word quantity parameter corresponding to the last meta-log word and the last target log word is a preset value, thereby judging whether the first target program log can be converted into a meta-program log. Since the dynamic programming algorithm has a very low algorithm time complexity when performing text matching, the time complexity of the matching algorithm is greatly reduced, thereby improving the matching efficiency.
[0131] Example 4
[0132] Based on the first embodiment, this embodiment relates to an implementation method of determining the target program log that matches the meta-program log in the second target program log in step S104, which specifically includes the following steps:
[0133] Step S401: For each second target program log, determine the number of instrumented words converted from the meta-program log to the second target program log.
[0134] In an embodiment of the present application, when a dynamic programming algorithm is used to determine whether a meta-program log can be converted into a first target program log in the form of an instrumented word, the value of the instrumented word number parameter corresponding to the last meta-log word and the last target log word determined is determined as the number of instrumented words converted from the meta-program log into the corresponding second target program log.
[0135] Step S402: Determine the number of parameters in the key source code print log corresponding to the meta-program log.
[0136] In an embodiment of the present application, the number of parameters in the key source code print log corresponding to the meta-program log can be determined by identifying the number of percent signs in the key source code print log corresponding to the meta-program log.
[0137] Step S403: Determine a matching target program log in the second target program log according to the number of instrumented words and the number of parameters.
[0138] In the embodiment of the present application, the method for determining the matching target program log is not specifically limited. An optional method includes the following steps:
[0139] Step S4031: Compare the number of instrumented words and the number of parameters.
[0140] Specifically, the number of instrumented words converted from the meta-program log to the second target program log is compared with the number of parameters in the key source code print log corresponding to the meta-program log to determine whether the number of instrumented words is equal to the number of parameters; if the number of instrumented words is equal to the number of parameters, step S4032 is executed; if the number of instrumented words is not equal to the number of parameters, the second target program log is executed as a target program log that does not match.
[0141] Step S4032: Determine a third target program log in the second target program log in which the number of instrumented words is equal to the number of parameters.
[0142] The third target program log is a second target program log converted from the meta-program log, in which the number of instrumented words is equal to the number of parameters in the key source code print log corresponding to the meta-program log.
[0143] Specifically, if it is determined that the number of instrumented words converted from the meta-program log to the second target program log is equal to the number of parameters in the key source code print log corresponding to the meta-program log, the second target program log is determined as the third target program log.
[0144] Step S4033: Determine the third target program log as a matching target program log.
[0145] In an embodiment of the present application, a meta-program log can be converted into a third target program log, and the number of instrumented words is equal to the number of parameters in the key source code print log corresponding to the meta-program log. The third target program log is a target program log that matches the meta-program log.
[0146] In an embodiment of the present application, a first target program log that can be converted from a metaprogram log in the form of instrumented words is determined as a second target program log, and a second target program log whose number of corresponding instrumented words is equal to the number of parameters in a key source code print log is determined as a matching target program log. The number of words in the matching target program log is consistent with the number of words in the corresponding key source code print log, and both contain words in the metaprogram log. The matching target program log is more accurate, and the matching accuracy can be improved.
[0147] Example 5
[0148] Based on any of the above embodiments, the present embodiment relates to a log matching method embodiment based on converting a meta-log word into a first digital number and converting a target log word into a second digital number, specifically comprising the following steps:
[0149] Step S501: Acquire a key source code print log and a first target program log corresponding to a target object, and extract a corresponding meta-program log from the key source code print log.
[0150] Among them, the key source code printing log is a pre-configured program log that has a positioning function for the log search answer data of at least one target sub-object or target object in the target object; the first target program log is the log generated by running the target object; the meta-program log includes all non-parameter words in the corresponding key source code printing log.
[0151] Step S502: Determine a first digital number corresponding to each meta-log word in the meta-program log and a second digital number corresponding to each target log word in the first target program log.
[0152] In the meta-program log and the first target program log, words separated by a preset delimiter are words. The preset delimiter may be a space, a colon, or the like.
[0153] Specifically, the correspondence between words and digital numbers is determined, and the first digital number corresponding to each meta-log word in the meta-program log is determined in sequence according to the correspondence between words and digital numbers, and the second digital number corresponding to each target log word in the first target program log is determined in sequence.
[0154] The embodiment of the present application does not specifically limit the method for determining the correspondence between words and digital numbers. For example, the correspondence between words and digital numbers can be determined by uniquely numbering the words.
[0155] The first digital number is the digital number corresponding to the meta-log word, and the second digital number is the digital number corresponding to the target log word. The digital number is a unique identifier for each non-repeated word. One word corresponds to one digital number, and the same word has the same digital number.
[0156] Step S503: A dynamic programming algorithm is used to determine whether the first digital number corresponding to the meta-program log can be converted into the second digital number corresponding to the first target program log by using the digital number corresponding to the instrumented word.
[0157] In an embodiment of the present application, a matching second digital number can be obtained by inserting a digital number into a first digital number in the form of a plug-in digital number. Whether the second digital number can be obtained after inserting the digital number into the first digital number can be determined to determine whether the first digital number can be converted to the second digital number. By determining whether the first digital number can be converted to the second digital number by inserting the digital number, the determination result can be obtained without comparing the characters in the word, which can improve the determination efficiency.
[0158] Step S504: If it is determined that the second digital number corresponding to the first target program log can be converted, the first target program log is determined as the second target program log, and a target program log matching the meta-program log is determined in the second target program log.
[0159] Specifically, after determining that the first digital number can be converted into the second digital number, the first target program log corresponding to the second digital number is determined as the second target program log, and by judging whether the number of plug-in digital numbers corresponding to the second target program log is equal to the number of parameter words in the key source code print log corresponding to the meta-program log, if the number of plug-in digital numbers is equal to the number of parameter words, then the second target program log is determined to be the target program log that matches the meta-program log.
[0160] In an embodiment of the present application, the meta-log word is converted into a first digital number and the target log word is converted into a second digital number. When a dynamic programming algorithm is used to determine whether the first digital number can be converted into the second digital number by inserting a digital number, the judgment result can be obtained without comparing the characters in the word, which can improve the judgment efficiency and further improve the matching efficiency.
[0161] Example 6
[0162] Based on any of the above embodiments, the embodiment of the present application relates to a process of obtaining a key source code print log according to a log dictionary after determining a target program log that matches a meta-program log in the second target program log in step S104, specifically comprising the following steps:
[0163] Step S601: Obtain a log dictionary corresponding to a pre-built meta-program log.
[0164] The log dictionary stores the attribute information of the meta-program log.
[0165] In the implementation of this application, the key source code printing log contains corresponding attribute information.
[0166] Optionally, after extracting the corresponding meta-program log from the key source code printing log in step S102, a log dictionary corresponding to the meta-program log can be constructed based on the attribute information contained in the key source code printing log. The embodiment of the present application does not specifically limit the method of constructing the log dictionary corresponding to the meta-program log.
[0167] Optionally, the log dictionary corresponding to the meta-program log may include the number of parameters. When determining a target program log that matches the meta-program log, the number of parameters can be determined by obtaining the log dictionary, and the matching target program log can be determined based on the number of parameters and the number of instrumented words. The number of parameters refers to the number of parameters in the key source code print log corresponding to the meta-program log.
[0168] Specifically, the pre-built log dictionary may be stored in a database, and the log dictionary corresponding to the pre-built meta-program log may be obtained by accessing the database.
[0169] Step S602: Acquire the key source code print log corresponding to the matching target program log according to the attribute information of the meta-program log.
[0170] Optionally, the attribute information of the meta-program log includes: the number of parameters, the log level, the target sub-object to which the log belongs, and the first digital number corresponding to each meta-log word in the meta-program log.
[0171] Specifically, the key source code printing log with the same attribute information as the meta-program log can be searched and obtained in the database storing the key source code printing log. The key source code printing log with the same attribute information as the meta-program log is the key source code printing log corresponding to the matching target program log.
[0172] In an embodiment of the present application, obtaining attribute information in a pre-constructed log dictionary can improve the efficiency of obtaining attribute information corresponding to the meta-program log, that is, improve the efficiency of obtaining attribute information corresponding to the matching target program log; it is also possible to obtain the corresponding key source code print log based on the attribute information, thereby improving the efficiency of obtaining the corresponding key source code print log.
[0173] Example 7
[0174] Figure 6 This is a flow chart of the log matching method provided in Example 7 of this application. The log matching method provided in Example 7 of this application can be applied to the monitoring process of the target object. Figure 6 As shown, the method specifically includes the following steps:
[0175] Step S701: Receive a monitoring request for a target object triggered by a user.
[0176] The target object includes multiple target sub-objects. For example, the target object may be a system, which includes multiple sub-functions or sub-systems, each of which is a target sub-object.
[0177] In the embodiment of the present application, a target object monitoring operation interface can be provided. Figure 7 The target object monitoring operation interface diagram provided for this application is as follows: Figure 7 As shown, the user can trigger a monitoring request for the target object by clicking the monitoring button provided in the target object monitoring operation interface.
[0178] Step S702: Obtain the meta-program log and the first target program log corresponding to the target object according to the monitoring request.
[0179] The meta-program log is obtained by pre-extracting non-parameter words from the key source code print log; the key source code print log is a pre-configured program log that has a positioning function for at least one target sub-object in the target object.
[0180] Specifically, a key source code print log and a first target program log corresponding to the target object are obtained, and non-parameter word extraction is performed on the key source code print log to obtain a meta-program log.
[0181] The embodiment of the present application does not specifically limit the method of obtaining the meta-program log and the first target program log corresponding to the target object. For example, the identifier of the target object can be entered in the target object monitoring page. If the target object is a system, the system name can be entered. The device corresponding to the target object can be accessed according to the identifier of the target object to obtain the first target program log.
[0182] For example, the key source code print log corresponding to the target object can be pre-configured, such as Figure 7 As shown, the target object monitoring page can also provide a target object identification input control. After the user enters the target object identification and triggers the monitoring request for the target object, the key source code print log corresponding to the pre-configured target object can be obtained, and the first target program log corresponding to the target object can be obtained by accessing the target object or by accessing the device corresponding to the target object.
[0183] The embodiment of the present application does not limit the method of pre-configuring the key source code printing log corresponding to the target object. For example, the target sub-object and log level of the log corresponding to the source code printing log can be identified, and the source code printing log whose target sub-object belongs to the target object and whose log level is above the warning level is determined as the key source code printing log corresponding to the target object.
[0184] Step S703: Using a dynamic programming algorithm, it is determined whether the meta-program log can be converted into the first target program log by inserting words.
[0185] Step S704: If it is determined that the log can be converted into the first target program log, the log that can be converted into the first target program log is determined as the second target program log, and a target program log matching the meta-program log is determined in the second target program log.
[0186] Step S705: Determine the target sub-object corresponding to the matching target program log to obtain the monitoring result corresponding to the target sub-object.
[0187] Specifically, determine the meta-program log corresponding to the matching target program log, and determine the key source code printing log corresponding to the meta-program log, determine the target sub-object to which the log contained in the key source code printing log information belongs through the key source code printing log, determine the target sub-object to which the log belongs as the target sub-object corresponding to the matching target program log, and confirm the monitoring result corresponding to the target sub-object.
[0188] The monitoring result corresponding to the target sub-object may be the target program logs and the number of target program logs that match the target sub-objects at the warning level or above. The monitoring result corresponding to the target sub-object may also be the health of the target sub-object.
[0189] For example, Figure 7 As shown, after determining the target sub-object corresponding to the matching target program log, the target sub-object corresponding to the matching target program log and the monitoring result corresponding to the target sub-object can be displayed on the target object monitoring page. Figure 7 As shown in , the target sub-objects corresponding to the matched target program log include: target sub-object B and target sub-object C. The monitoring result of the target sub-object identified as B and the monitoring result of the target sub-object identified as C can be displayed.
[0190] In embodiments of the present application, in a scenario where a target object is being monitored, the accuracy of the matching results can be improved by extracting metaprogram logs from key source code print logs and determining whether the target program logs match the metaprogram logs. This further improves the accuracy of the monitoring results corresponding to the target sub-objects. Using a dynamic programming algorithm to perform matching via inserting words can reduce the time complexity of the matching algorithm, thereby improving matching efficiency and further improving the efficiency of determining matching target sub-objects and monitoring results.
[0191] Example 8
[0192] Figure 8 This is a flow chart of the log matching method provided in Example 8 of the present application. The log matching method provided in Example 8 of the present application can be applied to the search process of the target program log.
[0193] like Figure 8 As shown, the method specifically includes the following steps:
[0194] Step S801: Receive a log search request corresponding to a target object triggered by a user.
[0195] The log search request includes the target program log.
[0196] In the embodiment of the present application, the target program log may be a log generated when the target object fails. The user may obtain corresponding answer data by triggering a log search request corresponding to the target object and process the target object failure according to the corresponding answer data.
[0197] For example, the log matching method provided in Example 8 of the present application can be applied to a conversational robot. Figure 9 The diagram of the conversation robot provided for this application is as follows: Figure 9 As shown, the user can enter the target program log EXT4-fs error (device dm-0) in ext4_ext_truncate:4655:I0-failure in the text box provided by the dialogue robot and click the Send button to trigger the target program log search request.
[0198] Step S802: Acquire multiple pre-stored meta-program logs according to the log search request.
[0199] Among them, the meta-program log is obtained by pre-extracting non-parameter words from the key source code print log; the key source code print log is a pre-configured program log that has a positioning function for the log search answer data of the target object.
[0200] In an embodiment of the present application, the knowledge base stores key source code printing logs and corresponding knowledge and experience summaries, such as troubleshooting methods. Key source code printing logs are logs mentioned by knowledge base users when sharing their experiences within the knowledge base. After obtaining the key source code printing logs mentioned by knowledge base users when sharing their experiences within the knowledge base, non-parametric word extraction is performed on the key source code printing logs to obtain the meta-program logs corresponding to the key source code printing logs.
[0201] Step S803: Use a dynamic programming algorithm to determine whether each meta-program log can be converted into a target program log by inserting a word.
[0202] Step S804: If it is determined that the log can be converted into the target program log, the corresponding meta-program log is determined as a meta-program log that matches the target program log.
[0203] Specifically, if a certain meta-program log can be converted into a target program log in the form of an instrumented word, the meta-program log is determined as a meta-program log that matches the target program log.
[0204] Step S805: Output answer data corresponding to the matched meta-program log to the user.
[0205] Specifically, after determining the meta-program log that matches the target program log, the key source code print log corresponding to the meta-program log and the answer data corresponding to the key source code print log are searched in the knowledge base, thereby determining the answer data corresponding to the matching meta-program log.
[0206] Among them, the output answer data can be a URL including the answer corresponding to the key source code printing log, or it can be a text including the answer corresponding to the key source code printing log. The embodiment of the present application does not make specific limitations on this.
[0207] For example, Figure 9 As shown, after the user enters the target program log, a URL (www.abcd.efg) containing the key source code corresponding to the target program log and the corresponding answer to the log can be displayed to the user. This URL does not exist in reality and is only for illustration. By viewing this URL, the user can gain knowledge and experience related to the target program log.
[0208] In an embodiment of the present application, a dynamic programming algorithm is employed to determine whether each metaprogram log can be converted into a target program log by inserting a word, thereby determining a metaprogram log that matches the target program log. This improves the efficiency of determining a metaprogram log that matches the target program log and reduces the response time for outputting answer data to a user in response to a log search request. Furthermore, because the metaprogram log is obtained by pre-processing non-parameter words from a key source code print log and includes all non-parameter words in the key source code print log, determining a metaprogram log that matches the target program log can improve the accuracy of finding the key source code print log corresponding to the metaprogram log and improve the accuracy of obtaining answer data corresponding to the target program log.
[0209] Embodiment 9
[0210] Figure 10 This is a structural diagram of the log matching device provided in Example 9 of this application. The log matching device provided in this embodiment of the application can execute the processing flow provided in Example 1 of the log matching method. Figure 10 As shown, the log matching device 90 includes: an acquisition module 901 , an extraction module 902 , a judgment module 903 , and a determination module 904 .
[0211] Specifically, the acquisition module 901 is used to obtain the key source code printing log and the first target program log corresponding to the target object. The key source code printing log is a pre-configured program log that has a positioning function for at least one target sub-object in the target object or the log search answer data of the target object. The first target program log is the log generated by running the target object.
[0212] The extraction module 902 is configured to extract the corresponding meta-program log from the key source code print log, where the meta-program log includes all non-parameter words in the corresponding key source code print log.
[0213] The judgment module 903 is configured to use a dynamic programming algorithm to judge whether the meta-program log can be converted into the first target program log by inserting a word.
[0214] The determination module 904 is configured to determine the log that can be converted into the first target program log as the second target program log if it is determined that the log can be converted into the first target program log, and determine the target program log that matches the meta-program log in the second target program log.
[0215] The device provided in the embodiment of the present application can be specifically used to execute the method embodiment provided in the above-mentioned embodiment 1, and the specific functions will not be repeated here.
[0216] Optionally, the determination module 904 includes: a first determination unit, a second determination unit, and a third determination unit; the first determination unit is used to: determine, for each second target program log, the number of instrumented words converted from the meta-program log to the second target program log; the second determination unit is used to: determine the number of parameters in the key source code print log corresponding to the meta-program log; the third determination unit is used to: determine a matching target program log in the second target program log based on the number of instrumented words and the number of parameters.
[0217] Optionally, the third determination unit is specifically configured to: compare the number of instrumented words and the number of parameters; determine a third target program log in the second target program log in which the number of instrumented words is equal to the number of parameters; and determine the third target program log as a matching target program log.
[0218] Optionally, the judgment module 903 includes: a calculation unit and a judgment unit; the calculation unit is used to: use a dynamic programming algorithm to traverse and calculate the value of the instrumented word quantity parameter corresponding to each meta-log word in the meta-program log and each target log word in the first target program log until the traversal and calculation reach the value of the instrumented word quantity parameter corresponding to the last meta-log word and the last target log word; the judgment unit is used to: determine whether the meta-program log can be converted into the first target program log in the form of instrumented words based on the value of the instrumented word quantity parameter corresponding to the last meta-log word and the last target log word.
[0219] Optionally, the calculation unit is specifically used to: obtain the current meta-log word traversed in the meta-program log and the current target log word traversed in the first target program log; determine the calculated instrumented word quantity parameter based on which the current instrumented word quantity parameter is calculated based on the current meta-log word and the current target log word; and determine the value of the current instrumented word quantity parameter based on the value of the calculated instrumented word quantity parameter.
[0220] Optionally, the calculation unit is specifically used to: determine whether the current meta log word is equal to the current target log word; if it is determined that the current meta log word is equal to the current target log word, then determine that the calculated instrumentation word quantity parameter based on which the current instrumentation word quantity parameter is calculated is the instrumentation word quantity parameter corresponding to the previous meta log word and the previous target log word; if it is determined that the current meta log word is not equal to the current target log word, then determine that the calculated instrumentation word quantity parameter based on which the current instrumentation word quantity parameter is calculated is the instrumentation word quantity parameter corresponding to the current meta log word and the previous target log word.
[0221] Optionally, the calculation unit is specifically configured to: if it is determined that the current meta log word is equal to the current target log word, determine the value of the calculated instrumented word quantity parameter as the value of the current instrumented word quantity parameter.
[0222] Optionally, the calculation unit is specifically used to: if it is determined that the current meta-log word is not equal to the current target log word, then determine whether the value of the calculated instrumented word quantity parameter is a preset value, and the preset value indicates a value that cannot be converted; if it is determined that the value of the calculated instrumented word quantity parameter is a preset value, then determine the value of the current instrumented word quantity parameter to be the preset value; if it is determined that the value of the calculated instrumented word quantity parameter is not a preset value, then determine the value of the current instrumented word quantity parameter to be the sum of the value of the calculated instrumented word quantity parameter and the value 1.
[0223] Optionally, the judgment module 903 also includes: a fourth determination unit; the fourth determination unit is used to: if the meta-log word in the meta-program log is not traversed, and the target log word in the first target program log is traversed, then determine that the value of the corresponding instrumentation word quantity parameter is the ranking value of the current target log word in the first target program log; if the meta-log word in the meta-program log is not traversed, and the target log word in the first target program log is not traversed, then determine that the value of the corresponding instrumentation word quantity parameter is zero; if the meta-log word in the meta-program log is traversed, and the target log word in the first target program log is not traversed, then determine that the value of the corresponding instrumentation word quantity parameter is a preset value, and the preset value indicates a value that cannot be converted.
[0224] Optionally, the log matching device 90 further includes: a number determination module; the number determination module is used to: determine the first digital number corresponding to each meta-log word in the meta-program log and the second digital number corresponding to each target log word in the first target program log; the judgment module 903 is further used to: use a dynamic programming algorithm to determine whether the first digital number corresponding to the meta-program log can be converted into the second digital number corresponding to the first target program log in the form of the digital number corresponding to the instrumented word.
[0225] Optionally, the acquisition module 901 is further configured to: acquire a pre-built log dictionary corresponding to a meta-program log, wherein the log dictionary stores attribute information of the meta-program log; and acquire a key source code print log corresponding to a matching target program log according to the attribute information of the meta-program log.
[0226] Optionally, the attribute information of the meta-program log includes: the number of parameters, the log level, the target sub-object to which the log belongs, and the first digital number corresponding to each meta-log word in the meta-program log.
[0227] The device provided in the embodiment of the present application can be specifically used to execute any method embodiment of the above-mentioned embodiment 2 to embodiment 5, and the specific functions are not repeated here.
[0228] The present application also provides a log matching device that can execute the processing flow provided in the seventh embodiment of the log matching method. The log matching device includes: a receiving module, a log acquisition module, a judgment module, a log determination module, and a child object determination module.
[0229] Specifically, the receiving module is used to receive a monitoring request for a target object triggered by a user, where the target object includes multiple target sub-objects.
[0230] The log acquisition module is used to: obtain the meta-program log and the first target program log corresponding to the target object according to the monitoring request. The meta-program log is obtained by pre-extracting non-parameter words from the key source code print log; the key source code print log is a pre-configured program log that has a positioning function for at least one target sub-object in the target object.
[0231] The judgment module is used to: use a dynamic programming algorithm to judge whether the meta-program log can be converted into the first target program log in the form of an inserted word.
[0232] The log determination module is used to: if it is determined that the log can be converted into the first target program log, determine the log that can be converted into the first target program log as the second target program log, and determine the target program log that matches the meta-program log in the second target program log.
[0233] The sub-object determination module is used to determine the target sub-object corresponding to the matched target program log to obtain the monitoring result corresponding to the target sub-object.
[0234] The device provided in the embodiment of the present application can be specifically used to execute the method embodiment provided in the above-mentioned embodiment seven, and the specific functions will not be repeated here.
[0235] The present application also provides a log matching device that can execute the processing flow provided in the log matching method embodiment 8. The log matching device includes: a receiving module, an acquiring module, a judging module, a determining module, and an output module.
[0236] Specifically, the receiving module is used to receive a log search request corresponding to a target object triggered by a user, where the log search request includes a target program log.
[0237] The acquisition module is used to obtain multiple pre-stored meta-program logs according to the log search request. The meta-program logs are obtained by pre-extracting non-parameter words from the key source code print logs. The key source code print logs are pre-configured program logs that have a positioning function for the log search answer data of the target object.
[0238] The judgment module is used to use a dynamic programming algorithm to judge whether each meta-program log can be converted into a target program log in the form of an instrumented word.
[0239] The determination module is used for: if it is determined that the meta-program log can be converted into the target program log, determining the corresponding meta-program log as the meta-program log that matches the target program log.
[0240] The output module is used to output the answer data corresponding to the matching meta-program log to the user.
[0241] The device provided in the embodiment of the present application can be specifically used to execute the method embodiment provided in the above-mentioned embodiment 8, and the specific functions will not be repeated here.
[0242] Example 10
[0243] Figure 11 This is a schematic diagram of the structure of the electronic device provided in Example 10 of this application. Figure 11 As shown, the electronic device 100 includes: a processor 1001 , a memory 1002 , a transceiver 1003 , and computer-executable instructions stored in the memory 1002 and executable on the processor 1001 .
[0244] The processor 1001, the memory 1002 and the transceiver 1003 are interconnected; the transceiver 1003 is used to send and receive data; and the processor 1001 implements the log matching method provided by any of the above method embodiments when running computer execution instructions.
[0245] An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the method provided by any of the above method embodiments is implemented.
[0246] An embodiment of the present application also provides a computer program product, which includes: computer execution instructions, which are stored in a readable storage medium. At least one processor of an electronic device can read the computer execution instructions from the readable storage medium, and at least one processor executes the computer execution instructions so that the electronic device executes the method provided by any of the above method embodiments.
[0247] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0248] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A log matching method, characterized in that: include: Obtaining a key source code print log and a first target program log corresponding to the target object, wherein the key source code print log is a pre-configured program log that has a locating function for at least one target sub-object in the target object or log search answer data of the target object, and the first target program log is a log generated by running the target object; Extracting a corresponding metaprogram log from the key source code print log, wherein the metaprogram log includes all non-parameter words in the corresponding key source code print log; Using a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word; If it is determined that the log can be converted into the first target program log, the log that can be converted into the first target program log is determined as the second target program log, and a target program log matching the meta-program log is determined in the second target program log; The method of using a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word includes: Using a dynamic programming algorithm to traverse and calculate the value of the instrumented word quantity parameter corresponding to each meta-log word in the meta-program log and each target log word in the first target program log, until the value of the instrumented word quantity parameter corresponding to the last meta-log word and the last target log word is traversed and calculated; It is determined whether the meta-program log can be converted into the first target program log in the form of the instrumented words according to the values of the instrumented word quantity parameters corresponding to the last meta-log word and the last target log word.
2. The method according to claim 1, characterized in that The determining, in the second target program log, a target program log that matches the meta-program log includes: For each second target program log, determining the number of instrumented words converted from the meta-program log to the second target program log; Determining the number of parameters in the key source code print log corresponding to the meta-program log; A matching target program log is determined in the second target program log according to the number of the instrumented words and the number of the parameters.
3. The method according to claim 1, characterized in that The method of using a dynamic programming algorithm to traverse and calculate the value of the instrumentation word quantity parameter corresponding to each meta-log word in the meta-program log and each target log word in the first target program log includes: Obtaining a current meta-log word traversed in the meta-program log and a current target log word traversed in the first target program log; Determining, based on the current meta-log word and the current target log word, a calculated instrumentation word quantity parameter to be used when calculating the current instrumentation word quantity parameter; The value of the current instrumented word quantity parameter is determined according to the value of the calculated instrumented word quantity parameter.
4. The method according to claim 3, characterized in that The calculated instrumented word quantity parameter based on which the current instrumented word quantity parameter is calculated according to the current meta log word and the current target log word includes: Determine whether the current meta-log word is equal to the current target log word; If it is determined that the current meta log word is equal to the current target log word, the calculated instrumented word quantity parameter based on which the current instrumented word quantity parameter is calculated is determined to be the instrumented word quantity parameter corresponding to the previous meta log word and the previous target log word; If it is determined that the current meta log word is not equal to the current target log word, the calculated instrumented word quantity parameter based on which the current instrumented word quantity parameter is calculated is determined to be the instrumented word quantity parameter corresponding to the current meta log word and the previous target log word.
5. The method according to claim 4, characterized in that If it is determined that the current meta log word is equal to the current target log word, then determining the value of the current instrumented word quantity parameter according to the value of the calculated instrumented word quantity parameter includes: If it is determined that the current meta log word is equal to the current target log word, the value of the calculated instrumented word quantity parameter is determined as the value of the current instrumented word quantity parameter.
6. The method according to claim 4, characterized in that If it is determined that the current meta log word is not equal to the current target log word, then the value of the current instrumentation word quantity parameter is determined based on the value of the calculated instrumentation word quantity parameter, including: If it is determined that the current meta log word is not equal to the current target log word, determining whether the value of the calculated instrumented word quantity parameter is a preset value, where the preset value indicates a value that cannot be converted; If the value of the calculated parameter for the number of inserted words based on which the determination is based is the preset value, then determining the value of the current parameter for the number of inserted words to be the preset value; If the value of the calculated instrumented word quantity parameter is not the preset value, the value of the current instrumented word quantity parameter is determined to be the sum of the value of the calculated instrumented word quantity parameter and the value 1.
7. The method according to any one of claims 1 to 6, characterized in that Before using the dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of the instrumented word, the method further includes: Determine a first digital number corresponding to each meta-log word in the meta-program log and a second digital number corresponding to each target log word in the first target program log; The method of using a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word includes: A dynamic programming algorithm is used to determine whether the first digital number corresponding to the meta-program log can be converted into the second digital number corresponding to the first target program log in the form of the digital number corresponding to the instrumented word.
8. The method according to any one of claims 1 to 6, characterized in that After determining the target program log that matches the meta-program log in the second target program log, the method further includes: Obtaining a pre-built log dictionary corresponding to a meta-program log, wherein the log dictionary stores attribute information of the meta-program log; A key source code printing log corresponding to a matching target program log is obtained according to the attribute information of the meta-program log.
9. A log matching method, characterized in that: include: Receiving a monitoring request for a target object triggered by a user, wherein the target object includes a plurality of target sub-objects; Obtaining a metaprogram log and a first target program log corresponding to the target object according to the monitoring request, wherein the metaprogram log is obtained by pre-extracting non-parameter words from a key source code print log; The key source code print log is a pre-configured program log that has a positioning function for at least one target sub-object in the target object; wherein the first target program log is a log generated by running the target object; Using a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word; If it is determined that the log can be converted into the first target program log, the log that can be converted into the first target program log is determined as the second target program log, and a target program log matching the meta-program log is determined in the second target program log; Determine the target sub-object corresponding to the matching target program log to obtain the monitoring result corresponding to the target sub-object; The method of using a dynamic programming algorithm to determine whether the meta-program log can be converted into the first target program log in the form of an instrumented word includes: Using a dynamic programming algorithm to traverse and calculate the value of the instrumented word quantity parameter corresponding to each meta-log word in the meta-program log and each target log word in the first target program log, until the value of the instrumented word quantity parameter corresponding to the last meta-log word and the last target log word is traversed and calculated; It is determined whether the meta-program log can be converted into the first target program log in the form of the instrumented words according to the values of the instrumented word quantity parameters corresponding to the last meta-log word and the last target log word.
10. A log matching method, characterized in that: include: Receive a log search request corresponding to a target object triggered by a user, wherein the log search request includes a target program log; wherein the target program log is a log generated by running the target object; Acquiring a plurality of pre-stored meta-program logs according to the log search request, wherein the meta-program logs are obtained by pre-extracting non-parameter words from key source code print logs; the key source code print logs are pre-configured program logs that have a positioning effect on log search answer data of a target object; A dynamic programming algorithm is used to determine whether each meta-program log can be converted into a target program log by inserting a word. If it is determined that it can be converted into the target program log, the corresponding meta-program log is determined as the meta-program log that matches the target program log; Outputting answer data corresponding to the matching meta-program log to the user; The dynamic programming algorithm is used to determine whether each meta-program log can be converted into a target program log in the form of an instrumented word, including: A dynamic programming algorithm is used to traverse and calculate the value of the instrumentation word quantity parameter corresponding to each meta-log word in the meta-program log and each target log word in the target program log until the value of the instrumentation word quantity parameter corresponding to the last meta-log word and the last target log word is traversed and calculated; According to the value of the instrumentation word quantity parameter corresponding to the last meta-log word and the last target log word, it is determined whether each meta-program log can be converted into a target program log in the form of an instrumentation word.
11. An electronic device comprising: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 10 when executed by a processor.
13. A computer program product comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
An instruction instrumentation method and device based on a virtual machine
CN109408063A
Log analysis method and device
CN109614469A