Log processing method and device and electronic equipment
By constructing log graphs and target log libraries, and using neural network algorithms to identify abnormal logs, the problems of large log data storage and low identification accuracy are solved, and efficient log processing and storage optimization are achieved.
Patent Information
- Application Number
- CN202410851738.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-08-23
AI Technical Summary
In the service business field, the storage of log data occupies a large amount of storage space, resulting in high costs and system performance problems. It is difficult for existing technologies to effectively identify and process abnormal logs, which affects the operation and maintenance business.
By obtaining sample log sequences, extracting time sequence information and business logic information, constructing log graphs, using neural network algorithms to generate low-dimensional vector sets, integrating key character sequences, establishing a target log library, and identifying abnormal logs based on the recognition model.
It improves the accuracy of log anomaly identification, optimizes log storage strategies, reduces storage costs, and improves the response speed of the service system and the credibility of log data.
Smart Images

Figure CN118535538A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a log processing method, device and electronic device. Background Art
[0002] In the service business field, due to business requirements such as auditing, data accumulation and troubleshooting, many supporting systems of service businesses require a large amount of persistent log data. As the business scale grows and the complexity increases, these log data are stored in cloud databases and take up huge storage space, which will incur huge costs and even cause system performance problems. Therefore, processing these log data and detecting abnormal logs that deviate from the expected output of the program will generate huge value for the operation and maintenance business. Summary of the invention
[0003] In view of the above problems, the present disclosure provides a log processing method, device and electronic device.
[0004] According to a first aspect of the present disclosure, a log processing method is provided, including: obtaining a sample log sequence; based on time sequence information of the sample log sequence, extracting a first key character in the sample log to construct a first key character sequence; based on a log graph constructed by the sample log sequence, extracting business logic information in the log graph to construct a second key character sequence; and fusing the first key character sequence with the second key character sequence to obtain a target log library.
[0005] According to an embodiment of the present disclosure, based on a log graph constructed based on a sample log sequence, business logic information in the log graph is extracted to construct a second key character sequence, including: based on business rules, the sample log sequence is constructed into a log graph, wherein the nodes of the log graph are sample logs in the sample log sequence, the edges of the log graph are relationship weights set based on business rules, and the sample logs contain second key characters; using a neural network algorithm to obtain business logic information between nodes in the log graph to generate a low-dimensional vector set of the nodes; based on similarity aggregation of multiple dimensional vector sets, the second key character sequence is constructed.
[0006] According to an embodiment of the present disclosure, a neural network algorithm is used to obtain business logic information between nodes in a log graph to generate a low-dimensional vector set of nodes, including: based on edge weights, traversing multiple nodes in the log graph to obtain multiple node sequences; based on learning of node sequences, capturing co-occurrence information between nodes to obtain a low-dimensional vector set of nodes, wherein the co-occurrence information includes business logic information between nodes.
[0007] According to an embodiment of the present disclosure, the method further includes: based on a target log library, converting an initial log sequence generated by a business event into a key character sequence; based on a recognition model including the target log library, obtaining an abnormal probability of the key character sequence to determine that the initial log sequence is abnormal.
[0008] According to an embodiment of the present disclosure, based on a recognition model including a target log library, an abnormal probability of a key character sequence is obtained, including: extracting the key character sequence based on a sliding window, obtaining multiple sequences to be input at the current moment t, where t is an integer greater than 0; obtaining information of the sequence to be input at moment tn and at moment t+n, respectively, through the recognition model, where t and n are both integers greater than 0; predicting the conditional probability of the next key character under the condition of the current key character sequence based on the information at moment tn and the information at moment t+n, where the conditional probability is used to represent the abnormal probability corresponding to the key character sequence.
[0009] According to an embodiment of the present disclosure, a recognition model is pre-trained, and the pre-training method includes: extracting a key character sequence in a target log library based on a sliding window to obtain multiple training sequences at the current time t; inputting the training sequence into an initial recognition model to obtain information of the training sequence at time tn and information at time t+n; based on the information at time tn and information at time t+n, predicting the conditional probability of the next key character under the condition of the current training sequence, wherein the conditional probability is used to represent the abnormal probability corresponding to the key character sequence; based on the prediction result of the conditional probability and the next key character label of the current training sequence, updating the model parameters of the initial recognition model to train the recognition model.
[0010] A second aspect of the present disclosure provides a log processing device, including: a sample log acquisition module, used to acquire a sample log sequence; a first key character sequence construction module, used to extract a first key character in a sample log to construct a first key character sequence based on time sequence information of the sample log sequence; a second key character sequence construction module, used to extract business logic information in a log graph constructed based on the sample log sequence to construct a second key character sequence; and a target log library construction module, used to merge the first key character sequence with the second key character sequence to obtain a target log library.
[0011] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to execute to obtain a sample log sequence; based on the time sequence information of the sample log sequence, extract the first key character in the sample log to construct a first key character sequence; based on the log graph constructed by the sample log sequence, extract the business logic information in the log graph to construct a second key character sequence; and merge the first key character sequence with the second key character sequence to obtain a target log library.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] For a more complete understanding of the present disclosure and its advantages, reference will now be made to the following description taken in conjunction with the accompanying drawings, in which:
[0014] Figure 1 The flowchart of the log processing method according to the embodiment of the present disclosure is schematically shown;
[0015] Figure 2 Schematically shows a flow chart of constructing a second key character sequence according to an embodiment of the present disclosure;
[0016] Figure 3 A flowchart of generating a low-latitude vector set of a node according to an embodiment of the present disclosure is schematically shown;
[0017] Figure 4 A schematic diagram of a recognition model according to an embodiment of the present disclosure is shown;
[0018] Figure 5 A flowchart for determining whether a log sequence is abnormal according to an embodiment of the present disclosure is schematically shown;
[0019] Figure 6 A schematic diagram of log sequence anomaly recognition based on a recognition model according to an embodiment of the present disclosure is shown;
[0020] Figure 7 The structure block diagram of the log processing device according to the embodiment of the present disclosure is schematically shown;
[0021] Figure 8 A block diagram of an electronic device suitable for implementing a log processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0022] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0023] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0024] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0025] When using expressions such as "at least one of A, B, and C", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0026] Some block diagrams and / or flow charts are shown in the accompanying drawings. It should be understood that some blocks or combinations thereof in the block diagrams and / or flow charts can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that these instructions can create a device for implementing the functions / operations described in these block diagrams and / or flow charts when executed by the processor. The technology of the present disclosure can be implemented in the form of hardware and / or software (including firmware, microcode, etc.). In addition, the technology of the present disclosure can take the form of a computer-readable storage medium storing instructions, on which executable instructions are stored, which, when executed by the processor, causes the processor to perform the method of the present disclosure.
[0027] In the technical solution of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0028] First, the technical terms described in this article are explained and described as follows.
[0029] logkey: A keyword or identifier used to uniquely identify (or classify) a log entry.
[0030] Log graph: A data structure based on graph theory that is used to represent and analyze log information of a system, application, or network.
[0031] K-means clustering algorithm: It is used to divide the data set into K non-overlapping subsets (clusters), and each data point belongs to the representative point (cluster center) of the cluster closest to it.
[0032] DeepWalk (Unsupervised Graph Embedding) algorithm: An algorithm for learning graph representations, especially for learning node embeddings, which captures the structural information and semantic similarity between nodes in the graph by representing nodes as low-dimensional continuous vectors, thereby effectively processing large-scale graph data.
[0033] PyTorch Geometric ((Graph Data Processing Extension Library)): A PyTorch extension library for processing graph data, specifically designed for the development and experimentation of graph neural networks (GNNs). It provides a series of tools and modules for processing graph data, allowing users to easily build, train, and evaluate graph neural network models.
[0034] RNN (Bidirectional Recurrent Neural Network): A neural network structure used to process sequence data, with hidden layers in both the forward and backward directions, capturing contextual information before and after the current moment, respectively. This network structure can more fully understand and utilize the information in the input sequence, and is particularly suitable for tasks that need to consider the context of the entire sequence, such as machine translation, speech recognition, and natural language processing.
[0035] Softmax function (normalized exponential function): used to enable the neural network to output results suitable for classification and probabilistic interpretation.
[0036] An embodiment of the present disclosure provides a log processing method, including: obtaining a sample log sequence; based on the time sequence information of the sample log sequence, extracting the first key character in the sample log to construct a first key character sequence; based on the log graph constructed by the sample log sequence, extracting the business logic information in the log graph to construct a second key character sequence; and fusing the first key character sequence with the second key character sequence to obtain a target log library.
[0037] This method is based on the target log library formed by combining the key characters in the log with explicit features such as time sequence and implicit features such as business logic, and performs anomaly recognition on the log sequence, thereby improving the accuracy of anomaly recognition of business logs, and optimizing the log preservation strategy (i.e., retaining all abnormal logs and storing normal logs in categories), thereby improving the storage efficiency of storage space and reducing storage consumption, and also improving the response speed of service system operation. In addition, this method also considers the impact of subsequent information on previous information by introducing a reverse input sequence, which further improves the accuracy of anomaly recognition of business logs, enhances the credibility of log data, and improves the traceability of business log data.
[0038] The following will be passed Figure 1 to Figure 6 The log processing method of the disclosed embodiment is described in detail.
[0039] Figure 1 The flowchart of the log processing method according to the embodiment of the present disclosure is schematically shown.
[0040] like Figure 1 As shown, the log processing method may further specifically include operations S110 to S140.
[0041] In operation S110 , a sample log sequence is acquired.
[0042] Exemplarily, a large amount of data is collected using tools such as Splunk (machine data engine), including sample log files in service business areas such as business volume, transaction data, service quality data, operation data, and market data. In this embodiment, these sample log files can also be used to meet the requirements of auditing, data accumulation, and problem troubleshooting of many support systems of the service business.
[0043] It should be noted that the sample logs of these service businesses have explicit characteristics such as clear logical relationships, simplicity, periodic fluctuations, and intuitiveness. For example, these sample logs have the explicit characteristic of time sequence.
[0044] By preprocessing and cleaning these sample log files, removing redundant timestamps and other information generated during the transmission process, the processed logs are input into a database (such as a PGSQL database) for storage to obtain sample log sets. These stored sample log sets may include training set sample log files and test set sample log files.
[0045] In an embodiment of the present disclosure, these sample log files store multiple log entries, wherein a series of log entries recorded in chronological order is a sample log sequence, and each sample log file may contain a sample log sequence within a specific time period.
[0046] In operation S120, based on time sequence information of the sample log sequence, first key characters in the sample log are extracted to construct a first key character sequence.
[0047] In the embodiment of the present disclosure, the acquired training set sample log file stores log entries that are continuous in chronological order (i.e., a sample log sequence). Based on the chronological information of the sample log sequence, the first key character (i.e., the log key) of the training set sample log file is extracted through a log file analysis algorithm. The log key is a keyword or identifier used for unique identification (or classification) in the log entry.
[0048] Exemplarily, the Drain analysis algorithm is used to automatically identify and extract log patterns from the sample log files of the training set, and then similar log patterns are extracted by expressing the template of the log message as a regular expression, and a density-based clustering algorithm is used, and finally the clustered log patterns are output as the first key characters after the training set sample log files are structured. The first key characters are extracted by the Drain analysis algorithm, so that each log pattern can be represented by a first key character, which simplifies the processing and analysis of log data.
[0049] For another example, the first key character of the training set sample log file may be identified and extracted through the Logparser analysis algorithm using predefined grammar rules or templates, wherein these rules may be defined based on regular expressions or specific grammar rules.
[0050] Through the embodiments of the present disclosure, the first key characters of the training set sample log files are extracted based on the log file analysis algorithm, which can automatically identify and parse log files of various formats, saving the time of manual log parsing; structured log files can be used for anomaly detection and fault diagnosis, making log data easier to manage, query and analyze more efficiently.
[0051] In an embodiment of the present disclosure, the first key characters in all training set sample log files are extracted to form a first key character set. The sample log sequence is converted into a first key character sequence by querying the first key character set, and multiple first key character sequences constitute the first key character sequence set.
[0052] When processing the data in the service business field obtained above, such as training, the embodiment of the present disclosure not only considers explicit features such as the time sequence in operation S120, but also considers potential and implicit logical features related to the business. The data processing considering the implicit logical features of the business data itself is specifically described below.
[0053] In operation S130 , based on the log graph constructed by the sample log sequence, business logic information in the log graph is extracted to construct a second key character sequence.
[0054] Figure 2 The flowchart of constructing the second key character sequence according to the embodiment of the present disclosure is schematically shown.
[0055] like Figure 2 As shown, based on the log graph constructed based on the sample log sequence, extracting the business logic information in the log graph to construct the second key character sequence can further specifically include operations S210-S230.
[0056] In operation S210, based on the business rules, the sample log sequence is constructed into a log graph, wherein the nodes of the log graph are sample logs in the sample log sequence, the edges of the log graph are relationship weights set based on the business rules, and the sample logs contain the second key character.
[0057] In the embodiments of the present disclosure, business rules are set for the data in the above service business fields (for example, the business rules are shown in the table below). The set business rules reflect the business relationship and can be adjusted according to the business scenario.
[0058] Business rules table
[0059]
[0060] According to the business rule table set above, the sample log sequence is constructed into a specific type of data structure, namely the log graph, based on graph theory through PyTorch Geometric (extension library for processing graph data). In the log graph, the nodes of the log graph are the sample logs in the sample log sequence, the edges of the log graph are the relationship weights set based on the business rules, and the sample log contains the second key character.
[0061] For example, according to the various rules in the above business rule table, the weight of the edge between each node in the established log graph can be 0.5 according to Rule 1, 1 according to Rule 2, 1 according to Rule 3, 0.7 according to Rule 4, 0.8 according to Rule 5, and 0.8 according to Rule 6. By establishing a log graph, the business logic relationship established between sample logs can be reflected, and the acquired log data can be better analyzed to find potential problems or anomalies.
[0062] In operation S220, a neural network algorithm is used to obtain business logic information between nodes in the log graph to generate a low-dimensional vector set of the nodes.
[0063] Figure 3 The flowchart of generating a low-dimensional vector set of a node according to an embodiment of the present disclosure is schematically shown.
[0064] like Figure 3 As shown, the business logic information between the nodes in the log graph is obtained by using a neural network algorithm to generate a low-dimensional vector set of the nodes, which can further specifically include operations S310~S320.
[0065] In operation S310 , based on the weights of the edges, a plurality of nodes in the log graph are traversed to obtain a plurality of node sequences.
[0066] In operation S320 , based on the learning of the node sequence, co-occurrence information between nodes is captured to obtain a low-dimensional vector set of the nodes, wherein the co-occurrence information includes business logic information between the nodes.
[0067] Specifically, based on the weight values of the edges between nodes in the generated log graph, the sample logs in each sample log sequence are obtained by walking sampling by traversing multiple nodes in the log graph, which can avoid the generation of invalid sequences and reduce the amount of data processing. Through the DeepWalk algorithm (unsupervised graph embedding algorithm), the sample logs in the nodes are represented as low-dimensional continuous vectors to capture the co-occurrence information between the nodes in the graph, where the co-occurrence information includes the business logic information between the sample log nodes.
[0068] In operation S230, a second key character sequence is constructed based on similarity aggregation of multiple dimension vector sets.
[0069] For example, based on the business logic information between the low-dimensional continuous vector generated above and the captured sample logs, similarity aggregation is completed through the K-means clustering algorithm to obtain a new log key set, that is, a second key character sequence set.
[0070] In operation S140, the first key character sequence and the second key character sequence are merged to obtain a target log library.
[0071] Specifically, the first key character sequence set and the second key character sequence set obtained in the above operation S120 and operation S130 are merged to obtain an enriched target log library. At this time, the business logic relationship between the sample logs is also added to the first key character sequence. For example, if a log key is a log key (second key character) in the new log key set generated after clustering , the log key (first key character) in the original log key set is , when the first key character sequence set is merged with the second key character sequence set, the original log key sequence is enriched as .
[0072] At present, when processing log data and performing anomaly detection, usually only the significant features of the service business log data, such as clear and intuitive logical relationships, are considered. As a result, the accuracy of abnormal log identification in the service business field is still low, resulting in the use of the full amount of log retention, which wastes huge storage resources.
[0073] Based on the problems of log data processing in the above-mentioned related technologies, the embodiments of the present disclosure propose to establish a recognition model based on the above-mentioned target log library and identify abnormal logs. By establishing a log library by considering implicit features such as business logic information in the log data, the accuracy of business log recognition is improved while occupying fewer resources, and the non-recognition rate is reduced. Compared with the huge waste of storage resources in the related technologies, the embodiments of the present disclosure not only improve the storage efficiency of the storage space and save resources, but also improve the response speed of the service system operation. In addition, in the process of abnormal log detection based on the recognition model, the present disclosure introduces a reverse input sequence to consider the impact of subsequent information on previous information, which not only improves the accuracy of abnormal recognition of business logs, but also enhances the credibility of log data and the traceability of business log data.
[0074] Next, based on the target log library established by the above log processing method, abnormal log identification is described in detail.
[0075] First, the training based on the target log library and the establishment of the recognition model are explained.
[0076] Figure 4 A schematic diagram of a recognition model according to an embodiment of the present disclosure is shown.
[0077] In an embodiment of the present disclosure, based on the above establishment of the target log library, the target log library is used as training data for pre-training to establish a recognition model. For example, the recognition model can be a service log optimization model (Service Log Optimization, SLO). In addition to including a first key character sequence set obtained by extracting explicit features such as the time sequence of the training set sample log files, a second key character sequence set obtained by extracting implicit features such as business logic information based on the training set sample log files, and the fused target log library, the recognition model also includes a bidirectional RNN (bidirectional recurrent neural network). Figure 4 As shown, the architecture of the recognition model may include a sample log input unit 401, a time sequence feature extraction unit 402, a first key character sequence unit 403, an implicit business feature extraction unit 404, a second key character sequence unit 405, a target log library unit 406 and a RNN unit 407.
[0078] In the embodiment of the present disclosure, the process of pre-training the recognition model includes: extracting the key character sequence in the target log library based on the sliding window to obtain multiple training sequences at the current time t. For example, the size of the sliding window is selected as h, where h is an integer greater than 0, such as h can be 10 to obtain the key character training sequence {k1,,,K m}, m is greater than 1.
[0079] Then the training sequence is input into the initial recognition model to obtain the information of the training sequence at time tn and time t+n. For example, the key character training sequence {k1,,,K m}Input into the bidirectional RNN to obtain the bidirectional information of the training sequence, that is, the information at time tn and the information at time t+n.
[0080] Based on the obtained information at time tn and time t+n, the conditional probability of the next key character under the condition of the current training sequence is predicted, wherein the conditional probability is used to represent the abnormal probability corresponding to the key character sequence; based on the prediction result of the conditional probability and the next key character label of the current training sequence, the model parameters of the initial recognition model are updated to train the recognition model.
[0081] Through the embodiments of the present disclosure, a first key character sequence with explicit features and a second key character sequence with business implicit logic features are merged to obtain a target log library, so that the training data of the target log library is richer, thereby making the recognition model more accurate in identifying abnormal logs.
[0082] Next, the determination of abnormal logs based on the recognition model trained by the log library is described in detail.
[0083] Figure 5 The flowchart of determining whether a log sequence is abnormal according to an embodiment of the present disclosure is schematically shown. Figure 6 A schematic diagram of log sequence anomaly recognition based on a recognition model according to an embodiment of the present disclosure is shown.
[0084] like Figure 5 As shown, based on determining that the log sequence is abnormal, operations S510 to S520 may be further specifically included.
[0085] In operation S510, an initial log sequence generated by a business event is converted into a key character sequence based on a target log library.
[0086] Specifically, if Figure 6As shown in the figure, after obtaining the initial log sequence {log1, log3, log23, log7, log53, log4} generated by a certain business event, the initial log sequence is constructed into a key character sequence {k3, k1, k4, k8, k 10 ,k9,,,k 19 ,k 21}.
[0087] In operation S520 , based on the recognition model including the target log library, the abnormal probability of the key character sequence is obtained to determine that the initial log sequence is abnormal.
[0088] like Figure 6 As shown, based on the sliding window h=10, the key character sequence is extracted to obtain multiple input sequences {k3, k1, k4, k8, k 10 ,k9,,,k 19}, can also be defined as a sequence W, where t is an integer greater than 0.
[0089] The sequence W is input into the SLO model, and the information of the sequence W to be input at time tn and time t+n is obtained through the RNN of the SLO model, where t and n are both integers greater than 0. The information at time tn and the information at time t+n here can also be the forward information and backward information of the sequence W to be input at the current time t.
[0090] Based on the information at time tn and time t+n, the conditional probability P of the next key character under the current key character sequence W is calculated through the Softmax function in the RNN. By comparing the conditional probability P with the preset threshold, it is determined whether the key character sequence W is abnormal. Whether the character sequence W is abnormal indicates whether the initial log sequence is abnormal.
[0091] like Figure 6 As shown, P(k 21 |w)=0.9, P(k3|w)=0.7, P(k5|w)=0.5 are all greater than the preset threshold, that is, the key character k 21、 k 3、 k5 are all normal, and the corresponding key character sequences are also normal; P(k 10 |w)=0.1 is lower than the preset threshold, that is, the key character k 10 is abnormal, and the corresponding key character sequence is also abnormal.
[0092] Through the embodiments of the present disclosure, when performing anomaly detection, a bidirectional RNN is used to mine the forward information and backward information of the input sequence, while considering the impact of subsequent events on current events, thereby improving the accuracy of identifying business log anomalies, enhancing the credibility of log data, and improving the traceability capability of business log data.
[0093] Based on the above log processing method, the present disclosure also provides a log processing device. Figure 7 The device is described in detail.
[0094] Figure 7 The structural block diagram of the log processing device according to an embodiment of the present disclosure is schematically shown.
[0095] like Figure 7 As shown, the log processing device 700 of this embodiment includes a sample log acquisition module 710 , a first key character sequence construction module 720 , a second key character sequence construction module 730 and a target log library construction module 740 .
[0096] The sample log acquisition module 710 is used to acquire a sample log sequence. In one embodiment, the sample log acquisition module 710 can be used to perform the operation S110 described above, which will not be described in detail here.
[0097] The first key character sequence construction module 720 is used to extract the first key character in the sample log to construct the first key character sequence based on the time sequence information of the sample log sequence. In one embodiment, the first key character sequence construction module 720 can be used to perform the operation S120 described above, which will not be repeated here.
[0098] The second key character sequence construction module 730 is used to extract the business logic information in the log graph based on the log graph constructed by the sample log sequence to construct the second key character sequence. In one embodiment, the second key character sequence construction module 730 can be used to perform the operation S130 described above, which will not be repeated here.
[0099] The target log library construction module 740 is used to merge the first key character sequence with the second key character sequence to obtain a target log library. In one embodiment, the target log library construction module 740 can be used to perform the operation S140 described above, which will not be repeated here.
[0100] According to an embodiment of the present disclosure, any multiple modules of the sample log acquisition module 710, the first key character sequence construction module 720, the second key character sequence construction module 730 and the target log library construction module 740 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the sample log acquisition module 710, the first key character sequence construction module 720, the second key character sequence construction module 730 and the target log library construction module 740 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in an appropriate combination of any of them. Alternatively, at least one of the sample log acquisition module 710, the first key character sequence construction module 720, the second key character sequence construction module 730 and the target log library construction module 740 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.
[0101] Figure 8 A block diagram of an electronic device suitable for implementing a log processing method according to an embodiment of the present disclosure is schematically shown.
[0102] like Figure 8 As shown, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0103] In RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, ROM 802 and RAM 803 are connected to each other through a bus 804. The processor 801 executes the various steps of the method flow according to the embodiment of the present disclosure by executing the programs in ROM 802 and / or RAM 803. It should be noted that the program can also be stored in one or more memories other than ROM 802 and RAM 803. The processor 801 can also execute the acquisition of the sample log sequence by executing the program stored in one or more memories; based on the time sequence information of the sample log sequence, extract the first key character in the sample log to construct the first key character sequence; based on the log graph constructed by the sample log sequence, extract the business logic information in the log graph to construct the second key character sequence; merge the first key character sequence with the second key character sequence to obtain the target log library.
[0104] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the I / O interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 803 including a network interface card such as a LAN card, a modem, etc. The communication portion 803 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage portion 808 as needed.
[0105] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0106] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: 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), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.
[0107] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the log processing method provided by the embodiment of the present disclosure.
[0108] The above functions defined in the system / device of the embodiment of the present disclosure are executed when the computer program is executed by the processor 801. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0109] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 803, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0110] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 803, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, apparatus, module, unit, etc. described above can be implemented by a computer program module.
[0111] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0112] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0113] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0114] Although the present disclosure has been shown and described with reference to specific exemplary embodiments of the present disclosure, it should be understood by those skilled in the art that various changes in form and details may be made to the present disclosure without departing from the spirit and scope of the present disclosure as defined by the appended claims and their equivalents. Therefore, the scope of the present disclosure should not be limited to the above-mentioned embodiments, but should be determined not only by the appended claims, but also by the equivalents of the appended claims.
Claims
1. A log processing method, include: Get a sample log sequence; Based on the time sequence information of the sample log sequence, extract the first key character in the sample log to construct a first key character sequence; Based on the log graph constructed by the sample log sequence, extracting the business logic information in the log graph to construct a second key character sequence; The first key character sequence and the second key character sequence are merged to obtain a target log library.
2. The log processing method according to claim 1, wherein the log graph constructed based on the sample log sequence extracts the business logic information in the log graph to construct a second key character sequence, include: Based on the business rules, the sample log sequence is constructed into a log graph, wherein the nodes of the log graph are sample logs in the sample log sequence, the edges of the log graph are relationship weights set based on the business rules, and the sample logs contain a second key character; Using a neural network algorithm to obtain business logic information between nodes in the log graph to generate a low-dimensional vector set of nodes; Based on the similarity aggregation of the plurality of latitude vector sets, a second key character sequence is constructed.
3. The log processing method according to claim 2, wherein the business logic information between the nodes in the log graph is obtained by using a neural network algorithm to generate a low-latitude vector set of the nodes. include: Based on the weights of the edges, traverse multiple nodes in the log graph to obtain multiple node sequences; Based on the learning of the node sequence, co-occurrence information between nodes is captured to obtain a low-dimensional vector set of the nodes, wherein the co-occurrence information includes business logic information between the nodes.
4. The log processing method according to any one of claims 1 to 3, further comprising: include: Based on the target log library, converting the initial log sequence generated by the business event into a key character sequence; Based on the recognition model including the target log library, the abnormal probability of the key character sequence is obtained to determine that the initial log sequence is abnormal.
5. The log processing method according to claim 4, wherein the abnormal probability of the key character sequence is obtained based on the recognition model including the target log library, include: Extracting the key character sequence based on a sliding window to obtain multiple sequences to be input at the current time t, where t is an integer greater than 0; By using the recognition model, information of the sequence to be input at time tn and information of the sequence at time t+n are obtained respectively, where t and n are both integers greater than 0; The conditional probability of the next key character under the condition of the current key character sequence is predicted based on the information at time tn and the information at time t+n, wherein the conditional probability is used to represent the abnormal probability corresponding to the key character sequence.
6. According to the log processing method of claim 5, the recognition model is pre-trained, and the pre-training method include: Extracting key character sequences in the target log library based on a sliding window to obtain multiple training sequences at the current time t; Inputting the training sequence into an initial recognition model to obtain information of the training sequence at time tn and time t+n; Based on the information at time tn and the information at time t+n, predict the conditional probability of the next key character under the condition of the current training sequence, wherein the conditional probability is used to represent the abnormal probability corresponding to the key character sequence; Based on the prediction result of the conditional probability and the next key character label of the current training sequence, the model parameters of the initial recognition model are updated to train the recognition model.
7. A log processing device, include: A sample log acquisition module is used to acquire a sample log sequence; A first key character sequence construction module, configured to extract the first key character in the sample log to construct a first key character sequence based on the time sequence information of the sample log sequence; A second key character sequence construction module, configured to extract business logic information in the log graph based on the log graph constructed by the sample log sequence to construct a second key character sequence; The target log library construction module is used to merge the first key character sequence with the second key character sequence to obtain a target log library.
8. An electronic device, include: one or more processors; a storage device for storing one or more programs, Among them, when the one or more programs are executed by the one or more processors, the one or more processors execute to obtain a sample log sequence; based on the time sequence information of the sample log sequence, extract the first key character in the sample log to construct a first key character sequence; based on the log graph constructed by the sample log sequence, extract the business logic information in the log graph to construct a second key character sequence; merge the first key character sequence with the second key character sequence to obtain a target log library.
Citation Information
Patent Citations
System log detection method of graph network based on self-attention mechanism
CN114741369A
System log anomaly detection method
CN117034099A
Log sequence anomaly detection method based on heterogeneous graph attention neural network
CN118012727A
Database searching using a graph of nodes and edges formed using log node pairs
US20160350442A1
Online detection of anomalies within a log using machine learning
WO2019060327A1
Cited By
Log analysis method and device, electronic equipment and storage medium
CN120780675A
