Abnormality detection method and device, equipment, storage medium and computer program product

By dividing the logs to be detected into log template sequences and performing vector conversion, classification and anomaly positioning processing, the problem of low log anomaly detection efficiency is solved and efficient log anomaly detection and positioning are achieved.

CN118656279AActive Publication Date: 2024-09-17中移信息技术有限公司 +1

Patent Information

Application Number
CN202410713731.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-09-17
Estimated Expiration
2044-06-03

AI Technical Summary

Technical Problem

Existing log anomaly detection methods are inefficient, resulting in a waste of computing resources, and cannot efficiently locate abnormal logs.

Method used

By dividing the log to be detected into multiple log template sequences and inputting them into the vector transformation model, classification model and anomaly positioning model, anomaly detection is performed, the amount of data processed is reduced, and detection efficiency is improved.

Benefits of technology

It improves the efficiency of log anomaly detection, reduces the calculation amount of analyzing sequence features, enhances the accuracy and efficiency of anomaly detection, and can effectively locate abnormal logs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656279A
    Figure CN118656279A
Patent Text Reader

Abstract

The invention discloses an anomaly detection method and device, equipment, a storage medium and a computer program product, and relates to the technical field of system operation and maintenance, and the anomaly detection method comprises the steps that a to-be-detected log is acquired, and the to-be-detected log is divided into a plurality of log template sequences; inputting each log template sequence into a preset vector conversion model to obtain a respective log template vector of each log template sequence; inputting each log template vector into a preset classification model to obtain a respective log type of each log template vector; and inputting the abnormal template vector into a preset abnormal positioning model to obtain abnormal log information in the to-be-detected log corresponding to the abnormal template vector, the abnormal template vector being a vector of which the log type is an abnormal log type in each log template vector. The log anomaly detection efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of system operation and maintenance technology, and in particular to anomaly detection methods, devices, equipment, storage media and computer program products. Background Art

[0002] As an important record generated during the operation of the system, operation and maintenance logs play a vital role in ensuring system stability, timely detection of problems, and ensuring business continuity. Log anomaly detection is to analyze previous program logs to infer whether the program has already had an error or whether the program will have an error next, with the aim of helping operation and maintenance personnel locate problems and stop losses in a timely manner.

[0003] Currently, the log anomaly detection solutions mainly include the following methods:

[0004] The first method is to obtain the original log data and preprocess it to obtain the log template after dividing the session, extract the sentence vector from the log template, and predict the log sequence that may appear in the future based on the sentence vector.

[0005] The second method is to parse the log into a template, extract the log template frequency vector set, and then generate a log sequence based on the log template frequency vector set as a prediction for the future, and determine whether the log is abnormal based on the prediction.

[0006] The third method is to use a word segmentation tool to count the word frequencies in the logs, use multiple classification models to predict anomalies based on the word frequencies of different words after word segmentation, and vote on the prediction results of each classification model to obtain anomaly detection results.

[0007] However, the above methods all require anomaly checking of all log information in the original log, resulting in low anomaly detection efficiency and waste of computing resources.

[0008] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0009] The main purpose of this application is to provide an anomaly detection method, device, equipment, storage medium and computer program product, aiming to solve the technical problem of low log detection efficiency.

[0010] To achieve the above objectives, the present application proposes an anomaly detection method, the method comprising:

[0011] Obtaining a log to be detected, and dividing the log to be detected into a plurality of log template sequences;

[0012] Inputting each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences;

[0013] Inputting each of the log template vectors into a preset classification model to obtain a log type of each of the log template vectors;

[0014] The abnormal template vector is input into a preset abnormality positioning model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector, wherein the abnormal template vector is a vector whose log type is an abnormal log type in each of the log template vectors.

[0015] In one embodiment, the step of dividing the log to be detected into a plurality of log template sequences includes:

[0016] Inputting the log to be detected into a log parsing model to obtain at least one log template;

[0017] Dividing the logs to be detected into a plurality of sequences to be detected according to preset time intervals;

[0018] For any target sequence to be tested in each of the sequences to be tested, the at least one log template is used to replace each piece of original log information in the target sequence to be tested, so as to obtain a log template sequence.

[0019] In one embodiment, the step of using the at least one log template to replace each original log information in the target sequence to be tested to obtain a log template sequence includes:

[0020] For any target log information in each of the original log information, determining a matching degree between the target log information and the at least one log template;

[0021] The target log information is replaced by a log template whose matching degree is greater than a preset threshold among the at least one log template.

[0022] In one embodiment, the vector conversion model includes an encoder;

[0023] The step of inputting each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences comprises:

[0024] For any log template sequence in each of the log template sequences, perform word segmentation processing on the log template sequence to obtain a word vector of each word in the log template sequence, and determine the position information of each word in the log template sequence;

[0025] The word vectors of the respective words and the position information are input into an encoder to obtain a position vector and a template vector, and the position vector and the template vector are used as the log template vector.

[0026] In one embodiment, the classification model includes a convolution block, an activation function, a pooling layer, a fully connected layer, and a normalization function;

[0027] The step of inputting each of the log template vectors into a preset classification model to obtain the log type of each of the log template vectors includes:

[0028] For any target template vector in each of the log template vectors, input the target template vector into the convolution block to obtain a regional feature;

[0029] Inputting the region feature into the activation function to obtain a first feature;

[0030] Inputting the first feature into the pooling layer to obtain a second feature;

[0031] If it is detected that the sequence length of the second feature is greater than the preset step length, the second feature is input into the convolution block until the sequence length of the output feature of the convolution block is less than or equal to the preset step length, thereby obtaining the target feature;

[0032] Inputting the target feature into the fully connected layer to obtain a category score vector;

[0033] The category score vector is input into the normalization function to obtain the category probability of each of the log types, and the log type of the target template vector is determined based on each of the category probabilities.

[0034] In one embodiment, the anomaly localization model includes a feature extraction layer and a prediction layer;

[0035] The step of inputting the abnormal template vector into a preset abnormality positioning model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector includes:

[0036] Inputting the abnormal template vector into the feature extraction layer, and determining the current window template feature of the abnormal template vector through the sliding window of the feature extraction layer;

[0037] Inputting the current window template feature into the prediction layer to obtain a next window prediction vector;

[0038] If the next window prediction vector is inconsistent with the next window actual vector determined based on the sliding window, it is determined that the log information corresponding to the next window actual vector in the log to be detected is the abnormal log information.

[0039] In addition, to achieve the above purpose, the present application also proposes an abnormality detection device, which includes:

[0040] An acquisition module is used to acquire the log to be detected and divide the log to be detected into multiple log template sequences;

[0041] A vector conversion module, used for inputting each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences;

[0042] A classification module, used for inputting each of the log template vectors into a preset classification model to obtain a log type of each of the log template vectors;

[0043] The anomaly locating module is used to input the anomaly template vector into a preset anomaly locating model to obtain the anomaly part of the log to be detected corresponding to the anomaly template vector, wherein the anomaly template vector is a vector of the log type of each log template vector that is an abnormal log type.

[0044] In addition, to achieve the above-mentioned purpose, the present application also proposes an anomaly detection device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the anomaly detection method described above.

[0045] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the anomaly detection method described above are implemented.

[0046] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the anomaly detection method described above are implemented.

[0047] In the present application, a log to be detected is obtained, and the log to be detected is divided into multiple log template sequences; each of the log template sequences is input into a preset vector conversion model to obtain a log template vector of each log template sequence; each of the log template vectors is input into a preset classification model to obtain a log type of each log template vector; an abnormal template vector is input into a preset abnormality location model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector, wherein the abnormal template vector is a vector whose log type is an abnormal log type in each of the log template vectors.

[0048] In the present application, by classifying the log template vectors, the abnormal template vectors determined after classification are input into a preset anomaly location model for anomaly detection. Compared with predicting anomalies one by one for all log information of the log to be detected, the present application can reduce the amount of data processed during anomaly detection, thereby improving the efficiency of log anomaly detection.

[0049] Furthermore, the present application reduces the amount of computation required to analyze sequence features in an anomaly detection model by parsing the logs into templates, thereby reducing the number of times the anomaly detection model is run when processing normal log sequences, thereby improving the efficiency of log anomaly detection.

[0050] At the same time, when performing log classification and anomaly location in the present application, the log template vector of the log template sequence is reused, which can reduce the operation steps of converting the sequence into a vector during log classification and anomaly location, thereby improving the processing efficiency of log classification and anomaly location, and improving the efficiency of log anomaly detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0052] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0053] Figure 1 A flowchart of the first embodiment of the anomaly detection method of the present application is provided;

[0054] Figure 2 A flowchart of the second embodiment of the anomaly detection method of the present application is provided;

[0055] Figure 3 A brief flowchart of the anomaly detection method provided in Example 1 of the present application;

[0056] Figure 4 A schematic diagram of the structure of a classification model provided in one embodiment of the present application;

[0057] Figure 5 A schematic diagram of the structure of the attention mechanism in the anomaly localization model provided in one embodiment of the present application;

[0058] Figure 6 This is a schematic diagram of the module structure of the abnormality detection device according to an embodiment of the present application;

[0059] Figure 7Schematic diagram of the device structure of the hardware operating environment involved in the anomaly detection method in the embodiment of the present application.

[0060] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0061] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0062] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0063] The main solution of the embodiment of the present application is: obtain the log to be detected, and divide the log to be detected into multiple log template sequences; input each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences; input each of the log template vectors into a preset classification model to obtain a log type of each of the log template vectors; input the abnormal template vector into a preset abnormal location model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector, wherein the abnormal template vector is a vector whose log type is an abnormal log type in each of the log template vectors.

[0064] In this embodiment, for ease of description, the following description is made with the abnormality detection device as the execution subject.

[0065] Log anomaly detection is to analyze previous program logs to infer whether the program has already had an error or whether the next program will have an error. The purpose is to help operation and maintenance personnel locate problems and stop losses in time. The conventional process is to establish a log template library and use the template library to extract templates, indicators and other data from the log as analysis materials. After that, the templates and indicators can be analyzed based on statistics, traditional machine learning, deep learning, etc. Log anomaly detection is usually a self-supervised training model. The detection method is to determine whether the current number of templates and indicators are abnormal, or to predict the future log templates and indicator conditions and compare them with the actual situation.

[0066] The current log anomaly detection solutions are mainly:

[0067] Solution 1: First, obtain the original log data and preprocess it to get the log template after dividing the session. Then, use the pre-trained BERT (Bidirectional Encoder Representations from Transformers) to extract sentence vectors from the log templates, and use Informer (Long Short-Term Forecast (LSTF) based on the Transformer (Transformer Architecture) architecture) as the anomaly detection model for analyzing template sequences. Then, the template sequence feature encoding with semantic information and position information is input into the pre-established anomaly detection model for training to predict possible log sequences in the future.

[0068] However, this method requires checking the logs segment by segment or sentence by sentence. In fact, the number of abnormal logs is less than that of normal logs. This method causes the abnormal detection to detect unnecessary normal logs, reducing the efficiency of abnormal detection.

[0069] In addition, the Informer-Encoder selects the factors involved in the dot multiplication operation through random sampling to reduce the amount of calculation. In the scenario of a small data set, random sampling may cause the model to ignore important features in the sequence, resulting in a decrease in the accuracy of subsequent anomaly detection results.

[0070] Solution 2: Parse the log into a template, then use Bi-GRU (Bidirectional Gated Recurrent Units) to extract the log template frequency vector set, and then use another Bi-GRU to generate a log sequence as a prediction sequence for the log template frequency vector set. Based on the difference between the predicted sequence and the actual sequence, determine whether the log is abnormal.

[0071] However, this method requires checking the logs segment by segment or sentence by sentence. In fact, the number of abnormal logs is less than that of normal logs. This method causes the abnormal detection to detect unnecessary normal logs, reducing the efficiency of abnormal detection.

[0072] Moreover, in long log template sequences, Bi-GRU cannot efficiently capture long-distance correlations.

[0073] Solution 3: Use word segmentation tools to count the frequency of words in the logs, use multiple classification models to predict anomalies based on the frequency of different words after word segmentation, and then vote and merge the prediction results to obtain anomaly detection results. For example, the classification method can use three traditional machine learning models at the same time: xgboost (eXtreme GradientBoosting), KNN (K-Nearest Neighbor), and Naive Bayes.

[0074] However, this method requires checking the logs segment by segment or sentence by sentence. In fact, the number of abnormal logs is less than that of normal logs. This method causes the abnormal detection to detect unnecessary normal logs, reducing the efficiency of abnormal detection.

[0075] Moreover, this method requires complex feature engineering. In addition to conventional log template extraction, it also requires preprocessing operations such as TF-IDF (Term Frequency-Inverse Document Frequency) word frequency statistics and PCA (Principal Component Analysis) dimensionality reduction. In addition, multiple links require parameter adjustment, which affects the efficiency of anomaly detection.

[0076] In addition, judging whether a log is abnormal based on word frequency statistics does not utilize the characteristics of log sequence, and cannot judge whether a log is abnormal based on different log sequences. At the same time, this method cannot locate abnormal logs.

[0077] Solution 4: Use a word segmentation tool to convert multiple original logs into word vectors and input them into the trained neural network model. The neural network model outputs the log anomaly detection results.

[0078] However, this method requires checking the logs segment by segment or sentence by sentence. In fact, the number of abnormal logs is less than that of normal logs. This method causes the abnormal detection to detect unnecessary normal logs, reducing the efficiency of abnormal detection.

[0079] At the same time, the model input of this method consists of multiple log sequences, and it is impossible to locate which specific log has an error during the anomaly detection process.

[0080] In summary, the existing log detection methods have high computational complexity, which affects the efficiency of anomaly detection, and some methods have the problem of being unable to locate abnormal logs.

[0081] In an embodiment of the present application, by classifying the log template vector, the abnormal template vector determined after classification is input into a preset abnormality localization model for abnormality detection. Compared with predicting abnormalities one by one for all log information of the log to be detected, the present application can reduce the amount of data processed during abnormality detection, thereby improving the efficiency of log anomaly detection.

[0082] Furthermore, in the embodiment of the present application, in the process of performing anomaly detection by using the anomaly location model, the abnormal log information in the abnormal log is simultaneously determined, thereby improving the efficiency of anomaly detection.

[0083] In addition, the present application reduces the amount of computation required to analyze sequence features in an anomaly detection model by parsing the logs into templates, thereby reducing the number of times the anomaly detection model is run when processing normal log sequences, thereby improving the efficiency of log anomaly detection.

[0084] At the same time, in the embodiment of the present application, when performing log classification and anomaly location, the log template vector of the log template sequence is reused, which can reduce the operation steps of converting the sequence into a vector during log classification and anomaly location, thereby improving the processing efficiency of log classification and anomaly location, and improving the efficiency of log anomaly detection.

[0085] Compared with the existing solutions given above, the embodiment of the present application adopts an anomaly detection strategy from simple classification to step-by-step prediction, filtering out the normal log sequences that account for the vast majority of actual scenarios from anomaly detection. At the same time, anomaly detection can be used as a proofreading. When the classification model determines that the sequence is abnormal, and the anomaly detection model does not find an anomaly, the sequence is determined to be a normal sequence, which reduces the number of times the anomaly detection model is run when processing normal log sequences, thereby improving the efficiency of log anomaly detection.

[0086] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, anomaly detection equipment, etc. The following takes an anomaly detection equipment as an example to illustrate this embodiment and the following embodiments.

[0087] Based on this, the present application embodiment provides an abnormality detection method, referring to Figure 1 This is a flow chart of the first embodiment of the abnormality detection method of the present application.

[0088] In this embodiment, the abnormality detection method includes steps S10 to S40.

[0089] Step S10: obtaining the log to be detected, and dividing the log to be detected into a plurality of log template sequences.

[0090] It should be noted that the log to be detected is a log that needs to be detected for anomalies. The log to be detected may include multiple log information, which is not limited here.

[0091] The log template sequence refers to a sequence obtained by replacing each day information in the log to be detected with a log template. The order of each template in the log template sequence is the same as the order of the log information corresponding to the template in the log.

[0092] Specifically, the process of dividing the log to be detected into multiple log template sequences can be: extracting log templates from the log to be detected, and using the log templates to replace the original log information. The method of extracting log templates from the log to be detected is not limited here. For example, the log templates can be extracted through a log parsing model, or the same information of each log information can be extracted and the log templates can be generated based on the data type to which the same information of each log information belongs.

[0093] Step S20: input each log template sequence into a preset vector conversion model to obtain a log template vector of each log template sequence.

[0094] In this embodiment, a preset vector conversion model is obtained by taking a sample sequence as input data and a sample vector corresponding to the sample sequence as a label for training. There is no limitation on the structure of the vector conversion model, for example, it may be a BERT model.

[0095] The log template sequence is input into the vector conversion model, and the log template sequence is converted into a vector through the vector conversion model, which is hereinafter referred to as the log template vector.

[0096] Step S30: input each log template vector into a preset classification model to obtain the log type of each log template vector.

[0097] In this embodiment, a preset classification model is obtained by taking a sample vector as input data and a log type of the sample vector as a label for training. There is no restriction on the structure of the vector conversion model, which can be set according to actual needs.

[0098] Each log template vector is input into the classification model, and the log type corresponding to each log template vector is obtained through the classification model. The log type is a normal log type or an abnormal log type. The log type is used to indicate whether there is abnormal log information in the log information corresponding to the log template vector. The normal log type indicates that there is no abnormal log information in the log information corresponding to the log template vector, and the abnormal log type indicates that there is abnormal log information in the log information corresponding to the log template vector.

[0099] Step S40, inputting the abnormal template vector into a preset abnormality location model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector, wherein the abnormal template vector is a vector of the log type of each log template vector being an abnormal log type.

[0100] In this embodiment, a preset anomaly location model is obtained by taking an abnormal sample vector as input data and the abnormal part in the log corresponding to the abnormal sample vector as label training, wherein the abnormal sample vector is a vector whose log type in each sample vector is an abnormal log type. There is no restriction on the structure of the vector conversion model here, and it can be set according to actual needs.

[0101] In the following, the vectors whose log types are abnormal log types in each log template vector are referred to as abnormal template vectors. The abnormal template vectors are input into the abnormality location model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vectors.

[0102] In this embodiment, by classifying the log template vectors, the abnormal template vectors determined after classification are input into a preset abnormality localization model for abnormality detection. Compared with predicting abnormalities one by one for all log information of the log to be detected, the present application can reduce the amount of data processed during abnormality detection, thereby improving the efficiency of log anomaly detection.

[0103] Moreover, during the anomaly detection process, the anomaly localization model simultaneously determines the anomaly log information in the anomaly log, thereby improving the anomaly detection efficiency.

[0104] In addition, this embodiment reduces the amount of calculation for analyzing sequence features in the anomaly detection model by parsing the log into a template, thereby reducing the number of times the anomaly detection model is run when processing a normal log sequence, thereby improving the efficiency of log anomaly detection.

[0105] At the same time, when performing log classification and anomaly location in this embodiment, the log template vector of the log template sequence is reused, which can reduce the operation steps of converting the sequence into a vector during log classification and anomaly location, thereby improving the processing efficiency of log classification and anomaly location, and improving the efficiency of log anomaly detection.

[0106] In some feasible implementations, step S10 includes steps S101 to S103.

[0107] Step S101: input the log to be detected into a log parsing model to obtain at least one log template.

[0108] It should be noted that a log template is a framework for recording and organizing log entries. A log template can help users collect, organize, store and analyze log data in a consistent and effective manner.

[0109] In this implementation, the log template is extracted through the log parsing model Drain (Depth Tree based Online LogParsing, an online log parsing method based on a fixed depth tree). The specific process may be: first, the log data to be detected is divided into a constant part and a variable part, the constant part contains template information describing the system operation event, and the variable part carries other marking information of the dynamic operation of the system; then a parsing tree with a set depth is constructed, and the parsing tree can be dynamically updated and the parsing result of the log is generated by matching the log to be detected with the nodes in the parsing tree layer by layer, thereby obtaining the log template.

[0110] Step S102: dividing the logs to be detected into a plurality of sequences to be detected according to preset time intervals.

[0111] It should be noted that the preset time interval can be set according to actual needs. For example, it can be set so that the lengths of the to-be-detected sequences obtained by division are average.

[0112] Exemplarily, in a feasible implementation, the logs to be detected may be divided into a plurality of sequences to be detected by time windows.

[0113] Step S103: for any target sequence to be tested in each sequence to be tested, at least one log template is used to replace each piece of original log information in the target sequence to be tested, so as to obtain a log template sequence.

[0114] It should be noted that each piece of original log information in the target sequence to be tested may correspond to the same log template or may correspond to different log templates, which is not limited here.

[0115] When using the log template to replace each piece of original log information in the target sequence to be tested, the log template with the highest matching degree with the original log information may be used to replace the original log information.

[0116] It should be noted that the original log information also includes a variable part, and the day information of the variable part can be represented by a placeholder of the log template.

[0117] In some feasible implementations, step S103 includes steps S1031 to S1032.

[0118] Step S1031: for any target log information in each piece of original log information, determine the matching degree between the target log information and at least one log template.

[0119] The method of calculating the matching degree is not limited here. For example, the matching degree may be determined based on the regular expression of the target log information and the log template, or the character similarity between the target log information and the log template may be used as the matching degree.

[0120] Step S1032: Use a log template with a matching degree greater than a preset threshold among at least one log template to replace the target log information.

[0121] In this implementation, by extracting a log template and using the log template to replace the original log information, compared with processing each piece of original log information, this embodiment reduces the amount of calculation for analyzing sequence features during anomaly detection, thereby improving the efficiency of anomaly detection.

[0122] In this embodiment, by classifying the log template vectors, the abnormal template vectors determined after classification are input into a preset abnormality localization model for anomaly detection. Compared with predicting anomalies one by one for all log information of the log to be detected, this application can reduce the amount of data processed during anomaly detection, thereby improving the efficiency of log anomaly detection.

[0123] Furthermore, in this embodiment, in the process of performing anomaly detection by using the anomaly localization model, the anomaly log information in the anomaly log is simultaneously determined, thereby improving the anomaly detection efficiency.

[0124] In addition, this embodiment reduces the amount of calculation for analyzing sequence features in the anomaly detection model by parsing the log into a template, thereby reducing the number of times the anomaly detection model is run when processing a normal log sequence, thereby improving the efficiency of log anomaly detection.

[0125] At the same time, in this implementation, when performing log classification and anomaly location, the log template vector of the log template sequence is reused, which can reduce the operation steps of converting the sequence into a vector during log classification and anomaly location, thereby improving the processing efficiency of log classification and anomaly location, and improving the efficiency of log anomaly detection.

[0126] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 , the vector conversion model includes an encoder, and step S20 includes steps S201 to S202.

[0127] Step S201 : for any log template sequence in each log template sequence, perform word segmentation processing on the log template sequence to obtain a word vector of each word in the log template sequence, and determine the position information of each word in the log template sequence.

[0128] In this embodiment, the vector conversion model can be a BERT model, which uses the encoder layer of the Transformer model to extract features. The training process of the BERT model includes two stages: pre-training and fine-tuning. In the pre-training stage, the BERT model learns word-level and sentence-level features by performing the Masked Language Model task and the Next Sentence Prediction task, and represents the features with vectors.

[0129] In this embodiment, in the process of vector conversion through the BERT model, the log template sequence is first segmented to obtain the word vector of each word in the log template sequence, providing a basis for the subsequent template vector. The position information of each word in the log template sequence is determined to provide a basis for the subsequent position vector.

[0130] Step S202, input the word vector and position information of each word into the encoder to obtain a position vector and a template vector, and use the position vector and the template vector as the log template vector.

[0131] It should be noted that the encoder can contain multiple self-attention mechanisms and feed-forward neural network layers, which work together to capture contextual information in the input sequence.

[0132] In the pre-training stage, in the Masked Language Model task, the BERT model will randomly select some templates and replace them with the masking symbol MASK, and then predict these masked templates based on the context. In this way, the model can learn the contextual relationship between words. In the Next Sentence Prediction task, the BERT model will perform sentence-level tasks to determine whether two template sequences are continuous in order to capture the correlation between sequences. After pre-training, the BERT model can output sentence vectors corresponding to the template sequence. These sentence vectors contain information about the template vector and the position vector, which can reflect the contextual relationship of the template in the sequence.

[0133] During the fine-tuning phase, the BERT model is trained using a labeled task-specific dataset that contains label information related to the specific log anomaly detection task. According to the objective function of the specific task, the fine-tuning phase optimizes the model parameters so that the model can better adapt to the log anomaly detection task.

[0134] Therefore, in this embodiment, the sentence vector that can be obtained by feature extraction through the BERT model includes a template vector (LogKey Embedding) and a position vector (Position Embedding) between templates. The template vector represents the semantic information of each template, and the position vector provides the position information of the template in the sequence.

[0135] In some feasible implementations, the classification model includes a convolution block, an activation function, a pooling layer, a fully connected layer and a normalization function, and step S30 includes steps S301 to S306.

[0136] Step S301: for any target template vector in each log template vector, the target template vector is input into a convolution block to obtain a regional feature.

[0137] The convolution layer is the core part of the convolutional neural network, which is responsible for extracting the features of the input data. In the convolution operation, each convolution kernel slides on the input data and performs a dot product operation to generate feature maps, which capture the regional features of the target template vector. In this embodiment, there is no restriction on the specifications of the convolution kernel.

[0138] It should be noted that, in a feasible implementation manner, the target template vector may include a position vector and a template vector. In this implementation manner, the position vector and the template vector may be added to a vector and then a convolution layer is performed.

[0139] Step S302: input the regional feature into an activation function to obtain a first feature.

[0140] It should be noted that after the convolution operation, an activation function is used to perform a nonlinear transformation on the output of the convolution layer. The activation function can be ReLU (Rectified Linear Unit), sigmoid (logistic function) and tanh (Hyperbolic Tangent), etc. There is no restriction here. The activation function can increase the nonlinear expression ability of the network.

[0141] Step S303: input the first feature into the pooling layer to obtain the second feature.

[0142] After the activation function, a pooling layer is used to downsample the feature map to reduce the spatial resolution of the data, thereby reducing the number of parameters and preventing overfitting. In one feasible implementation, a large pooling layer can be used, and the maximum pooling layer takes the maximum value in each pooling window as the output.

[0143] Step S304: If it is detected that the sequence length of the second feature is greater than the preset step length, the second feature is input into the convolution block until the sequence length of the output feature of the convolution block is less than or equal to the preset step length, thereby obtaining the target feature.

[0144] It should be noted that, in this embodiment, by controlling the sequence length of the target feature and the granularity of the information, a shorter sequence length helps to reduce the subsequent amount of calculation and the use of storage space, thereby improving the efficiency of anomaly detection.

[0145] In a specific implementation, the preset step size can be set according to actual needs and is not limited here.

[0146] Step S305: input the target feature into the fully connected layer to obtain a category score vector.

[0147] It should be noted that each element in the category score vector represents the score corresponding to a different log type, and the score can represent the possibility that the target template vector is the corresponding log type.

[0148] Step S306 : Input the category score vector into a normalization function to obtain the category probability of each log type, and determine the log type of the target template vector based on each category probability.

[0149] It should be noted that the log type with the highest probability among the various type probabilities may be determined as the log type of the target template vector.

[0150] In a feasible embodiment, the anomaly localization model includes a feature extraction layer and a prediction layer; step S40 includes steps S401 to S402.

[0151] Step S401, inputting the abnormal template vector into the feature extraction layer to obtain the current window template feature in the preset sliding window.

[0152] The abnormal template vector is input into the feature extraction layer, and the preset sliding window of the feature extraction layer slides on the normal template vector, and the feature representation of the data in a window is extracted each time, which is referred to as the current window template feature for distinction.

[0153] In a specific implementation, the length of the sliding window can be set according to actual needs and is not limited here.

[0154] Step S402: Input the current window template feature into the prediction layer to obtain the next window prediction vector.

[0155] Based on the current window template features, a neural network is used for prediction, such as a fully connected layer, LSTM (Long Short-Term Memory), GRU (Gated Recurrent Unit) and other neural networks, to output a prediction candidate set, that is, the probability of each log template appearing in the next window. The template vector corresponding to the log template with the highest probability of appearing is used as the prediction vector for the next window.

[0156] Step S403: If the next window prediction vector is inconsistent with the next window actual vector of the sliding window, it is determined that the log information corresponding to the next window actual vector is abnormal log information.

[0157] It should be noted that the actual vector of the next window refers to the template vector corresponding to the log template actually appearing in the next window.

[0158] If the next window prediction vector is inconsistent with the next window actual vector of the sliding window, it indicates that the next window actual vector is inconsistent with the expected result, and the log information corresponding to the next window actual vector is determined to be abnormal log information.

[0159] If the next window prediction vector is consistent with the next window actual vector of the sliding window, it is determined that the log information corresponding to the next window actual vector is normal log information.

[0160] In this embodiment, by parsing the log into a template, the amount of calculation for analyzing sequence features in the anomaly detection model is reduced, thereby reducing the number of times the anomaly detection model is run when processing a normal log sequence, thereby improving the efficiency of log anomaly detection.

[0161] For example, in order to help understand the technical concept or technical principle of log anomaly detection after the present embodiment is combined with the above-mentioned embodiment 1 and embodiment 2, refer to Figure 3 , the process of anomaly detection can be:

[0162] Step S1: Obtain original log data and perform preprocessing to obtain a template sequence.

[0163] In the preprocessing in step S1, the original log data is operated for log parsing and session division, thereby generating a log template sequence. Specifically, using the Drain log parsing model, log parsing includes the following process: First, the original log data is divided into two parts: a constant part and a variable part. The constant part contains template information that describes system operation events, while the variable part carries other tag information of the dynamic operation of the system. Then a parse tree with a set depth is constructed. By matching the original log with the nodes in the parse tree layer by layer, the parse tree can be dynamically updated and the parsing results of the log can be generated, thereby obtaining the log template information.

[0164] In terms of session division, logs are divided into multiple sequences according to the time window and then replaced with log templates to form multiple log template sequences. The selection of the time window mainly considers that the average sequence length is long and the periodic operation of the system function can be included as much as possible.

[0165] Step S2: Input the template sequence into the pre-trained BERT model to obtain the sentence vector.

[0166] The log templates divided by the session in step S1 are input into the BERT language model for pre-training. In this way, the sentence vector corresponding to the template sequence can be obtained. For the log template sequence within a session, the encoder layer of the Transformer model is used to extract features. It goes through two training stages: pre-training and fine-tuning. In the pre-training stage, it learns word-level and sentence-level features by performing the Masked Language Model task and the Next Sentence Prediction task, and represents the features with vectors. In particular, the sentence vector contains the template vector (LogKey Embedding) and the position vector (Position Embedding) between the templates.

[0167] Step S3: classify and predict the template sequence using a classification model.

[0168] Logs are divided into normal logs and abnormal logs, where normal and abnormal can be classified according to system operation functions or applications. For example, logs are divided into application 1 normal, application 1 abnormal 1, application 1 abnormal 2, application 1 abnormal 3, application 2 normal, application 2 abnormal 1, application 2 abnormal 2, and application 2 abnormal 3. This embodiment uses DPCNN (Deep Pyramid Convolutional Neural Networks for Text Categorization) to classify and train the log template sequence. In particular, the vectorized model in the anomaly detection model can be reused at this time to save computing resources. The following considerations are made for the selection of the classification model: the running complexity and time are lower than those of the anomaly detection model; since the input of the anomaly detection model is a long sequence with complete periodicity, the classification model must have a certain long-distance association analysis capability.

[0169] Specifically, DPCNN obtains long-range correlations in sequences by stacking convolutional layers. Figure 4 As shown in the figure, a convolution block contains 2 convolution layers. Whether to recycle through the convolution block is determined by judging whether the length of the sequence entering the convolution block is greater than 2.

[0170] The DPCNN model training process can be:

[0171] Step S31: First, the template vector and the position vector are added together and then multiple common single vectors (Word Embedding) are converted into region vectors (Region Embedding) through the convolution kernel. Each time through the convolution block, residual connection is used to prevent gradient vanishing and gradient explosion.

[0172] Step S32: Each convolution in the convolution block must be preceded by Relu activation and padding. The MaxPooling layer in the convolution block has a step size of 2, and the sequence length is halved in each loop. When the sequence length is 1, the convolution block loop is stopped.

[0173] Step S33: Finally, the fully connected layer outputs the category of the sequence, and the probability of each category is calculated using Softmax (Soft Maximum, normalized exponential function). After the log data to be tested is processed according to step S1, classification training is performed, and the classification loss is Softmax.

[0174] Step S4: Use the anomaly detection model to perform abnormal log location prediction.

[0175] The anomaly detection model uses the MaskedLanguage Model based on the autocorrelation Transformer (ie, Autoformer), and uses the Autoformer encoder to extract the features of the template sequence. The autocorrelation mechanism enables the model to learn subsequence features with periodicity, so as to better predict normal sequences. The anomaly detection model is trained by self-supervised training, which only learns to predict normal logs. When predicting, a sliding window is used to input a part of the log to predict subsequent logs. If the actual log received later is different from the prediction, it is considered that an anomaly has occurred at that location. This embodiment includes multiple encoding-decoding blocks, and the structure of one encoding-decoding block is Figure 5 shown.

[0176] Step S41, construct an anomaly detection model based on the autocorrelation mechanism. The anomaly detection model includes the following modules: The anomaly detection model consists of a series of sequentially connected components, including an embedding layer, an attention layer, a residual connection and layer normalization module, a feedforward layer, another residual connection and layer normalization module, and a linear layer. The input of this anomaly detection model is the position vector and template vector obtained by the BERT vectorization model in step S2, and its output is the candidate set that may appear in the next log template.

[0177] First, the sum of the position vector and the template vector is transformed into three matrices: query QueryQ, key KeyK, and value ValueV through a learnable matrix. Since the autocorrelation mechanism focuses on the connection between subsequences, in particular, for the t-th input sequence, the V matrix comes from the t-1-th input sequence, thereby using the periodicity of the sequence to analyze the autocorrelation of the sequence across sequences.

[0178] The anomaly detection model of this embodiment uses these three matrices to implement the autocorrelation mechanism (Auto-Correlation) in the Autoformer. Unlike the self-attention mechanism that represents the correlation between points, the autocorrelation mechanism represents the correlation between subsequences and subsequences. Specifically, the autocorrelation mechanism uses the Fast Fourier Transformation (FFT) to transform Q and K into frequency domain feature matrices and then perform point multiplication. The product is then subjected to the Inverse Fast Fourier Transform (IFFT) to obtain the autocorrelation coefficient. The formula is as follows:

[0179] Q′=FFT(Q)

[0180] K'=FFT(K)

[0181]

[0182] Among them, conj(·) represents the conjugate tensor, Q ' is the frequency domain feature matrix obtained by fast Fourier transforming the query Q, K' is the frequency domain feature matrix obtained by fast Fourier transforming the key K, and R is the autocorrelation coefficient.

[0183] Suppose a sequence contains log templates. In order to reduce the computational complexity, the first k largest autocorrelation coefficients are selected to aggregate the time-delay information with V, with the purpose of exploring the correlation between important subsequences. First, the selection method is to accumulate the elements in the autocorrelation coefficient R tensor. The larger the accumulated sum, the higher the autocorrelation score, which can better represent the characteristics of the sequence. The information in the log sequence can be retained while reducing the amount of calculation. The formula is as follows:

[0184]

[0185] The calculation method of K is clogL, and c is a hyperparameter. For smaller autocorrelation coefficients, use to replace.

[0186] Afterwards, since the smaller autocorrelation coefficients are replaced, the first k largest The location of τ i Come scroll Align the two when the autocorrelation is strongest. Then use the autocorrelation coefficient as a weight Update and obtain the template sequence code AC. Let And the autocorrelation coefficient in this series is aligned in this process. In the rolling process, It is treated as a circular queue, that is, the first element will move to the tail when scrolling once. The formula is as follows:

[0187]

[0188] Among them, SoftMax(·) represents normalization, and Roll(·|·) represents rolling the tensor by a given length.

[0189] Next, a two-layer perceptron is used to predict AC based on the template sequence encoding above. The specific formula is:

[0190] output = Relu (AC × W1) W2

[0191] Among them, W1 and W2 are learnable fully connected layers, and the dimension of the output is consistent with the input template vector and position vector. The purpose is to stack the encoding-decoding blocks to obtain better training results.

[0192] Step S42: After the log data to be detected is processed according to steps S1 to S2, self-supervised training is performed to cover the partial sequence and then predict, and the prediction target is the template candidate set that may appear at the covered position. The loss of the self-supervised training is the negative log-likelihood loss.

[0193] Step S43, then the trained anomaly detection model can be used to predict the template sequence. Use a sliding window of fixed length to slide on the sentence vector of the template sequence, and then output the prediction candidate set where the next template in the sequence may appear. If every template predicted during the sliding process is in the prediction candidate set, the log sequence is still determined to be a normal sequence. Otherwise, it is considered that an anomaly is detected at a position where the prediction candidate set does not contain a true template.

[0194] This implementation adopts an anomaly detection strategy from simple classification to step-by-step prediction. First, the entire log sequence is classified into two categories to determine whether it is an abnormal log sequence. Then, anomaly detection is performed step by step on the abnormal log sequence. A model with less complexity is used to filter normal logs to reduce the overall amount of calculation.

[0195] And reuse the same pre-trained BERT to extract sentence vectors; both classification models and classification models can technically extract long-distance associations, thereby improving the overall efficiency of the method.

[0196] At the same time, the autocorrelation mechanism is applied when detecting anomalies in the log template sequence, and the periodic characteristics of the log sequence are extracted by analyzing the subsequence-subsequence association. In terms of optimizing the amount of calculation, the size of the autocorrelation coefficient is used to select the parameters involved in the calculation.

[0197] Compared with the prior art solution 1 given above, this embodiment reduces the number of times the anomaly detection model is run when processing normal log sequences. This embodiment can capture the autocorrelation between subsequences when analyzing log sequence features, and can better retain important features in the sequence.

[0198] Reasons: 1. The anomaly detection strategy from simple classification to step-by-step prediction is adopted to filter out the normal log sequences that account for the vast majority of actual scenarios from anomaly detection. At the same time, anomaly detection can be used as a proofreading. When the classification model determines that the sequence is abnormal, but the anomaly detection model does not find anomalies, the sequence is determined to be a normal sequence. 2. The autocorrelation mechanism in Autoformer is used to analyze periodic characteristics. In addition, when analyzing the autocorrelation of subsequences-subsequences, the most representative and most correlated factors are selected, which reduces the computational complexity while retaining the sequence characteristics as much as possible.

[0199] Compared with the second solution of the prior art given above, this embodiment reduces the number of times the anomaly detection model is run when processing normal log sequences. When analyzing the log sequence features, this embodiment analyzes the autocorrelation score between a template and each other template to better extract the long-distance correlation between sequences.

[0200] Reasons: 1. The anomaly detection strategy from simple classification to step-by-step prediction is adopted, which filters out the normal log sequences that account for the vast majority of actual scenarios from anomaly detection. 2. The autocorrelation mechanism in Autoformer is used to analyze periodic features. Autoformer works better when predicting long sequences.

[0201] Compared with the third solution of the prior art given above, this embodiment can find anomalies that occur when the same log sequence is different. This embodiment can gradually analyze the logs with specific errors in a long log sequence.

[0202] Reasons: 1. Consider the context between words and capture complex patterns and long-range dependencies in log sequences. 2. The anomaly detection model can gradually detect whether each log in the abnormal log sequence is abnormal.

[0203] Compared with the fourth solution of the prior art given above, this embodiment reduces the amount of calculation for processing log input. This embodiment reduces the amount of calculation for analyzing sequence features in the anomaly detection model. This embodiment reduces the number of times the anomaly detection model is run when processing normal log sequences.

[0204] Reasons: 1. Parse the logs into templates. 2. Use the autocorrelation mechanism to optimize the self-attention mechanism (SelfAttention). When analyzing the autocorrelation of subsequences-subsequences, the most representative and most relevant factors are selected, which reduces the computational complexity while retaining the sequence characteristics as much as possible. 3. Adopt an anomaly detection strategy from simple classification to step-by-step prediction, filtering out the normal log sequences that account for the vast majority of actual scenarios from anomaly detection. At the same time, anomaly detection can be used as a proofreading. When the classification model determines that the sequence is abnormal, but the anomaly detection model does not find anomalies, the sequence is determined to be a normal sequence.

[0205] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the anomaly detection method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0206] This application also provides an abnormality detection device, please refer to Figure 6 , the abnormality detection device comprises:

[0207] The acquisition module 10 is used to acquire the log to be detected and divide the log to be detected into a plurality of log template sequences;

[0208] A vector conversion module 20, used for inputting each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences;

[0209] A classification module 30, used for inputting each of the log template vectors into a preset classification model to obtain a log type of each of the log template vectors;

[0210] The anomaly locating module 40 is used to input the anomaly template vector into a preset anomaly locating model to obtain the anomaly part of the log to be detected corresponding to the anomaly template vector, wherein the anomaly template vector is a vector of the log type of each log template vector being an abnormal log type.

[0211] Furthermore, the acquisition module 10 is also used for:

[0212] Inputting the log to be detected into a log parsing model to obtain at least one log template;

[0213] Dividing the logs to be detected into a plurality of sequences to be detected according to preset time intervals;

[0214] For any target sequence to be tested in each of the sequences to be tested, the at least one log template is used to replace each piece of original log information in the target sequence to be tested, so as to obtain a log template sequence.

[0215] Furthermore, the acquisition module 10 is also used for:

[0216] For any target log information in each of the original log information, determining a matching degree between the target log information and the at least one log template;

[0217] The target log information is replaced by a log template whose matching degree is greater than a preset threshold among the at least one log template.

[0218] Furthermore, the vector conversion model includes an encoder; a vector conversion module 20, which is used to:

[0219] For any log template sequence in each of the log template sequences, perform word segmentation processing on the log template sequence to obtain a word vector of each word in the log template sequence, and determine the position information of each word in the log template sequence;

[0220] The word vectors of the respective words and the position information are input into an encoder to obtain a position vector and a template vector, and the position vector and the template vector are used as the log template vector.

[0221] Furthermore, the classification model includes a convolution block, an activation function, a pooling layer, a fully connected layer and a normalization function; the classification module 30 is also used for:

[0222] For any target template vector in each of the log template vectors, input the target template vector into the convolution block to obtain a regional feature;

[0223] Inputting the region feature into the activation function to obtain a first feature;

[0224] Inputting the first feature into the pooling layer to obtain a second feature;

[0225] If it is detected that the sequence length of the second feature is greater than the preset step length, the second feature is input into the convolution block until the sequence length of the output feature of the convolution block is less than or equal to the preset step length, thereby obtaining the target feature;

[0226] Inputting the target feature into the fully connected layer to obtain a category score vector;

[0227] The category score vector is input into the normalization function to obtain the category probability of each of the log types, and the log type of the target template vector is determined based on each of the category probabilities.

[0228] Furthermore, the anomaly localization model includes a feature extraction layer and a prediction layer; the anomaly localization module 30 is also used for:

[0229] Inputting the abnormal template vector into the feature extraction layer, and determining the current window template feature of the abnormal template vector through the sliding window of the feature extraction layer;

[0230] Inputting the current window template feature into the prediction layer to obtain a next window prediction vector;

[0231] If the next window prediction vector is inconsistent with the next window actual vector determined based on the sliding window, it is determined that the log information corresponding to the next window actual vector in the log to be detected is the abnormal log information.

[0232] The anomaly detection device provided by the present application adopts the anomaly detection method in the above embodiment, which can solve the technical problem of low efficiency of log anomaly detection. Compared with the prior art, the beneficial effects of the anomaly detection device provided by the present application are the same as the beneficial effects of the anomaly detection method provided by the above embodiment, and the other technical features in the anomaly detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0233] The present application provides an anomaly detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the anomaly detection method in the above-mentioned embodiment 1.

[0234] Reference below Figure 7 , which shows a schematic diagram of the structure of an abnormality detection device suitable for implementing the embodiment of the present application. The abnormality detection device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The abnormality detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0235] like Figure 7As shown, the abnormality detection device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the abnormality detection device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the anomaly detection device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows an anomaly detection device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0236] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0237] The anomaly detection device provided by the present application adopts the anomaly detection method in the above embodiment to solve the technical problem of low efficiency of log anomaly detection. Compared with the prior art, the beneficial effects of the anomaly detection device provided by the present application are the same as the beneficial effects of the anomaly detection method provided by the above embodiment, and the other technical features in the anomaly detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0238] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0239] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0240] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the anomaly detection method in the above-mentioned embodiment.

[0241] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0242] The computer-readable storage medium may be included in the abnormality detection device; or may exist independently without being assembled into the abnormality detection device.

[0243] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the anomaly detection device, the anomaly detection device: obtains the log to be detected, and divides the log to be detected into multiple log template sequences; inputs each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences; inputs each of the log template vectors into a preset classification model to obtain a log type of each of the log template vectors; inputs the abnormal template vector into a preset abnormality location model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector, wherein the abnormal template vector is a vector whose log type is an abnormal log type in each of the log template vectors.

[0244] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0245] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the 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 square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / 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.

[0246] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0247] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned anomaly detection method, and can solve the technical problem of low efficiency of log anomaly detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the anomaly detection method provided in the above-mentioned embodiment, and will not be repeated here.

[0248] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned anomaly detection method when executed by a processor.

[0249] The computer program product provided by the present application can solve the technical problem of low efficiency in log anomaly detection. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as those of the anomaly detection method provided by the above embodiment, which will not be elaborated here.

[0250] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. An anomaly detection method, characterized in that: The method includes: Obtaining a log to be detected, and dividing the log to be detected into a plurality of log template sequences; Inputting each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences; Inputting each of the log template vectors into a preset classification model to obtain a log type of each of the log template vectors; The abnormal template vector is input into a preset abnormality positioning model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector, wherein the abnormal template vector is a vector whose log type is an abnormal log type in each of the log template vectors.

2. The method according to claim 1, characterized in that The step of dividing the log to be detected into a plurality of log template sequences includes: Inputting the log to be detected into a log parsing model to obtain at least one log template; Dividing the logs to be detected into a plurality of sequences to be detected according to preset time intervals; For any target sequence to be tested in each of the sequences to be tested, the at least one log template is used to replace each piece of original log information in the target sequence to be tested, so as to obtain a log template sequence.

3. The method according to claim 2, characterized in that The step of using the at least one log template to replace each original log information in the target sequence to be tested to obtain a log template sequence includes: For any target log information in each of the original log information, determining a matching degree between the target log information and the at least one log template; The target log information is replaced by a log template whose matching degree is greater than a preset threshold among the at least one log template.

4. The method according to claim 1, characterized in that The vector conversion model includes an encoder; The step of inputting each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences comprises: For any log template sequence in each of the log template sequences, perform word segmentation processing on the log template sequence to obtain a word vector of each word in the log template sequence, and determine the position information of each word in the log template sequence; The word vectors of the respective words and the position information are input into an encoder to obtain a position vector and a template vector, and the position vector and the template vector are used as the log template vector.

5. The method according to claim 1, characterized in that The classification model includes a convolution block, an activation function, a pooling layer, a fully connected layer and a normalization function; The step of inputting each of the log template vectors into a preset classification model to obtain the log type of each of the log template vectors includes: For any target template vector in each of the log template vectors, input the target template vector into the convolution block to obtain a regional feature; Inputting the region feature into the activation function to obtain a first feature; Inputting the first feature into the pooling layer to obtain a second feature; If it is detected that the sequence length of the second feature is greater than the preset step length, the second feature is input into the convolution block until the sequence length of the output feature of the convolution block is less than or equal to the preset step length, thereby obtaining the target feature; Inputting the target feature into the fully connected layer to obtain a category score vector; The category score vector is input into the normalization function to obtain the category probability of each of the log types, and the log type of the target template vector is determined based on each of the category probabilities.

6. The method according to any one of claims 1 to 5, characterized in that The anomaly localization model includes a feature extraction layer and a prediction layer; The step of inputting the abnormal template vector into a preset abnormality positioning model to obtain abnormal log information in the log to be detected corresponding to the abnormal template vector includes: Inputting the abnormal template vector into the feature extraction layer, and determining the current window template feature of the abnormal template vector through the sliding window of the feature extraction layer; Inputting the current window template feature into the prediction layer to obtain a next window prediction vector; If the next window prediction vector is inconsistent with the next window actual vector determined based on the sliding window, it is determined that the log information corresponding to the next window actual vector in the log to be detected is the abnormal log information.

7. An abnormality detection device, characterized in that: The device comprises: An acquisition module is used to acquire the log to be detected and divide the log to be detected into multiple log template sequences; A vector conversion module, used for inputting each of the log template sequences into a preset vector conversion model to obtain a log template vector of each of the log template sequences; A classification module, used for inputting each of the log template vectors into a preset classification model to obtain a log type of each of the log template vectors; The anomaly locating module is used to input the anomaly template vector into a preset anomaly locating model to obtain the anomaly part of the log to be detected corresponding to the anomaly template vector, wherein the anomaly template vector is a vector of the log type of each log template vector that is an abnormal log type.

8. An abnormality detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the anomaly detection method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the abnormality detection method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the anomaly detection method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Three-dimensional tooth point cloud model data classification method and system based on deep learning

    CN112989954A

  • Log anomaly detection method and device, and server

    CN113704201A

  • Log anomaly detection method based on optimized feature extraction granularity

    CN114584379A

  • Log anomaly detection method and device

    CN114647558A

  • Distributed system anomaly detection method based on log spatio-temporal feature analysis

    CN116167370A

Cited By

  • Log and video mutual positioning fault analysis method, system and product

    CN119888890A