Concurrent multipoint log anomaly detection method based on self-supervised learning

By performing self-supervised learning on the LogBert model and training the log anomaly detection model, we solve the problem of log anomaly detection in large distributed systems, achieve efficient and accurate anomaly detection, reduce costs, and adapt to changes in data scale and number of nodes. increase.

CN118567939APending Publication Date: 2024-08-30CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311712745.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-13
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing technology is difficult to effectively detect log anomalies of multiple components and multiple programming languages ​​in large distributed systems, and cannot fully mine the correlation within and between nodes. Traditional methods rely on manual analysis and a large amount of labeled data, which is costly and does not have the capabilities Adaptability.

Method used

Adopt a concurrent multi-point log anomaly detection method based on self-supervised learning, use the LogBert model to train the log anomaly detection model, generate incomplete data by masking the log, calculate the cross-entropy loss, and combine the sliding time window and the fully connected layer encoder module to achieve Semantic encoding and anomaly detection.

Benefits of technology

It reduces the cost of manual data annotation, realizes real-time anomaly detection of multi-component logs in large systems, provides more comprehensive and accurate anomaly detection results, has good scalability and adaptability, and can quickly detect abnormal behaviors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567939A
    Figure CN118567939A
Patent Text Reader

Abstract

The invention discloses a concurrent multipoint log anomaly detection method based on self-supervised learning, and relates to the technical field of log anomaly detection, and the method comprises the following steps: collecting a historical log file set in advance; on the basis of a log file set and a LogBert structure, a log anomaly detection model is trained in a self-supervision mode; the log anomaly detection model generates incomplete data and semantic vectors in a mode that the logs are shielded by masks, the cross entropy loss between the incomplete data and the complete and normal logs is minimized, and the log anomaly detection model predicts a correlation matrix between inputs and is used for combining small transactions of different files into large transaction flows; the abnormal point of the log content is detected, meanwhile, the large transaction process where the abnormal point is located is provided, the incidence relation among multiple components is comprehensively considered, and a more comprehensive and accurate anomaly detection result is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of log anomaly detection, and in particular to a concurrent multi-point log anomaly detection method based on self-supervised learning. Background Art

[0002] Log anomaly detection plays an important role in event management of large-scale systems, providing key material records for timely detection of abnormal behavior of the system and troubleshooting. Log data is usually generated by the code that developers embed in the code flow for program debugging, and is used to record the changes in variable values, program execution status, error prompts, etc. during the running of the program. Therefore, log data can clearly track fine-grained process execution trajectories to a certain extent, and is very suitable for contextual anomaly detection and subsequent fault prediction tasks;

[0003] Traditional system anomaly detection and fault analysis usually involves developers and operation and maintenance personnel manually analyzing logs based on their domain experience or writing hard rules to match key information in the search system. As large-scale systems are increasingly used, the speed at which logs are generated is also exploding, and developers are unable to be familiar with every module in a large system. Manually detecting and analyzing logs to extract useful error information and restore application functions in a timely manner will undoubtedly become increasingly inefficient and impractical.

[0004] Currently, in order to cope with the inability of manual detection and analysis of logs, many methods based on traditional machine learning and deep learning models have been proposed. However, traditional machine learning has difficulty in extracting discrete time information from logs. In deep learning models, recurrent neural networks (RNNs) can model text sequences, but they still show some limitations and cannot effectively incorporate contextual information into the current information encoding. Subsequent methods based on LSTM and Transformer have shown powerful functions, but they also contain many limitations, such as the need for a large amount of labeled data for training, which is a huge cost in terms of time and manpower, or the inability to adapt to some unforeseen changes in the log text content, resulting in model robustness issues. Summary of the invention

[0005] In order to overcome the above-mentioned technical problems, the purpose of the present invention is to provide a concurrent multi-point log anomaly detection method based on self-supervised learning to solve the problem that most of the existing technologies only target relatively simple log scenarios, or rely on fixed log templates, and lack corresponding application research in dealing with large-scale distributed systems with multiple components and multiple programming languages. At the same time, in large-scale distributed collaborative systems, different nodes will generate logs of different styles. At this stage, the methods often cannot fully explore the intrinsic correlation of node internal logs and the external correlation between nodes.

[0006] The purpose of the present invention can be achieved through the following technical solutions:

[0007] Specifically, a concurrent multi-point log anomaly detection method based on self-supervised learning is provided, which includes the following steps:

[0008] Collect historical log file collection in advance;

[0009] Based on the log file collection and LogBert structure, a log anomaly detection model is trained in a self-supervised manner;

[0010] The log anomaly detection model generates incomplete data by masking the log, generating a semantic vector, minimizing the cross entropy loss between the incomplete and normal log. The log anomaly detection model predicts the correlation matrix between the inputs, which is used to combine small transactions of different files into a large transaction process.

[0011] As a further solution of the present invention: the historical log file set includes N groups of log file sets of different components, N is a positive integer, and the log file set includes normal and abnormal log samples;

[0012] Different components involve Java, python, and shell development languages.

[0013] As a further solution of the present invention: the log anomaly detection model is implemented based on a preprocessing module, which is used to extract key information from the log file, remove non-transaction redundant log text with no information content, and combine the log text in the file into small transaction units according to event start and end marks.

[0014] As a further solution of the present invention: the key information of the log file includes time, thread ID, and log level.

[0015] As a further solution of the present invention: the events of the log text are divided into large transactions and small transactions;

[0016] The major transaction is to open component A. The process of opening component A includes A1, A2...An, where A1, A2...An are different minor transactions.

[0017] As a further solution of the present invention: the log anomaly detection model uses the backbone parameters of the parameter model trained by public big data.

[0018] As a further solution of the present invention: the log anomaly detection model directly processes, marks and converts a single small transaction into a semantic vector as a Token, and selects each batch of small transactions in different files as model input using a sliding time window.

[0019] As a further solution of the present invention: the cross entropy loss is calculated as follows:

[0020]

[0021] Where K represents the number of samples and T represents the temperature coefficient.

[0022] As a further solution of the present invention: the method of using the self-supervision method in the log anomaly detection model is:

[0023]

[0024] Among them, K represents the number of samples, Zi represents the samples for calculating loss, Zi+ represents the positive samples compared with Zi, and S() is the similarity calculation of the samples.

[0025] As a further solution of the present invention: the log anomaly detection model uses the FC-encoder fully connected layer encoder module to process the semantic encoding of the transaction, and finally performs training supervision with InfoNCE Loss.

[0026] Beneficial effects of the present invention:

[0027] 1. In the present invention, pre-training transfer learning and self-supervision are used to train the parameters of the model, avoiding large-scale manual data labeling and reducing time and labor costs.

[0028] 2. In large-scale systems, when multiple components and multiple points concurrently produce a large number of logs, it replaces manual or traditional regular matching methods to detect abnormal points in log content, and at the same time provides the large transaction process where the abnormal points are located, comprehensively considers the relationship between multiple components, and provides more comprehensive and accurate abnormality detection results.

[0029] 3. The log anomaly detection method proposed in this application can monitor and analyze the large amount of log data generated in the system in real time, quickly discover abnormal behavior and take corresponding measures in time. At the same time, the method has good scalability, can adapt to the growing data scale and number of nodes, and maintain efficient anomaly detection capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The present invention will be further described below in conjunction with the accompanying drawings.

[0031] Figure 1 It is a flow logic diagram of the present invention;

[0032] Figure 2 It is a flow chart of the log anomaly detection model of the present invention. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] like Figure 1 and Figure 2 As shown, the present invention discloses a concurrent multi-point log anomaly detection method based on self-supervised learning. The concurrent multi-point log anomaly detection method trains a model in a self-supervised manner, based on the LogBert model, and adds a transaction correlation calculation module to detect log anomalies generated by multiple components in parallel in a large distributed system, and outputs the entire transaction process where the anomaly is located. The method specifically includes the following steps:

[0035] 1. Data preprocessing: Most of the original log text data is redundant prompt information, and the most critical transactions containing the most information are relatively few. Therefore, we automatically select these text lines rich in transaction process characteristics, such as "parse order begin", "mkdir dir success", etc., and simply replace the long lines; remove meaningless separators and words in the log according to the specified separator set ".,:_=-" (including Chinese and English modes); for camel case words in non-natural languages, use the Wordninja tool to perform word segmentation processing, such as "InitialMachine checkImage" is processed as "init machine check image";

[0036] It should be noted that the Wordninja tool is a tool for segmenting continuous English strings. It performs probabilistic segmentation based on word frequency information in the English corpus. When processing English text, the Wordninja tool can effectively segment continuous English strings into words. Users can also manually add custom words to the Wordninja vocabulary to improve the accuracy of word segmentation. The log text is first cleaned by the preprocessing module. The logs come from different components. Different components involve development languages ​​such as Java, python, and shell. Different modules of the components are also developed by different developers, which inevitably cause style differences. The preprocessing module is used to extract key information of the log text line such as time, thread ID, log level, etc., remove non-transaction redundant log text with no information, and combine the log text in the file into small event units according to the event start and end marks. Among them, the big transaction is to open component A. The process of opening component A includes A1, A2...An, and A1, A2...An are different small transactions;

[0037] 2. Pre-training: Using a public large data set as input, we get our benchmark Transformer model. The Transformer model is a deep learning model based on the self-attention mechanism, which is mainly used to process sequence data, such as natural language text. The Transformer model mainly consists of an encoder and a decoder. The encoder is responsible for encoding the input sequence into a vector representation of a fixed length, and the decoder generates a target sequence based on the output of the encoder. In the Transformer model, the self-attention mechanism is the key. The self-attention mechanism allows the model to focus on the part of the input sequence that is most relevant to the current position, thereby capturing long-distance dependencies in the sequence. In addition, the self-attention mechanism also has the characteristics of parallel computing, which can greatly improve the training speed of the model;

[0038] This model has strong capabilities in basic public semantic representation and is migrated to our log anomaly detection task. At present, there are many mature large-scale multimodal corpora designed for downstream NLP, image and video tasks. These model parameters are basic models obtained through large-scale training and convergence based on a large amount of labeled data. To a certain extent, they have very good public semantic extraction capabilities for text. Here, we migrate the basic model capabilities to our log anomaly detection model for subsequent training, which can greatly reduce the convergence time of our model and improve the robustness to the text content in the task. Therefore, the log anomaly detection model uses the parameter model backbone parameters trained by public big data.

[0039] 3. Training parameters; Based on the pre-trained model, our fine-tuning process and the newly added structure are defined as follows: We gradually reduce the proportion of the masked part from 80% to 50% during the training process to adapt to the convergence process of the model. It is necessary to preset the momentum of the cross entropy loss function. Momentum is an algorithm used to optimize model parameters in deep learning. It is an optimization of the gradient descent method. By simulating the momentum principle in physics, the model can converge better during the training process. The core idea of ​​the Momentum algorithm is to calculate the exponential weighted average of the gradient, and then use this gradient to update the weight. This can effectively alleviate the zigzag swing problem in the gradient descent method, thereby accelerating the convergence process of the model. In the Momentum algorithm, momentum is defined as the product of the mass and velocity of an object, which reflects the inertia of an object during motion. In the optimization process, the larger the momentum, the faster the model can converge to the optimal solution, but it will also increase the risk of the model falling into the local optimum. The cross entropy loss function in the present invention sets momentum to 0.9 and sqr_momentum to 0.99. In the Transformer model, it is necessary to set the epsilon of the Transformer model, and epsilon usually refers to the learning rate. The learning rate determines how much (or how fast, how big the step length) the model parameters are adjusted in each step of parameter update. If the learning rate is too small, the convergence will be slow; if the learning rate is too large, the loss will oscillate or even increase. Therefore, the learning rate needs to be weighed between convergence and overshoot. In the training process, the purpose of adjusting the learning rate is to converge to a better value as soon as possible (satisfying both fast and excellent). In general, adjusting the learning rate is actually reducing the learning rate, so it is also called learning rate decay or learning rate annealing in some places. There are two main methods for adjusting the learning rate: learning rate schedule and adaptive learning rate. The learning rate schedule adjusts the learning rate according to a certain formula, in which the learning rate is a function of the number of training steps. The adaptive learning rate is that the algorithm automatically adjusts the learning rate according to the actual situation during training. Here, the epsilon of the Transformer model is 1e-5.

[0040] In addition, in the Transformer model, it is also necessary to set eight decay in the Transformer model. Eight decay is a technique used to optimize model parameters in deep learning. The main function of eight decay is to prevent the model from overfitting, that is, during the training process, the model is too complex, so that it performs well on the training data, but performs poorly on unseen data. Weight Decay is achieved by adding a regularization term to the loss function. This regularization term is usually the L2 norm of the model parameters. Each time the parameters are updated, Weight Decay introduces a decay coefficient so that the parameter value is updated in the direction of 0, which can limit the complexity of the model and prevent overfitting. The value of Weight Decay is usually set to a small positive number, such as a value between 0.001 and 0.01. The choice of this value needs to be determined according to the specific task and data. Too large Weight Decay may cause the model to be underfitting, while too small Weight Decay may not be able to prevent overfitting. The weight decay in the invented Transformer model is 0.01;

[0041] In the similarity analysis part, the newly added three-layer fully connected layer accepts the semantic expression output by the backbone network. The parameter scales are 2048, 1024, and 512 respectively. The output vector calculates the contrast loss. The hyperparameter temperature coefficient in the contrast loss function is set to 0.075. The temperature coefficient can affect the degree of attention to difficult samples. When the temperature coefficient is small, the loss function will pay more attention to separating the current sample from the most similar difficult sample to obtain a more balanced representation effect. The cross entropy loss and contrast loss constitute the total loss calculation of the entire model, and the ratio coefficient is set to 1:0.25.

[0042] 4. Inference prediction: In the process of predicting whether a log point is abnormal or not, we still choose to shield part of the input information, and use the model to reconstruct the accuracy of the prediction recovery, with 0.85 as the judgment threshold for normality. If it is lower than 0.85, it is classified as abnormal. At the same time, the correlation prediction is determined by the similarity of the object points. The time window is set to 30 minutes. The vector representation similarity matrix between events in the same time window is calculated. The threshold is 0.75. If it exceeds this threshold, it means that it belongs to the same process event.

[0043] It should be emphasized that the adjustment of the anomaly detection task model and the response to our multi-component, multi-programming language parallel multi-point log scenario, the log anomaly detection model structure is as follows Figure 2As shown in the figure, compared with most current methods such as DeepLog and LogBERT, DeepLog is a system log anomaly detection and diagnosis method based on deep learning. It realizes anomaly detection by treating system logs as natural language sequences and modeling them using a long short-term memory (LSTM) deep neural network model. DeepLog can automatically learn log patterns from normal execution and detect anomalies when the log patterns deviate from normal execution. LogBERT is a log anomaly detection method based on BERT (Bidirectional Encoder Representations from Transformers). LogBERT learns the patterns of normal log sequences through two self-supervised training tasks and can detect anomalies when the underlying patterns deviate from normal log sequences. The main advantage of LogBERT is that it can capture the bidirectional contextual information of normal log sequences and distinguish normal and abnormal log sequences by predicting the masked log templates in the log sequences. In addition, LogBERT also uses hypersphere volume minimization to control the distribution of normal log sequences in the embedding space, so that normal log sequences are close to each other, while abnormal log sequences are far away from the center.

[0044] The difference between this method and DeepLog and LogBERT is that log data is not converted into log templates. Log data is directly processed, marked and converted into semantic vectors with a single small transaction in the file as a token. Different small transactions in different files are selected as model input in a sliding time window. Finally, we give two prediction subtask structures in the inference stage. The first one is used to determine whether a small transaction is abnormal or not. In the model training stage, based on the original LogBert structure, training is performed in a self-supervised manner. Incomplete data is generated by masking the log. The semantic vector is generated by the model to minimize the cross entropy loss with the complete and normal log. The cross entropy loss is calculated as follows:

[0045]

[0046] K represents the number of samples, and T represents the temperature coefficient. The basic principle is that the model can understand the language rules used by normal system logs by learning the contextual relationship in the training data, reducing the final difference between incomplete data and normal log data. The model predicts complete logs from incomplete logs, and as a variant, it can achieve the ability to distinguish normal and abnormal logs. The second is to predict the correlation matrix between inputs, which is used to combine small transactions of different files into a large transaction process. The purpose is to obtain the entire large transaction process based on abnormal transaction points. The log anomaly detection model uses the self-supervision method as follows:

[0047]

[0048] Self-supervision is also used here, where K represents the number of samples, Zi represents the samples for calculating loss, Zi+ represents the positive samples compared to Zi, and S() is the similarity calculation of the samples. The comparison loss is used to extract the similarity and difference of transactions in the time window, enhance the similarity of the semantic vectors of small transactions belonging to the same complete large transaction, and reduce the correlation between small transactions in different large transactions, thereby ultimately achieving the purpose of classifying large transactions. The log anomaly detection model uses the FC-encoder fully connected layer encoder module to process the semantic encoding of transactions, and finally uses InfoNCE Loss for training supervision;

[0049] The invention is aimed at distributed high-availability database systems, where multiple components and multiple nodes are already a very common scenario, and the different log modes and continuous expansion growth pose challenges to log anomaly detection. Compared with the prior art, the invention has the following advantages:

[0050] Pre-training transfer learning and self-supervision are used to train model parameters, avoiding large-scale manual data labeling and reducing time and labor costs.

[0051] In large-scale systems, when multiple components and multiple points concurrently produce a large number of logs, it replaces manual or traditional regular matching methods to detect abnormal points in log content and provide the large transaction process where the abnormal points are located. It comprehensively considers the relationship between multiple components and provides more comprehensive and accurate abnormality detection results.

[0052] The log anomaly detection method proposed in this application can monitor and analyze the large amount of log data generated in the system in real time, quickly discover abnormal behavior and take corresponding measures in time. At the same time, the method has good scalability, can adapt to the growing data scale and number of nodes, and maintain efficient anomaly detection capabilities.

[0053] The above is a detailed description of an embodiment of the present invention, but the content is only a preferred embodiment of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.

Claims

1. A concurrent multi-point log anomaly detection method based on self-supervised learning, characterized in that: The following steps are involved: Collect historical log file collection in advance; Based on the log file collection and LogBert structure, a log anomaly detection model is trained in a self-supervised manner; The log anomaly detection model generates incomplete data by masking the log, generating a semantic vector, minimizing the cross entropy loss between the incomplete and normal log. The log anomaly detection model predicts the correlation matrix between the inputs, which is used to combine small transactions of different files into a large transaction process.

2. According to claim 1, a concurrent multi-point log anomaly detection method based on self-supervised learning is characterized in that: The historical log file set includes N groups of log file sets of different components, where N is a positive integer, and the log file set includes normal and abnormal log samples; Different components involve Java, python, and shell development languages.

3. According to claim 2, a concurrent multi-point log anomaly detection method based on self-supervised learning is characterized in that: The log anomaly detection model is implemented based on a preprocessing module, which is used to extract key information from log files, remove non-transactional redundant log texts with no information content, and combine log texts in the file into small transaction units according to event start and end marks.

4. According to claim 3, a concurrent multi-point log anomaly detection method based on self-supervised learning is characterized in that: The key information of the log file includes time, thread ID, and log level.

5. According to claim 3, a concurrent multi-point log anomaly detection method based on self-supervised learning is characterized in that: The events in the log text are divided into large transactions and small transactions; The major transaction is to open component A. The process of opening component A includes A1, A2...An, where A1, A2...An are different minor transactions.

6. According to the method of concurrent multi-point log anomaly detection based on self-supervised learning according to claim 1, it is characterized in that: The log anomaly detection model uses the parameter model backbone parameters trained using public big data.

7. According to claim 5, a concurrent multi-point log anomaly detection method based on self-supervised learning is characterized in that: The log anomaly detection model directly processes, marks and converts a single small transaction into a semantic vector as a Token. Different small transactions in different files are screened out in a sliding time window as each batch of model input.

8. The method for detecting anomalies of concurrent multi-point logs based on self-supervised learning according to claim 7, characterized in that: The cross entropy loss is calculated as: Where K represents the number of samples and T represents the temperature coefficient.

9. The method for detecting anomalies of concurrent multi-point logs based on self-supervised learning according to claim 8, characterized in that: The method of using self-supervision in the log anomaly detection model is as follows: Where K represents the number of samples, Zi represents the samples for calculating loss, Zi+ represents the positive samples compared to Zi, and S() is the similarity calculation of the samples.

10. The method for concurrent multi-point log anomaly detection based on self-supervised learning according to claim 8, characterized in that: The log anomaly detection model uses the FC-encoder fully connected layer encoder module to process the semantic encoding of transactions, and finally performs training supervision with InfoNCE Loss.

Citation Information

Cited By

  • On-line anomaly detection method and equipment for autonomous controllable power business system, and medium

    CN120632722A