A system log anomaly detection method and system based on deep learning technology
Through deep learning technology, a subsequence correlation model is constructed, which solves the problem of insufficient understanding of the correlation between log data, achieves efficient log anomaly detection, and provides valuable reference for fault diagnosis.
Patent Information
- Application Number
- CN202311395791.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2043-10-25
AI Technical Summary
The existing technology does not fully understand the correlation between log data, resulting in a lack of efficiency and accuracy in log anomaly detection.
Using the system log anomaly detection method based on deep learning, we obtain the training log data set for template analysis, build a vectorized model of the E5 and TextCNN models for unsupervised comparative learning, generate sub-sequence sample data, and perform sub-sequence feature modeling and correlation Sexual modeling, using graph attention network and attention mechanism for feature fusion, and finally training subsequence correlation model for anomaly detection.
It deepens the understanding of the correlation between log data, improves the efficiency and accuracy of log anomaly detection, and provides valuable reference for system engineers in fault diagnosis.
Smart Images

Figure CN117421595B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and more specifically, to a system log anomaly detection method and system based on deep learning technology. Background Art
[0002] In modern computer systems and networks, various devices, applications, and services generate a large amount of log data. These logs record system status, user operations, error messages, network traffic, etc. By analyzing these log data, administrators and engineers can promptly detect system failures, abnormal behaviors, or security threats, so that they can take corresponding measures to maintain system stability and data security. With the development of information technology, the amount of log data continues to increase, forming the so-called "big data" problem. Large-scale log data sets pose challenges to anomaly detection, requiring efficient algorithms and technologies to process and analyze.
[0003] In recent years, with the rapid development of machine learning and deep learning, these technologies have been widely used in log anomaly detection. Machine learning methods can learn the normal patterns of log data to identify abnormal behaviors, while deep learning methods can automatically extract complex features and patterns in log data to improve the effect of anomaly detection.
[0004] Deep learning is a branch of machine learning and an artificial intelligence technology that mimics the structure and function of the neural network in the human brain. It uses multi-level neural networks to automatically learn and extract features from large amounts of data, and use these features to solve various complex tasks, such as image recognition, natural language processing, speech recognition, game strategy, etc. The core of deep learning is a neural network, which is a model composed of nodes and weights connecting these nodes. Deep learning models usually contain multiple layers, each of which contains many neurons, which can perform layer-by-layer data transformation and feature extraction to ultimately form the output for the task. The learning process of deep learning is basically an optimization problem, which uses algorithms such as gradient descent to minimize the error between the predicted output and the true label, thereby adjusting the weights and parameters of the neural network so that the model can better generalize to unseen data. Deep learning has made significant progress in various fields, bringing many important breakthroughs and applications, such as autonomous driving, medical diagnosis, and intelligent voice assistants.
[0005] A pre-trained language model is an artificial intelligence model that is pre-trained on a large-scale text corpus for natural language processing tasks. Its main goal is to capture the potential structure and patterns of language by learning from a large amount of text data, so that it can better understand and generate natural language. The basic idea is to use unsupervised learning to train on a large amount of unlabeled text data to predict missing words or sentences in a given context. The typical architecture is the Transformer model, which is a neural network structure based on the attention mechanism that can effectively process long text sequences and can be processed in parallel. The transformer model consists of multiple encoder and decoder layers, and the pre-trained language model usually only uses the encoder part. In this way, the model learns to understand the semantics between words and the relationship between sentences, so that it performs well in downstream natural language processing tasks.
[0006] Contrastive learning is an unsupervised learning method whose goal is to learn useful feature representations by comparing the similarities between samples. In contrastive learning, the model selects a pair of samples from the data, where one sample is considered an "anchor" and the other sample can be a "positive" sample (similar to the anchor) or a "negative" sample (dissimilar to the anchor). The goal of the model is to make the feature representation of the anchor sample closer to that of the positive sample and farther away from that of the negative sample.
[0007] E5: An embedding model based on weakly supervised pre-training and contrastive learning. E5 is a state-of-the-art text embedding method that transfers text vectors well to a variety of tasks. The model is trained in a contrastive manner, which uses a curated large-scale dataset of text pairs to obtain weak supervision signals. E5 can be readily used as a general-purpose embedding model for any task that requires a single vector representation of text, such as retrieval, clustering, and classification, achieving strong performance in both zero-shot and fine-tuning settings.
[0008] The prior art has a log anomaly detection device with component subsequence correlation perception, which belongs to the field of intelligent operation and maintenance and deep learning technology, including: on the basis of dividing a part of the log sequence S as a sample, obtaining the time feature embedding representation t and the semantic feature embedding representation V and obtaining the time feature embedding representation tc and the semantic feature embedding representation Vc, after feature extraction operation, sequence dependency capture module, latent relationship encoding module, graph convolution module, subsequence fusion module, embedding representation splicing module, log template prediction module, the probability distribution of the log template in the next log message is obtained to sort all the log templates, and the prediction result is a ranked top-k log template set, and whether the log sequence is abnormal is judged according to the prediction result of the next real log template and sample, so as to effectively capture the abnormal information and improve the detection efficiency and accuracy.
[0009] However, the existing technology still has the problem of insufficient understanding of the correlation between log data. Therefore, how to invent a system log anomaly detection method and system based on deep learning technology is a technical problem that urgently needs to be solved in this technical field. Summary of the invention
[0010] In order to solve the problem that the prior art has insufficient understanding of the correlation between log data, the present invention provides a system log anomaly detection method based on deep learning technology, which has the characteristics of being able to efficiently detect anomalies in system logs and provide a reference for system engineers when diagnosing faults.
[0011] In order to achieve the above-mentioned purpose of the present invention, the technical scheme adopted is as follows:
[0012] A system log anomaly detection method based on deep learning technology includes the following specific steps:
[0013] S1: Obtain a training log data set, perform template parsing on the training log data set, and obtain structured log template data;
[0014] S2: Build a vectorization model including E5 and TextCNN models, and input the structured log template data into the vectorization model for unsupervised contrastive learning training to obtain vectorized data;
[0015] S3: traverse the training log data set, and generate subsequence sample data by extracting and associating the sessions and events in the data of the training log data set;
[0016] S4: Based on the vectorized data and subsequence sample data, subsequence feature modeling, subsequence correlation modeling, and subsequence feature fusion are performed to complete the modeling of the subsequence correlation model;
[0017] S5: training subsequence correlation model;
[0018] S6: Detect log anomalies through the trained subsequence correlation model.
[0019] Preferably, in step S1, the training log data set is template parsed to obtain structured log template data, specifically: the logs of the training log data set are template parsed using the Drain method:
[0020] S101: Parse new log messages through regular expression templates;
[0021] S102: construct a deep tree, and search for log groups according to the design rules encoded in the internal nodes of the deep tree;
[0022] S103: Match the log message with the log event of the log group, and if there is no match, create a new log group;
[0023] S104: Traverse the training log data set to obtain structured log template data.
[0024] Furthermore, in step S2, a vectorization model including E5 and TextCNN models is constructed, and the structured log template data is input into the vectorization model for unsupervised contrastive learning training. The specific steps are as follows:
[0025] S201: vectorize the structured log template data through the E5 model;
[0026] S202: passing the output of the last hidden layer of the vectorized log template data into TextCNN to extract features;
[0027] S203: concatenate the vector corresponding to the first token of the last hidden layer of E5 with the output of TextCNN to form a vectorized model;
[0028] S204: Divide the same log template in the structured log template data into two batches and input them into the vectorization model; use the Dropout strategy to generate positive samples, and regard other log template data in each batch as negative samples;
[0029] S205: Use the unsupervised contrastive learning loss function InfoNCELoss for unsupervised contrastive learning; the loss function L CL Specifically:
[0030]
[0031] Among them, z is the random mask used in the model, and is the output vector of the model based on the random mask z when processing the log sequence, f θ represents the vectorized model, represents the log sequence, and the unsupervised contrast loss function is controlled by the hyperparameter τ.
[0032] Furthermore, in step S3, the training log data set is traversed, and subsequence sample data is generated by extracting and associating the sessions and events in the data of the training log data set. The specific steps are:
[0033] S301: traverse each row in the training log data set, and extract the session ID that meets the specific pattern from the Content field of each row;
[0034] S302: For each session ID, associate its corresponding event ID, component and time information;
[0035] S303: Save the associated information as a sequence CSV file, and generate a JSON mapping file for all unique components in the structured log template data, each component is mapped to a unique digital ID; the sequence CSV file and the JSON mapping file are used as subsequence sample data.
[0036] Furthermore, in step S4, subsequence feature modeling is performed in the following specific steps:
[0037] S4101: Obtain the semantic features V of the log sequence in the vectorized data and the subsequence in the subsequence sample data; obtain the time features T of the log sequence and the subsequence;
[0038] S4102: Input the acquired semantic features V and temporal features T into MLP for data fitting and then concatenate them to obtain data feature embedding X:
[0039]
[0040] in It is represented as a concatenation operation, and φ represents the MLP embedding operation;
[0041] S4103: Use GRU gated recurrent units to capture the sequential dependencies in log sequences and subsequences, respectively, and obtain log sequence sequential embedding and subsequence order embedding X c :
[0042]
[0043] X c =GRU2(X)
[0044] Among them, GRU1 is a log sequence GRU operation, and GRU2 is a subsequence GRU operation.
[0045] Furthermore, subsequence correlation modeling is carried out with the following specific steps:
[0046] S4201: Embed the order of each subsequence into X c Paired together, we get the associated embedding X e :
[0047]
[0048] Among them, ρ represents the activation function, and, denote the embedding of the i-th subsequence and the embedding of the j-th subsequence respectively;
[0049] S4202: Based on the association embedding, obtain the association weight X of each pair of subsequences r :
[0050]
[0051] Among them, ω represents the convolution operation;
[0052] S4203: Using the graph attention network, the embeddings in the subsequence are treated as graph node embeddings, and the association weights between different subsequences are used as edge weights. Through the GAT layer, the updated subsequence embedding X is obtained. m :
[0053] X m =ρ(GAT(X c ,X r ))
[0054] Among them, GAT is a graph attention network.
[0055] Furthermore, subsequence feature fusion, the specific steps are:
[0056] S4301: Use the attention mechanism to fuse all subsequence embedding features:
[0057]
[0058] Among them, AF is the function for calculating the attention score, is the embedding of the subsequence, G attion is the attention vector, N c is the number of log sequence components;
[0059] S4302: Connect the embedding of the subsequence fusion and the sequential embedding of the log sequence and input them into the classifier to obtain the probability X of the log template of the next log message l :
[0060] X l =ρ out (X c ,X r )
[0061] Among them, ρ out is the SoftMax activation function.
[0062] Furthermore, in step S5, the subsequence correlation model is trained, specifically: the subsequence correlation model is trained to minimize the cross entropy loss:
[0063]
[0064] Among them, X l i represents the predicted probability of the i-th log template, and y iIndicates whether the predicted log template is the same as the real log template:
[0065]
[0066] Furthermore, in step S6, the log anomaly is detected by using the trained subsequence correlation model, and the specific steps are as follows:
[0067] S601: Obtaining the log sequence S to be detected t ;
[0068] S602: Input the log sequence to be detected into the trained subsequence correlation model to obtain a set of templates ranked top several times;
[0069] S603: If the real log template of the next log message is not in the set, it is considered that S t Is the abnormal log sequence.
[0070] A system log anomaly detection system based on deep learning technology, including a training data module, a vectorized training module, a subsequence sample generation module, a subsequence correlation modeling module, a model training module, and an anomaly detection module;
[0071] The training data module is used to obtain a training log data set, perform template parsing on the training log data set, and obtain structured log template data;
[0072] The vectorization training module is used to construct a vectorization model including E5 and TextCNN models, and input the structured log template data into the vectorization model for unsupervised comparative learning training to obtain vectorized data;
[0073] The subsequence sample generation module is used to traverse the training log data set, and generate subsequence sample data by extracting and associating the sessions and events in the data of the training log data set;
[0074] The subsequence correlation modeling module is used to perform subsequence feature modeling, subsequence correlation modeling, and subsequence feature fusion according to the vectorized data and subsequence sample data, and complete the subsequence correlation modeling;
[0075] The model training module is used to train the subsequence correlation model;
[0076] The anomaly detection module is used to detect log anomalies through a trained subsequence correlation model.
[0077] The beneficial effects of the present invention are as follows:
[0078] The present invention discloses a system log anomaly detection method based on deep learning technology, which is constructed based on the correlation of subsequences. With the help of pre-trained language models, contrastive learning, and graph attention networks in deep learning, the correlation of component subsequences is deeply modeled, thereby deepening the understanding of the correlation between log data. This method solves the problem of insufficient understanding of the correlation between log data in the prior art, and can not only efficiently detect anomalies in system logs, but also provide valuable references for system engineers in fault diagnosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 It is a flow chart of a system log anomaly detection method based on deep learning technology in the present invention.
[0080] Figure 2 It is a schematic diagram of the overall framework of a system log anomaly detection method based on deep learning technology in the present invention. DETAILED DESCRIPTION
[0081] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0082] Example 1
[0083] like Figure 1 As shown, a system log anomaly detection method based on deep learning technology includes the following specific steps:
[0084] S1: Obtain a training log data set, perform template parsing on the training log data set, and obtain structured log template data;
[0085] S2: Build a vectorization model including E5 and TextCNN models, and input the structured log template data into the vectorization model for unsupervised contrastive learning training to obtain vectorized data;
[0086] S3: traverse the training log data set, and generate subsequence sample data by extracting and associating the sessions and events in the data of the training log data set;
[0087] S4: Based on the vectorized data and subsequence sample data, subsequence feature modeling, subsequence correlation modeling, and subsequence feature fusion are performed to complete the modeling of the subsequence correlation model;
[0088] S5: training subsequence correlation model;
[0089] S6: Detect log anomalies through the trained subsequence correlation model.
[0090] Example 2
[0091] More specifically, Figure 2As shown, in a specific embodiment, in the step S1, the training log data set is template parsed to obtain structured log template data, specifically: the Drain method is used to perform template parsing on the logs of the training log data set:
[0092] S101: Parse new log messages through regular expression templates;
[0093] S102: construct a deep tree, and search for log groups according to the design rules encoded in the internal nodes of the deep tree;
[0094] S103: Match the log message with the log event of the log group, and if there is no match, create a new log group;
[0095] S104: Traverse the training log data set to obtain structured log template data.
[0096] In this embodiment, the pseudo code for log parsing using Drain is:
[0097] Function DrainParse(log message L):
[0098]
[0099]
[0100] illustrate:
[0101] The "template parsing" function processes the original log message and returns the message after template parsing.
[0102] The "search" function refers to finding a log group in a fixed-depth tree that matches the message parsed by the template.
[0103] The "structured template" function T(G) refers to converting the log group G into the corresponding structured log template.
[0104] In a specific embodiment, in step S2, a vectorization model including E5 and TextCNN models is constructed, and the structured log template data is input into the vectorization model for unsupervised contrastive learning training, and the specific steps are:
[0105] S201: vectorize the structured log template data through the E5 model;
[0106] S202: passing the output of the last hidden layer of the vectorized log template data into TextCNN to extract features;
[0107] S203: concatenate the vector corresponding to the first token of the last hidden layer of E5 with the output of TextCNN to form a vectorized model;
[0108] S204: Divide the same log template in the structured log template data into two batches and input them into the vectorization model; use the Dropout strategy to generate positive samples, and regard other log template data in each batch as negative samples;
[0109] S205: Use the unsupervised contrastive learning loss function InfoNCELoss for unsupervised contrastive learning; the loss function L CL Specifically:
[0110]
[0111] Among them, z is the random mask used in the model, and is the output vector of the model based on the random mask z when processing the log sequence, f θ represents the vectorized model, represents the log sequence, and the unsupervised contrast loss function is controlled by the hyperparameter τ.
[0112] In this embodiment, the pseudo code for the vectorized model to perform unsupervised contrastive learning training is:
[0113] Foreach z i ∈Z do
[0114] 1. Vectorized log template:
[0115] 2. Feature extraction word vector:
[0116] 3. Contrastive learning loss calculation:
[0117] 4. Use L CL Update E5 Model
[0118] end
[0119] enter:
[0120] For the template data in template dataset Z, use z i To represent.
[0121] E(·) is used to represent the vectorization process of the E5 model.
[0122] Use E(·) * to represent the E5 model vectorizing the same data for the second time, where cls i represents the cls vector output of the E5 model, e i Represents the word vector output by the E5 model.
[0123] We use F(·) to represent the feature extraction process of the TextCNN feature extraction model and F(·) to represent the feature extraction process of the TextCNN feature extraction model. * To represent the second feature extraction of the same data by the TextCNN feature extraction model.
[0124] Output:
[0125] Update the weight parameters of the vectorized model.
[0126] In a specific embodiment, in step S3, the training log data set is traversed, and subsequence sample data is generated by extracting and associating sessions and events in the data of the training log data set. The specific steps are:
[0127] S301: traverse each row in the training log data set, and extract the session ID that meets the specific pattern from the Content field of each row;
[0128] S302: For each session ID, associate its corresponding event ID, component and time information;
[0129] S303: Save the associated information as a sequence CSV file, and generate a JSON mapping file for all unique components in the structured log template data, each component is mapped to a unique digital ID; the sequence CSV file and the JSON mapping file are used as subsequence sample data.
[0130] In this embodiment, the pseudo code for generating subsequence sample data is:
[0131] Function sample(log_file):
[0132]
[0133] End the function.
[0134] In a specific embodiment, in step S4, subsequence feature modeling is performed in the following specific steps:
[0135] S4101: Obtain the semantic features V of the log sequence in the vectorized data and the subsequence in the subsequence sample data; obtain the time features T of the log sequence and the subsequence;
[0136] S4102: Input the acquired semantic features V and temporal features T into MLP for data fitting and then concatenate them to obtain data feature embedding X:
[0137]
[0138] in It is represented as a concatenation operation, and φ represents the MLP embedding operation;
[0139] S4103: Use GRU gated recurrent units to capture the sequential dependencies in log sequences and subsequences, respectively, and obtain log sequence sequential embedding and subsequence order embedding X c :
[0140]
[0141] X c =GRU2(X)
[0142] Among them, GRU1 is a log sequence GRU operation, and GRU2 is a subsequence GRU operation.
[0143] In a specific embodiment, subsequence correlation modeling includes the following specific steps:
[0144] S4201: Embed the order of each subsequence into X c Paired together, we get the associated embedding X e :
[0145]
[0146] Among them, ρ represents the activation function, and, denote the embedding of the i-th subsequence and the embedding of the j-th subsequence respectively;
[0147] S4202: Based on the association embedding, obtain the association weight X of each pair of subsequences r :
[0148]
[0149] Among them, ω represents the convolution operation;
[0150] S4203: Using the graph attention network, the embeddings in the subsequence are treated as graph node embeddings, and the association weights between different subsequences are used as edge weights. Through the GAT layer, the updated subsequence embedding X is obtained. m :
[0151] X m =ρ(GAT(X c ,X r ))
[0152] Among them, GAT is a graph attention network.
[0153] In a specific embodiment, the subsequence feature fusion comprises the following specific steps:
[0154] S4301: Use the attention mechanism to fuse all subsequence embedding features:
[0155]
[0156] Among them, AF is the function for calculating the attention score, is the embedding of the subsequence, G attion is the attention vector, N c is the number of log sequence components;
[0157] S4302: Connect the embedding of the subsequence fusion and the sequential embedding of the log sequence and input them into the classifier to obtain the probability X of the log template of the next log message l :
[0158] X l =ρ out (X c ,X r )
[0159] Among them, ρ out is the SoftMax activation function.
[0160] In this embodiment, the pseudo code for modeling the subsequence correlation model is:
[0161]
[0162]
[0163] In a specific embodiment, in step S5, training the subsequence correlation model is specifically: training the subsequence correlation model to minimize the cross entropy loss:
[0164]
[0165] Among them, X l i represents the predicted probability of the i-th log template, and y i Indicates whether the predicted log template is the same as the real log template:
[0166]
[0167] In this embodiment, the pseudo code for training the subsequence correlation model is:
[0168]
[0169]
[0170] In a specific embodiment, in step S6, log anomalies are detected by using a trained subsequence correlation model, and the specific steps are as follows:
[0171] S601: Obtaining the log sequence S to be detected t ;
[0172] S602: Input the log sequence to be detected into the trained subsequence correlation model to obtain a set of templates ranked top several times;
[0173] S603: If the real log template of the next log message is not in the set, it is considered that S t Is the abnormal log sequence.
[0174] In this embodiment, the pseudo code for detecting log anomalies is:
[0175]
[0176] In this embodiment, the present invention is based on a log anomaly detection framework LogCorrX that considers subsequence correlation, and the framework is constructed based on the correlation of log data subsequences. With the help of pre-trained language models, contrastive learning, and graph attention networks in deep learning, the subsequence correlation is deeply modeled, thereby deepening the understanding of the correlation between log data. It mainly includes six steps: the first step is to use the Drain method to parse the template of the log on the LogHub dataset to obtain a structured log template. The second step is to use a vectorized model composed of E5 and TextCNN for unsupervised contrastive learning training. The third step is to generate subsequence samples from structured log data and associate corresponding event information. In the fourth step, the model models the correlation of subsequences and extracts features, and processes them using graph attention networks and attention mechanisms. In the fifth step, the model is trained, the goal is to predict the template probability of the next log message, and the cross entropy loss method is used for optimization. The sixth step is to perform anomaly detection on the log sequence, and detect the log sequence through the trained model. This method can not only efficiently detect anomalies in system logs, but also provide valuable references for system engineers in fault diagnosis.
[0177] Example 3
[0178] A system log anomaly detection system based on deep learning technology, including a training data module, a vectorized training module, a subsequence sample generation module, a subsequence correlation modeling module, a model training module, and an anomaly detection module;
[0179] The training data module is used to obtain a training log data set, perform template parsing on the training log data set, and obtain structured log template data;
[0180] The vectorization training module is used to construct a vectorization model including E5 and TextCNN models, and input the structured log template data into the vectorization model for unsupervised comparative learning training to obtain vectorized data;
[0181] The subsequence sample generation module is used to traverse the training log data set, and generate subsequence sample data by extracting and associating the sessions and events in the data of the training log data set;
[0182] The subsequence correlation modeling module is used to perform subsequence feature modeling, subsequence correlation modeling, and subsequence feature fusion according to the vectorized data and subsequence sample data, and complete the subsequence correlation modeling;
[0183] The model training module is used to train the subsequence correlation model;
[0184] The anomaly detection module is used to detect log anomalies through a trained subsequence correlation model.
[0185] Obviously, the above embodiments of the present invention are only examples for clearly explaining the present invention, and are not intended to limit the implementation methods of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the protection scope of the claims of the present invention.
Claims
1. A system log anomaly detection method based on deep learning technology, characterized by: The specific steps include: S1: Obtain a training log data set, perform template parsing on the training log data set, and obtain structured log template data; S2: Build a vectorization model including E5 and TextCNN models, and input the structured log template data into the vectorization model for unsupervised contrastive learning training to obtain vectorized data; Build a vectorized model including E5 and TextCNN models, and input the structured log template data into the vectorized model for unsupervised contrastive learning training. The specific steps are as follows: S201: vectorize the structured log template data through the E5 model; S202: passing the output of the last hidden layer of the vectorized log template data into TextCNN to extract features; S203: concatenate the vector corresponding to the first token of the last hidden layer of E5 with the output of TextCNN to form a vectorized model; S204: Divide the same log template in the structured log template data into two batches and input them into the vectorization model; use the Dropout strategy to generate positive samples, and regard other log template data in each batch as negative samples; S205: Use the unsupervised contrastive learning loss function InfoNCELoss for unsupervised contrastive learning; Loss function L CL Specifically: Among them, z is the random mask used in the model, and is the output vector of the model based on the random mask z when processing the log sequence, f θ represents the vectorized model, represents the log sequence, and the unsupervised contrast loss function is controlled by the hyperparameter τ; S3: traverse the training log data set, and generate subsequence sample data by extracting and associating the sessions and events in the data of the training log data set; S4: Based on the vectorized data and subsequence sample data, subsequence feature modeling, subsequence correlation modeling, and subsequence feature fusion are performed to complete the modeling of the subsequence correlation model; S5: training subsequence correlation model; S6: Detect log anomalies through the trained subsequence correlation model.
2. The system log anomaly detection method based on deep learning technology according to claim 1 is characterized in that: In the step S1, the training log data set is template parsed to obtain structured log template data, specifically: the Drain method is used to perform template parsing on the logs of the training log data set: S101: Parse new log messages through regular expression templates; S102: construct a deep tree, and search for log groups according to the design rules encoded in the internal nodes of the deep tree; S103: Match the log message with the log event of the log group, and if there is no match, create a new log group; S104: Traverse the training log data set to obtain structured log template data.
3. The system log anomaly detection method based on deep learning technology according to claim 1 is characterized in that: In step S3, the training log data set is traversed, and subsequence sample data is generated by extracting and associating the sessions and events in the data of the training log data set. The specific steps are: S301: traverse each row in the training log data set, and extract the session ID that meets the specific pattern from the Content field of each row; S302: For each session ID, associate its corresponding event ID, component and time information; S303: Save the associated information as a sequence CSV file, and generate a JSON mapping file for all unique components in the structured log template data, each component is mapped to a unique digital ID; the sequence CSV file and the JSON mapping file are used as subsequence sample data.
4. The system log anomaly detection method based on deep learning technology according to claim 1 is characterized in that: In step S4, subsequence feature modeling is performed, and the specific steps are as follows: S4101: Obtain the semantic features V of the log sequence in the vectorized data and the subsequence in the subsequence sample data; obtain the time features T of the log sequence and the subsequence; S4102: Input the acquired semantic features V and temporal features T into MLP for data fitting and then concatenate them to obtain data feature embedding X: in It is represented as a concatenation operation, and φ represents the MLP embedding operation; S4103: Use GRU gated recurrent units to capture the sequential dependencies in log sequences and subsequences, respectively, and obtain log sequence sequential embedding and subsequence order embedding X c : X c =GRU2(X) Among them, GRU1 is a log sequence GRU operation, and GRU2 is a subsequence GRU operation.
5. The system log anomaly detection method based on deep learning technology according to claim 4 is characterized in that: Subsequence correlation modeling, the specific steps are: S4201: Embed the order of each subsequence into X c Paired together, we get the associated embedding X e : Among them, ρ represents the activation function, and, denote the embedding of the i-th subsequence and the embedding of the j-th subsequence respectively; S4202: Based on the association embedding, obtain the association weight X of each pair of subsequences r : Among them, ω represents the convolution operation; S4203: Using the graph attention network, the embeddings in the subsequence are treated as graph node embeddings, and the association weights between different subsequences are used as edge weights. Through the GAT layer, the updated subsequence embedding X is obtained. m : X m =ρ(GAT(X c ,X r )) Among them, GAT is a graph attention network.
6. The system log anomaly detection method based on deep learning technology according to claim 5 is characterized in that: Subsequence feature fusion, the specific steps are: S4301: Use the attention mechanism to fuse all subsequence embedding features: Among them, AF is the function for calculating the attention score, is the embedding of the subsequence, G attion is the attention vector, N c is the number of log sequence components; S4302: Connect the embedding of the subsequence fusion and the sequential embedding of the log sequence and input them into the classifier to obtain the probability X of the log template of the next log message l : X l =ρ out (X c ,X r ) Among them, ρ out is the SoftMax activation function.
7. The system log anomaly detection method based on deep learning technology according to claim 6 is characterized in that: In the step S5, the subsequence correlation model is trained, specifically: the subsequence correlation model is trained to minimize the cross entropy loss: Among them, X l i represents the predicted probability of the i-th log template, and y i Indicates whether the predicted log template is the same as the real log template:
8. The system log anomaly detection method based on deep learning technology according to claim 7 is characterized in that: In step S6, the log anomaly is detected by using the trained subsequence correlation model, and the specific steps are as follows: S601: Obtaining the log sequence S to be detected t ; S602: Input the log sequence to be detected into the trained subsequence correlation model to obtain a set of templates ranked top several times; S603: If the real log template of the next log message is not in the set, it is considered that S t Is the abnormal log sequence.
9. A system log anomaly detection system based on deep learning technology, characterized in that: It includes training data module, vectorized training module, subsequence sample generation module, subsequence correlation modeling module, model training module and anomaly detection module; The training data module is used to obtain a training log data set, perform template parsing on the training log data set, and obtain structured log template data; The vectorization training module is used to construct a vectorization model including E5 and TextCNN models, and input the structured log template data into the vectorization model for unsupervised comparative learning training to obtain vectorized data; Build a vectorized model including E5 and TextCNN models, and input the structured log template data into the vectorized model for unsupervised contrastive learning training. The specific steps are as follows: S201: vectorize the structured log template data through the E5 model; S202: passing the output of the last hidden layer of the vectorized log template data into TextCNN to extract features; S203: concatenate the vector corresponding to the first token of the last hidden layer of E5 with the output of TextCNN to form a vectorized model; S204: Divide the same log template in the structured log template data into two batches and input them into the vectorization model; use the Dropout strategy to generate positive samples, and regard other log template data in each batch as negative samples; S205: Use the unsupervised contrastive learning loss function InfoNCELoss for unsupervised contrastive learning; the loss function L CL Specifically: Among them, z is the random mask used in the model, and is the output vector of the model based on the random mask z when processing the log sequence, f θ represents the vectorized model, represents the log sequence, and the unsupervised contrast loss function is controlled by the hyperparameter τ; The subsequence sample generation module is used to traverse the training log data set, and generate subsequence sample data by extracting and associating the sessions and events in the data of the training log data set; The subsequence correlation modeling module is used to perform subsequence feature modeling, subsequence correlation modeling, and subsequence feature fusion according to the vectorized data and subsequence sample data, and complete the subsequence correlation modeling; The model training module is used to train the subsequence correlation model; The anomaly detection module is used to detect log anomalies through a trained subsequence correlation model.
