Intelligent generation method and device of log analysis rule, equipment, medium and product

By obtaining and analyzing the target content of log records and generating corresponding parsing rules, the problems of high labor cost and low efficiency in log analysis and processing in the existing technology are solved, and automatic and efficient processing of log data is realized.

CN118760664APending Publication Date: 2024-10-11CHINA POST INFORMATION TECH (BEIJING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410898413.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

In the existing technology, manual analysis and processing of logs requires proficiency in regular expressions, and subtle spelling errors can easily lead to matching failures and high parsing complexity, resulting in low processing efficiency and high labor costs.

Method used

By responding to the editing operation of the log record to be processed, the target content is obtained, and corresponding target parsing rules are generated based on the preset conditions and the content to be processed, and the log data is automatically processed.

Benefits of technology

It realizes the automation of log data analysis and processing and efficiently generates target parsing rules, reducing labor costs and improving processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760664A_ABST
    Figure CN118760664A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent generation method and device of a log analysis rule, equipment, a medium and a product, and the method comprises the steps: obtaining target content corresponding to each to-be-processed log record in response to an editing operation on at least two to-be-processed log records; when the target content of the at least two to-be-processed log records does not meet the preset condition, taking the target content of each to-be-processed log record as reference information, and obtaining the to-be-processed content of each to-be-processed log record; and when the to-be-processed content of the at least two to-be-processed log records meets a preset condition, generating a target analysis rule corresponding to the target content on the basis of the to-be-processed content, so as to analyze and process the obtained log data on the basis of the target analysis rule. According to the technical scheme provided by the embodiment of the invention, the technical effect of automatically generating the target analysis rule matched with the target content is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information technology, and in particular to a method, device, equipment, medium and product for intelligently generating log parsing rules. Background Art

[0002] Analyzing logs and extracting information from them often requires writing a series of parsing rules to adapt to specific log formats and requirements. Common log parsing rules include: regular expressions, delimiter parsing, custom scripts, keyword matching, dictionary mapping, etc. Among them, regular expressions are the most commonly used and most flexible parsing rules. Regular expressions are usually adjusted and optimized by users according to the characteristics of log data to obtain suitable parsing rules.

[0003] When logs are analyzed and processed manually to obtain parsing rules, the following shortcomings exist: users need to be proficient in the writing methods and rules of regular expressions, that is, the requirements for users are high; further, some minor spelling errors in regular expressions will lead to matching failures and difficulty in troubleshooting; finally, inappropriate regular expressions have high parsing complexity, and thus high requirements on device performance when processing large amounts of log data, that is, there is a problem of low processing efficiency. Summary of the invention

[0004] The present invention provides a method, device, equipment, medium and product for intelligently generating log parsing rules, so as to achieve the effect of automatically generating target parsing rules that are compatible with target content.

[0005] In a first aspect, an embodiment of the present invention provides a method for intelligently generating log parsing rules, the method comprising:

[0006] In response to an edit operation on at least two log records to be processed, obtaining target content corresponding to each log record to be processed;

[0007] When the target contents of the at least two log records to be processed do not meet the preset condition, taking the target content of each log record to be processed as reference information, obtaining the content to be processed of each log record to be processed;

[0008] When the to-be-processed contents of the at least two to-be-processed log records meet a preset condition, a target parsing rule corresponding to the target content is generated based on the to-be-processed contents, so as to parse and process the acquired log data based on the target parsing rule.

[0009] Further, in response to the editing operation on at least two log records to be processed, obtaining the target content of each log record to be processed includes:

[0010] Acquire at least two to-be-processed log records from a target storage space, wherein the target storage space is used to record log data generated by the target device during operation;

[0011] The content in at least the to-be-processed log record is selected and marked to obtain target content corresponding to each log record.

[0012] Furthermore, the preset condition includes at least one of the following:

[0013] The similarity between the target contents meets a preset similarity threshold;

[0014] The editing rules between the target contents are the same;

[0015] The target contents belong to the same category;

[0016] The structure of the target content is the same.

[0017] Further, the reference information includes a starting reference point, and the target content of each log record to be processed is used as the reference information to obtain the content to be processed of each log record to be processed, including:

[0018] For each log record to be processed, taking the target content as a starting reference point, obtaining at least part of the content above the target content as the content to be processed; or,

[0019] Taking the target content as a starting reference point, obtaining at least a portion of the content below the target content as the content to be processed.

[0020] Furthermore, the generating of a target parsing rule corresponding to the target content based on the content to be processed includes:

[0021] Obtaining the to-be-processed contents of at least two to-be-processed log records, and generating to-be-applied parsing rules based on regular information of the to-be-processed contents;

[0022] Based on the reference information corresponding to the content to be processed and the target content, the parsing rule to be applied is used as the target parsing rule of the target content.

[0023] Furthermore, the method further comprises:

[0024] When the to-be-processed contents of the at least two to-be-processed log records do not meet the preset condition, determining the location information of the target content of each to-be-processed log record;

[0025] When the position information satisfies a fixed arrangement condition, the target parsing rule is generated based on the target position of the target content.

[0026] In a second aspect, an embodiment of the present invention provides an intelligent generation device for log parsing rules, the device comprising:

[0027] A target content acquisition module, configured to acquire target content corresponding to each log record to be processed in response to an edit operation on at least two log records to be processed;

[0028] a to-be-processed content determination module, configured to obtain the to-be-processed content of each to-be-processed log record by taking the target content of each to-be-processed log record as reference information when the target content of the at least two to-be-processed log records does not meet a preset condition;

[0029] The parsing rule generation module is used to generate a target parsing rule corresponding to the target content based on the to-be-processed content when the to-be-processed content of the at least two to-be-processed log records meets a preset condition, so as to parse and process the acquired log data based on the target parsing rule.

[0030] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0031] at least one processor; and

[0032] a memory communicatively connected to the at least one processor; wherein,

[0033] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the intelligent generation method of log parsing rules described in any one of the embodiments of the present invention.

[0034] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute the intelligent generation method of log parsing rules described in any one of the embodiments of the present invention.

[0035] In a fifth aspect, an embodiment of the present invention further provides a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the computer program implements the intelligent generation method of log parsing rules described in any one of the embodiments of the present invention.

[0036] The technical solution of the embodiment of the present invention can obtain the target content of each log record to be processed by responding to the editing operation of at least two log records to be processed. By analyzing and processing the target content, the target parsing rule corresponding to the target content can be determined, which solves the problem of high labor cost and low efficiency in the prior art when determining the parsing rule based on the user's analysis and processing of log data, and realizes the effect of automatically and efficiently generating the target parsing rule by analyzing and processing the log data.

[0037] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 It is a flow chart of a method for intelligently generating log parsing rules provided by an embodiment of the present invention;

[0040] Figure 2 It is a flow chart of a method for intelligently generating log parsing rules provided by an embodiment of the present invention;

[0041] Figure 3 This is a schematic diagram of the structure of an intelligent generation device for log parsing rules provided by an embodiment of the present invention.

[0042] Figure 4 It is a structural schematic diagram of an electronic device that implements the intelligent generation method of log parsing rules according to an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0045] Figure 1 It is a flow chart of a method for intelligently generating log parsing rules provided by an embodiment of the present invention. This embodiment can be applied to any situation where target parsing rules corresponding to log data need to be generated, or any situation where target parsing rules are generated for regular data. The method for intelligently generating log parsing rules can be implemented by an intelligent device for generating log parsing rules. The device can be implemented in the form of hardware and / or software. The hardware can be integrated in a computer device. The computer device can be a mobile terminal or a PC, etc.

[0046] like Figure 1 As shown, the method includes:

[0047] S110: In response to an editing operation on at least two log records to be processed, obtaining target content corresponding to each log record to be processed.

[0048] Among them, during the operation of the computer, a corresponding operation log can be generated. The operation log includes multiple log records, and each log record is used to characterize the operation record generated by the computer during the operation. Multiple log records can be obtained from multiple log records to determine the corresponding target parsing rules. The obtained log records for determining the target parsing rules are used as log records to be processed. Optionally, at least two log records to be processed can be selected from multiple log records. At least two log records include two, three, etc. The specific number of log records to be processed can be selected by the user according to actual needs, and is not limited in this embodiment.

[0049] After obtaining at least two log records to be processed, the user may edit the log records to be processed, and optionally mark target content in each log record to be processed, that is, select the target content.

[0050] Specifically, the user can select at least two log records to be processed from multiple log records, or can select at least two log records to be processed from multiple log records according to actual conditions. After selecting at least two log records to be processed, the log records to be processed can be edited, that is, the target content of each log record to be processed can be selected.

[0051] In this embodiment, in response to the editing operation on at least two log records to be processed, the target content of each log record to be processed is obtained, including: obtaining at least two log records to be processed from a target storage space, wherein the target storage space is used to record log data generated by the target device during operation; and selecting and marking the content in at least the log record to be processed to obtain the target content corresponding to each log record.

[0052] It can be understood that the log data generated by the target device during operation is stored in the target storage space, so that when there is a need to generate a target parsing rule, at least two log data are obtained from the target storage space and used as log records to be processed. After obtaining the log records to be processed, the user can mark the content of each log record to be processed, and use the content selected by the mark as the target content of each log record to be processed.

[0053] Exemplarily, referring to Table 1, the at least two log records to be processed include at least four.

[0054] Table 1

[0055]

[0056]

[0057] Among them, each log record to be processed is marked and extracted to obtain the target content shown in Table 1.

[0058] S120: When the target contents of the at least two log records to be processed do not meet a preset condition, the target content of each log record to be processed is used as reference information to obtain the content to be processed of each log record to be processed.

[0059] The preset condition is a pre-set condition used to determine whether the target content corresponding to all log records to be processed meets the corresponding regular conditions. If all target contents meet the preset condition, the target parsing rule can be generated based on the target content. If all target contents do not meet the preset condition, the target content can be used as reference information to determine the to-be-processed content corresponding to each target content, and then the target parsing rule corresponding to the target content can be determined based on the to-be-processed content.

[0060] In this embodiment, the preset conditions may include at least one of the following: the similarity between the target contents meets a preset similarity threshold; the editing rules between the target contents are the same; the target contents belong to the same category; the structures of the target contents are the same.

[0061] The preset similarity threshold is a pre-set value used to determine whether the similarity between all target contents reaches a preset condition. The editing rule can be understood as a rule for generating target content. It can be determined whether all target contents belong to the same category according to the pre-set classification category. If they are the same category, it means that the preset condition is met. The structure can be understood as the data structure of the target content, for example, the data structure of the ID number, the data structure of the telephone number, etc.

[0062] It should be noted that if all target contents meet the preset conditions, the target parsing rules can be determined based on the target contents.

[0063] Based on the above examples, it can be known that the regularity between target contents is determined. According to the space and colon, the target contents are split and the structure of the target contents is determined to be Ccc dd dd:dd:dd

[0064] Where C, c, and d represent uppercase letters, lowercase letters, and numbers, respectively. The target content has a regular pattern, and the first type of regular expression (target parsing rule) is generated according to the content structure of the target content as follows:

[0065] (?P <target>[AZ][az][az]\s\d\d\s\d\d:\d\d:\d\d).

[0066] In this embodiment, if it is determined based on all target contents that they do not meet the preset conditions, the content to be processed can be determined based on the target content, and then the target parsing rule can be determined based on the content to be processed. In this embodiment, determining the content to be processed based on the target content can be: for each log record to be processed, taking the target content as the starting reference point, obtaining at least part of the content above the target content as the content to be processed; or, taking the target content as the starting reference point, obtaining at least part of the content below the target content as the content to be processed.

[0067] It should be noted that the processing method for each log record to be processed is the same. In this embodiment, the processing of one of the log records to be processed is taken as an example for description.

[0068] Among them, the starting position of the target content can be used as the first starting reference point, and at least part of the content before the first starting reference point is obtained as the content to be processed. After obtaining the content to be processed of each log record to be processed, subsequent operations can be performed. In the case where the target parsing rule is not determined based on the content to be processed corresponding to the first starting reference point. The end position of the target content is used as the second starting reference point, and the content after the second starting reference point is obtained as the content to be processed.

[0069] On the basis of the above examples, see Table 2. When the target parsing rule is not determined based on the target content, the content to be processed is obtained. The regularity of the target content is calculated. Since the target content does not have a consistent word separator and the length is not uniform, it is judged that the preset condition is not met. At least part of the content before the target content can be obtained as the content to be processed. Calculate whether there is a classification between all the content to be processed of all the log records to be processed. At this time, the target content obtained continues to refer to Table 2.

[0070] Table 2

[0071] log Target content Jan 18 13:28:53vm21113systemd-logind Removed session 117. vm21113 Feb 18 13:34:28vm21113auditd

[749] Audit daemon rotating log files. vm21113 Apr 15 10:28:01vm21_44systemd Started Session 722821of user root. vm21_44 Jul 22 13:06:55host3 mave syslog test for eoicd. host3

[0072] Calculate the regularity of the target content. Since the target content does not have consistent word separators and has different lengths, it is judged to be irregular.

[0073] Calculate the regularity of the context content, and split the content on both sides of the target according to the space. The context is the closest word segmentation on both sides of the target. The above word segmentations are: 13:28:53, 13:34:28, 10:28:01, 13:06:55. When the colon is used as the word segmentation symbol, the above text has a consistent structure: dd:dd:dd

[0074] The following word segmentations are: systemd-logind, auditd

[749] , systemd, mave. There is no consistent word segmentation symbol, and the lengths are not uniform. There is no structural similarity, so the following word segmentation is irregular.

[0075] Because only the above text has a regular pattern, the second type of regular expression is generated based on the above text as an anchor point as follows:

[0076] \d\d:\d\d:\d\d\s(?P <target>\S+)\s.

[0077] S130. When the contents to be processed of the at least two log records to be processed meet a preset condition, generate a target parsing rule corresponding to the target content based on the contents to be processed, so as to parse and process the acquired log data based on the target parsing rule.

[0078] The target parsing rules correspond to the target content and are used to analyze and process the log data in the target storage space to extract the target content.

[0079] Specifically, after obtaining the to-be-processed contents of at least two to-be-processed log records, it can be determined whether all the to-be-processed contents meet the preset conditions. If all the to-be-processed contents meet the preset conditions, a target parsing rule adapted to the target content can be generated based on the target content and the to-be-processed contents. In other words, the target parsing rule may not be generated based on the target content, but is associated with the target content, so that after obtaining the log data from the target storage space, the target content corresponding to each log data can be obtained from the log data based on the target parsing rule.

[0080] In this embodiment, the target parsing rule corresponding to the target content based on the content to be processed includes: obtaining the content to be processed of at least two log records to be processed, and generating the parsing rule to be applied based on the regular information of the content to be processed; based on the reference information corresponding to the content to be processed and the target content, using the parsing rule to be applied as the target parsing rule for the target content.

[0081] It can be understood that if the to-be-processed contents corresponding to at least two to-be-processed log records meet the preset conditions, it means that all to-be-processed contents meet the corresponding conditions. At this time, all to-be-processed contents can be analyzed and processed to determine the parsing rules corresponding to the to-be-processed contents as the parsing rules to be applied. Since the parsing rules to be applied are determined based on the to-be-processed contents, but their ultimate purpose is to determine the target content in the log data, therefore, the parsing rules to be applied can be associated with the target content, so as to first determine the to-be-processed contents in the log data based on the parsing rules to be applied, and then determine the target content based on the to-be-processed contents.

[0082] In this embodiment, if the content to be processed still does not meet the preset condition, the target parsing rule corresponding to the target content can be further determined. Optionally, when the content to be processed of the at least two log records to be processed does not meet the preset condition, the location information of the target content of each log record to be processed is determined; when the location information meets the fixed arrangement condition, the target parsing rule is generated based on the target location of the target content.

[0083] It can be understood that: if the target parsing rules corresponding to the target content are still not determined based on the above two methods, the location information corresponding to the target content can be determined. If the location information of all target contents is fixed in the log data, the target parsing rules corresponding to the target content can be generated based on the location information of the target content. At this time, the generated target parsing rules can determine the location information of the target content in the log data, and then retrieve the target content based on the location information.

[0084] For example, see Table 3.

[0085] Table 3

[0086] log Target content Jan 18 13:28:53vm21113systemd-logind Removed session 117. systemd-logind Feb 18 13:34:28vm21113auditd

[749] Audit daemon rotating log files. auditd

[749] Apr 15 10:28:01vm21_44systemd Started Session 722821of user root. systemd Jul 22 13:06:55host3 mave syslog test for eoicd. mave

[0087] Calculate the regularity of the target content. Since the target content does not have a consistent word separator and the length is not uniform, it is judged to be irregular. The above word separators are: vm21113, vm21113, vm21_44, host3, and the following word separators are: Removed, Audit, Started, syslog. The context does not have a consistent word separator and the length is not uniform. There is no structural similarity, so the context is irregular. Check whether the position of the target content is regular. It is found that they are all based on the fifth word after the space word separator, so the third type of regular expression is generated as follows: (\S+\s){4}(?P <target>\S+)\s.

[0088] The technical solution of the embodiment of the present invention can obtain the target content of each log record to be processed by responding to the editing operation of at least two log records to be processed. By analyzing and processing the target content, the target parsing rule corresponding to the target content can be determined, which solves the problem of high labor cost and low efficiency in the prior art when determining the parsing rule based on the user's analysis and processing of log data, and realizes the effect of automatically and efficiently generating the target parsing rule by analyzing and processing the log data.

[0089] As an alternative embodiment of the above embodiment, Figure 2 It is a flow chart of an intelligent generation method of log parsing rules provided by an embodiment of the present invention. On the basis of the above-mentioned embodiment, a specific example can be used to introduce the technical solution of the embodiment of the present invention, in which the technical terms that are the same as or corresponding to the above-mentioned embodiment are not repeated here.

[0090] It should be noted that the solution provided in the embodiment of the present invention can generate corresponding regular expressions (target parsing rules) based on three strategies. The execution order of each strategy can be parallel or sequential. The specific execution order is not limited in this embodiment, as long as the corresponding target parsing rules can be obtained.

[0091] like Figure 2 As shown, the method includes:

[0092] Obtain at least two log records to be processed. Select target content in at least two log records to be processed based on the mouse control cursor. After the selection is completed, the confirmation control can be triggered to extract the target content selected by the user from the log record to be processed. After the target content is extracted, the target content can be analyzed and processed, that is, the similarity between the target contents is calculated, and the similarity mainly corresponds to whether the target contents meet the preset conditions. If it is determined that the target contents meet the preset conditions, the regular expression in the target parsing rule can be generated according to the regularity between the target contents.

[0093] If the target content does not meet the preset condition, at least part of the content above the target content can be obtained as the content to be processed according to the reference point information of the target content in the log record to be processed. It is determined whether the content to be processed of all the log records to be processed meets the preset condition.

[0094] If the preset conditions are met, a regular expression in the target parsing rule can be generated based on the content to be processed. If the content to be processed does not meet the preset conditions, the content to be processed can be determined based on at least part of the content below the target content. Analyze whether the content to be processed meets the preset conditions. If the preset conditions are met, a regular expression in the target parsing rule is generated based on the content to be processed. Otherwise, continue to execute the next strategy.

[0095] It should also be noted that if the target parsing rule is generated based on the content to be processed, the target parsing rule can be associated with the target content, so that after the content to be processed is determined based on the target parsing rule, the target content can be found again.

[0096] If the target parsing rule is not determined based on the content to be processed, the location information of the target content in the log record to be processed can be determined. If the location information is fixed, the target parsing rule can be generated based on the location information; if the location information is not fixed, the target parsing rule cannot be generated.

[0097] The above method can be understood as: using a similarity algorithm based on content structure, selecting the optimal word segmentation symbol to split the target content, detecting whether the target content has a consistent structure, and then calculating the similarity between the target contents. According to the similarity, it can be judged whether there is regularity. If the target content is judged to be regular, a regular expression is directly generated based on the target content, that is, the first type of regular expression, and the algorithm ends; otherwise, proceed to the next step. If the context content is regular, based on the context as an anchor point, the target content part is converted into a group that matches any content, and a regular expression is generated, that is, the second type of regular expression, and the algorithm ends; otherwise, proceed to the next step. Determine whether the word segmentation position of the target content is fixed. If the position of the target content is fixed, a regular expression is generated based on the content position, that is, the third type of regular expression. In the process of generating regular expressions, some special character escapes are involved, such as []()+-, etc., which are well-known content and will not be elaborated in detail.

[0098] The technical solution of the embodiment of the present invention can obtain the target content of each log record to be processed by responding to the editing operation of at least two log records to be processed. By analyzing and processing the target content, the target parsing rule corresponding to the target content can be determined, which solves the problem of high labor cost and low efficiency in the prior art when determining the parsing rule based on the user's analysis and processing of log data, and realizes the effect of automatically and efficiently generating the target parsing rule by analyzing and processing the log data.

[0099] Figure 3 The schematic diagram is a structural diagram of an intelligent log parsing rule generation device provided by an embodiment of the present invention. The device includes: a target content acquisition module 210 , a to-be-processed content determination module 220 and a parsing rule generation module 230 .

[0100] Among them, the target content acquisition module 210 is used to obtain the target content corresponding to each log record to be processed in response to the editing operation of at least two log records to be processed; the to-be-processed content determination module 220 is used to obtain the to-be-processed content of each log record to be processed by taking the target content of each log record to be processed as reference information when the target content of the at least two log records to be processed does not meet the preset conditions; the parsing rule generation module 230 is used to generate a target parsing rule corresponding to the target content based on the to-be-processed content when the to-be-processed content of the at least two log records to be processed meets the preset conditions, so as to parse and process the acquired log data based on the target parsing rule.

[0101] On the basis of the above technical solution, the target content acquisition module includes: a log data acquisition unit, used to acquire at least two log records to be processed from a target storage space, wherein the target storage space is used to record log data generated by the target device during operation; a target content acquisition unit, used to select and mark the content in at least the log record to be processed to obtain the target content corresponding to each log record.

[0102] On the basis of the above technical solution, the preset condition includes at least one of the following:

[0103] The similarity between the target contents meets a preset similarity threshold;

[0104] The editing rules between the target contents are the same;

[0105] The target contents belong to the same category;

[0106] The structure of the target content is the same.

[0107] On the basis of the above technical solution, the reference information includes a starting reference point, and a module for determining content to be processed includes:

[0108] A first content acquisition unit is configured to, for each log record to be processed, use the target content as a starting reference point to acquire at least part of the content above the target content as the content to be processed; or

[0109] The second content acquisition unit is used to acquire at least part of the content below the target content with the target content as a starting reference point as the content to be processed.

[0110] On the basis of the above technical solutions, the parsing rule generation module includes:

[0111] A to-be-applied parsing rule generating unit, used for obtaining to-be-processed contents of at least two to-be-processed log records, and generating to-be-applied parsing rules according to regular information of the to-be-processed contents;

[0112] The target parsing rule generating unit is used to use the to-be-applied parsing rule as the target parsing rule of the target content based on the reference information corresponding to the to-be-processed content and the target content.

[0113] On the basis of the above technical solutions, the device further includes:

[0114] A location information determination module, configured to determine the location information of the target content of each log record to be processed when the to-be-processed contents of the at least two log records to be processed do not meet the preset condition;

[0115] The parsing rule determination module is used to generate the target parsing rule based on the target position of the target content when the position information meets the fixed arrangement condition.

[0116] The technical solution of the embodiment of the present invention can obtain the target content of each log record to be processed by responding to the editing operation of at least two log records to be processed. By analyzing and processing the target content, the target parsing rule corresponding to the target content can be determined, which solves the problem of high labor cost and low efficiency in the prior art when determining the parsing rule based on the user's analysis and processing of log data, and realizes the effect of automatically and efficiently generating the target parsing rule by analyzing and processing the log data.

[0117] The intelligent generation device of log parsing rules provided in the embodiment of the present invention can execute the intelligent generation method of log parsing rules provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0118] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0119] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0120] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0121] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a method for identifying a material category.

[0122] In some embodiments, the data processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data processing method in any other appropriate manner (e.g., by means of firmware).

[0123] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0124] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0125] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0126] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0127] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0128] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0129] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0130] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.< / target> < / target> < / target>

Claims

1. A method for intelligently generating log parsing rules, characterized in that: include: In response to an edit operation on at least two log records to be processed, obtaining target content corresponding to each log record to be processed; When the target contents of the at least two log records to be processed do not meet the preset condition, taking the target content of each log record to be processed as reference information, obtaining the content to be processed of each log record to be processed; When the to-be-processed contents of the at least two to-be-processed log records meet a preset condition, a target parsing rule corresponding to the target content is generated based on the to-be-processed contents, so as to parse and process the acquired log data based on the target parsing rule.

2. The method according to claim 1, characterized in that The step of obtaining target content of each log record to be processed in response to the editing operation on at least two log records to be processed includes: Acquire at least two to-be-processed log records from a target storage space, wherein the target storage space is used to record log data generated by the target device during operation; The content in at least the to-be-processed log record is selected and marked to obtain the target content corresponding to each log record.

3. The method according to claim 1, characterized in that: The preset condition includes at least one of the following: The similarity between the target contents meets a preset similarity threshold; The editing rules between the target contents are the same; The target contents belong to the same category; The structure of the target content is the same.

4. The method according to claim 1, characterized in that The reference information includes a starting reference point, and the target content of each log record to be processed is used as the reference information to obtain the content to be processed of each log record to be processed, including: For each log record to be processed, taking the target content as a starting reference point, obtaining at least part of the content above the target content as the content to be processed; or, Taking the target content as a starting reference point, obtaining at least a portion of the content below the target content as the content to be processed.

5. The method according to claim 1, characterized in that The generating a target parsing rule corresponding to the target content based on the content to be processed includes: Obtaining the to-be-processed contents of at least two to-be-processed log records, and generating to-be-applied parsing rules based on regular information of the to-be-processed contents; Based on the reference information corresponding to the content to be processed and the target content, the parsing rule to be applied is used as the target parsing rule of the target content.

6. The method according to claim 1, characterized in that The method further comprises: When the to-be-processed contents of the at least two to-be-processed log records do not meet the preset condition, determining the location information of the target content of each to-be-processed log record; When the position information satisfies a fixed arrangement condition, the target parsing rule is generated based on the target position of the target content.

7. An intelligent device for generating log parsing rules, characterized in that: include: A target content acquisition module, configured to acquire target content corresponding to each log record to be processed in response to an edit operation on at least two log records to be processed; a to-be-processed content determination module, configured to obtain the to-be-processed content of each to-be-processed log record by taking the target content of each to-be-processed log record as reference information when the target content of the at least two to-be-processed log records does not meet a preset condition; The parsing rule generation module is used to generate a target parsing rule corresponding to the target content based on the to-be-processed content when the to-be-processed content of the at least two to-be-processed log records meets a preset condition, so as to parse and process the acquired log data based on the target parsing rule.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for intelligently generating log parsing rules according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the intelligent generation method of log parsing rules according to any one of claims 1 to 6 when executed.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the intelligent generation method of log parsing rules according to any one of claims 1 to 6.