Long text abnormal log classification method and device

Through word segmentation processing and word vector analysis, combined with keyword tags and context, the abnormal feature recognition model is trained to solve the problems of low accuracy and insufficient timeliness in long text log classification, and achieve efficient classification of long text abnormal logs.

CN118606780APending Publication Date: 2024-09-06INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410648750.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing RNN-type models and BERT-type models have problems of forgetting, excessive computation, and excessive time-consuming in long text log classification, making it difficult to meet timeliness requirements, and existing methods for extracting key abnormal features such as key-based Vocabulary and word frequency methods have limitations and cannot effectively handle the key changes of words in different contexts.

Method used

Obtain word sequences through word segmentation processing, use natural language classifiers and non-natural language classifiers to analyze and obtain word vectors, construct word vector sequences, and train abnormal feature keyword recognition models through keyword tags and context sequences to generate abnormal feature keyword sequences. , and finally use the preset neural network model for classification.

Benefits of technology

It improves the classification accuracy of long text anomaly logs, avoids the problem of low-frequency words not being extracted, can accurately identify the keyness of words in different contexts, and meets timeliness requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606780A
    Figure CN118606780A
Patent Text Reader

Abstract

The invention provides a long text abnormal log classification method and device, and relates to the field of big data analysis, the applicable finance field and other fields, the method comprises the following steps: according to received long text abnormal log data, utilizing word segmentation processing to obtain a corresponding word sequence; according to the word sequence, word vectors are obtained through analysis of a natural language classifier and an unnatural language classifier, and a word vector sequence corresponding to the long text abnormal log data is constructed through the word vectors; according to the word vector sequence, carrying out analysis by using an abnormal feature keyword recognition model trained by a keyword tag and a context sequence corresponding to the keyword to obtain an abnormal feature keyword sequence; and according to the abnormal feature keyword sequence and the corresponding log type tag, performing classification through a preset neural network model to obtain an abnormal type of the long text abnormal log data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data analysis and can be applied to the financial field and other fields, and particularly refers to a method and device for classifying long text abnormal logs. Background Art

[0002] Log analysis is a major troubleshooting method and is widely used in program development, testing, and system operation and maintenance. In a bank's distributed system, a transaction often spans multiple service units, and a service unit is often divided into multiple roles responsible for different areas. Therefore, for the abnormal logs found by the system, they need to be accurately classified and distributed to specific roles for processing according to the type. The timeliness and accuracy of abnormal classification are important factors affecting the efficiency of troubleshooting.

[0003] At present, there are two main methods for classifying log text in the industry: RNN model and BERT model. The above two methods can achieve good results for the classification of short text logs, but in the actual log classification scenario, there are long text logs with more than 10,000 words, and the above two methods have limited effect on long text logs. When using RNN models to classify long texts, the model reads each word in the text one by one. When reading the later input words, there is a problem of forgetting the previously input information, resulting in low classification accuracy. When using BERT models, although the problem of long-distance information forgetting is solved, for long text logs, the model has a huge amount of calculation and takes too long to meet the timeliness requirements.

[0004] To solve the above two problems, we can consider extracting key abnormal features from long text logs to form shorter abnormal feature texts, and then classify them through RNN models or BERT models to improve the accuracy of the model. At present, the main methods for extracting key abnormal features in the industry are keyword table-based methods and word frequency-based methods, but these two methods still have certain limitations. If the keyword table method is used, that is, words belonging to the keyword table are extracted from long text logs, and words that do not belong to the keyword table are discarded. The disadvantage of this method is that the judgment of keywords only depends on the meaning of the word itself, but ignores the context in which the word is located. It cannot handle the scenario where a word is a keyword in one context but not a keyword in another context. If the word frequency-based method is used, that is, the number of times a word appears in the log data set is counted, the more times a word appears, the more likely it is to be considered a keyword. This method ignores the semantics of the word and cannot handle logs where the keyword is a low-frequency word. Summary of the invention

[0005] The purpose of this application is to provide a long text exception log classification method and device to solve the problem that long text exception logs are difficult to effectively classify.

[0006] To achieve the above-mentioned purpose, the long text exception log classification method provided by the present application comprises: according to the received long text exception log data, using word segmentation processing to obtain a corresponding word sequence; according to the word sequence, using a natural language classifier and a non-natural language classifier to analyze to obtain a word vector, and using the word vector to construct a word vector sequence corresponding to the long text exception log data; according to the word vector sequence, using an abnormal feature keyword recognition model trained by using keyword tags and keyword corresponding context sequences to obtain an abnormal feature keyword sequence; according to the abnormal feature keyword sequence and the corresponding log type label, using a preset neural network model to classify and obtain the abnormal type of the long text exception log data.

[0007] In the above-mentioned long text exception log classification method, optionally, obtaining a word vector according to the word sequence through natural language classifier and non-natural language classifier analysis includes: analyzing the word sequence through natural language classifier and non-natural language classifier to obtain word type index of natural language vocabulary and non-natural language vocabulary; matching the natural language vocabulary in the word sequence with a preset vocabulary table to obtain a natural language vocabulary index, and transforming the non-natural language vocabulary in the word sequence through a preset vocabulary pre-training model to obtain a non-natural language vocabulary encoding; generating a word vector through the word type index, the natural language vocabulary index and the non-natural language vocabulary encoding.

[0008] In the above-mentioned long text exception log classification method, optionally, the method further includes: identifying the context sequence of each word sequence in the long text exception log data one by one through the word vector; constructing a training data set through the context sequence and the keyword labels of the word sequence, and training and generating an abnormal feature keyword recognition model through the training data set.

[0009] In the above-mentioned long text exception log classification method, optionally, identifying the context sequence of each word sequence in the long text exception log data one by one through the word vector includes: obtaining the word sequence at the upper and lower preset positions according to the position of the word sequence in the long text exception log data to generate a context sequence; wherein when there is no word sequence at the upper and lower preset positions in the long text exception log data, the context sequence is generated by filling in the preset filling word vector.

[0010] In the above-mentioned long text abnormal log classification method, optionally, the method further includes: splitting words in a preset vocabulary into characters, training a language representation model according to the characters through a self-supervised learning algorithm to obtain a non-natural language vocabulary pre-training model; and adjusting according to the non-natural language vocabulary pre-training model to obtain a non-natural language classifier.

[0011] In the above-mentioned long text exception log classification method, optionally, adjusting the non-natural language classifier according to the non-natural language vocabulary pre-training model includes: generating a labeled fine-tuning data set according to the code library, the class name of the construction warehouse, the registration name of the service registration center, the file path and the randomly generated hash character sequence; generating identification data for each word in the fine-tuning data set by splitting it and adding a classification identifier to the header, and obtaining a type vector by analyzing the identification data through the non-natural language vocabulary pre-training model; obtaining model parameters by calculating the loss value of the type vector and the type label through the gradient descent method, and obtaining a non-natural language classifier through the model parameters and the non-natural language vocabulary pre-training model.

[0012] In the above-mentioned long text abnormal log classification method, optionally, obtaining an abnormal feature keyword sequence according to the word vector sequence by analyzing an abnormal feature keyword recognition model trained by using keyword tags and keyword corresponding context sequences includes: analyzing the word vector sequence by the abnormal feature keyword recognition model to obtain corresponding keyword scoring data, extracting keyword data according to the keyword scoring data; and constructing an abnormal feature keyword sequence according to the keyword data.

[0013] The present application also provides a long text abnormal log classification device, which includes a word segmentation module, a recognition module, an extraction module and an analysis module; the word segmentation module is used to obtain a corresponding word sequence by word segmentation processing according to the received long text abnormal log data; the recognition module is used to obtain a word vector according to the word sequence through a natural language classifier and a non-natural language classifier, and construct a word vector sequence corresponding to the long text abnormal log data through the word vector; the extraction module is used to obtain an abnormal feature keyword sequence according to the word vector sequence through an abnormal feature keyword recognition model trained by using keyword tags and keyword corresponding context sequences; the analysis module is used to obtain the abnormal type of the long text abnormal log data through a preset neural network model classification according to the abnormal feature keyword sequence and the corresponding log type label.

[0014] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the computer program.

[0015] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.

[0016] The present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above method is implemented.

[0017] The beneficial technical effects of the present application are: by converting long text exception logs into short text exception features, the problem of low accuracy when long text exception logs are directly classified is avoided; when extracting features, the present application does not extract features based on word frequency, avoiding the problem of inability to effectively extract abnormal keywords when they are low-frequency words; when extracting features, since the semantics of the vocabulary itself and the context in which the words are located in the log are taken into consideration at the same time, it is possible to accurately identify the situation where a word is a keyword in one context but not a keyword in another context. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. In the drawings:

[0019] Figure 1A A flowchart of a method for classifying long text abnormal logs provided in an embodiment of the present application;

[0020] Figure 1B A schematic diagram of the application process of the long text abnormal log classification method provided in one embodiment of the present application;

[0021] Figure 2 A schematic diagram of a word vector acquisition process provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of a process for constructing a non-natural language classifier provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of a non-natural language vocabulary pre-training model adjustment process provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of the self-supervised training principle provided in one embodiment of the present application;

[0025] Figure 6 A schematic diagram of the adjustment principle of the non-natural language vocabulary pre-training model provided in one embodiment of the present application;

[0026] Figure 7 A schematic diagram of a word index obtaining process provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of vocabulary encoding logic provided by an embodiment of the present application;

[0028] Fig. 9 A schematic diagram of a word vector generation process provided in an embodiment of the present application;

[0029] Fig.10 A schematic diagram of a flow chart of generating an abnormal feature keyword recognition model provided in an embodiment of the present application;

[0030] Fig.11 A schematic diagram of the principle of a keyword recognition model provided in one embodiment of the present application;

[0031] Fig.12 A schematic diagram of a flow chart for obtaining an abnormal feature keyword sequence provided in an embodiment of the present application;

[0032] Fig.13 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will describe the implementation methods of the present application in detail in conjunction with the accompanying drawings and embodiments, so that the implementation process of how the present application applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments in the present application and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present application.

[0034] In addition, the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be performed in an order different from that shown here.

[0035] Please refer to Figure 1A As shown, the long text abnormal log classification method provided by this application includes:

[0036] S101 obtains a corresponding word sequence by using word segmentation processing according to the received long text abnormal log data;

[0037] S102 obtains a word vector by analyzing the word sequence using a natural language classifier and a non-natural language classifier, and constructs a word vector sequence corresponding to the long text abnormal log data using the word vector;

[0038] S103 obtains an abnormal feature keyword sequence according to the word vector sequence by analyzing an abnormal feature keyword recognition model trained by using keyword labels and keyword corresponding context sequences;

[0039] S104 obtains the abnormal type of the long text abnormal log data through a preset neural network model classification according to the abnormal feature keyword sequence and the corresponding log type label.

[0040] Specifically, in actual work, the long text abnormal log classification method provided in this application can refer to Figure 1BAs shown in the figure, the process steps are as follows: 1. Preprocess the original log to perform noise reduction and format unification. 2. Segment the log content to obtain the word sequence of the log; 3. Each word in the word sequence is passed through a natural language word classifier to determine whether it belongs to a natural language vocabulary or a non-natural language vocabulary. If it is a natural language vocabulary, its specific word type index is obtained. 4. Split the words in the vocabulary such as English words, class names, and service names into characters, and perform self-supervisory training through a BERT-like model to obtain a non-natural language vocabulary pre-training model. 5. Fine-tune the non-natural language vocabulary pre-training model to obtain a non-natural language vocabulary classifier, through which the word type index of non-natural language vocabulary can be obtained. 6. Match the natural language vocabulary in the word sequence with the common vocabulary list of logs to obtain a natural language vocabulary index. 7. For non-natural language words that need to retain semantics, obtain non-natural language word encoding through pooling and linear transformation based on the word pre-training model generated in step 4; 8. Integrate the output results of steps 3 to 7, and generate word vectors according to the word type index, natural language word index, and non-natural language word encoding. 9. According to the specified sliding window, sample the context of each word in the log to obtain the context word vector sequence of the word. 10. According to the context sequence of each word and the label of whether the word is a keyword, form a training data set, train on the training data set, and obtain an abnormal feature keyword identifier. 11. For each long text log record, extract the abnormal feature keyword sequence according to the abnormal feature keyword identifier. 12. Classify the abnormal feature keyword sequence and the log type label through the LSTM model to realize abnormal type judgment. The specific implementation process of each step will be described in detail in the subsequent embodiments, and will not be described in detail here.

[0041] In the above step 1, the original log is preprocessed, and the main means of noise reduction and format unification are to remove the log header, mask the useless information in the log, unify the format, etc. For example, a system log is as follows, which contains the log header, error code, log information, etc. After log preprocessing, the log header is removed, the IP address is masked, and the uppercase letters are converted to lowercase.

[0042] Please refer to Figure 2 As shown, in one embodiment of the present application, the word vector is obtained by analyzing the word sequence through a natural language classifier and a non-natural language classifier, including:

[0043] S201 analyzes the word sequence by a natural language classifier and a non-natural language classifier to obtain word type indexes of natural language vocabulary and non-natural language vocabulary;

[0044] S202 matches the natural language words in the word sequence with a preset vocabulary to obtain a natural language word index, and transforms the non-natural language words in the word sequence through a preset word pre-training model to obtain a non-natural language word encoding;

[0045] S203 generates a word vector through the word type index, the natural language vocabulary index and the non-natural language vocabulary encoding.

[0046] In actual work, this link includes the model generation process. Specifically, each word in the word sequence can be passed through a natural language word classifier to determine whether it belongs to a natural language word or a non-natural language word. If it is a natural language word, the word type index is obtained. If it is not a natural language word, go to step 5 to obtain the word type index through a non-natural language word classifier.

[0047] Common words in logs are mainly divided into natural language words and non-natural language words. Natural language words mainly include Chinese words, English words, punctuation marks, numbers, custom words, etc.; non-natural language words mainly include class names, service names, file paths, non-semantic character sequences, etc. The process of determining whether a word is natural language is as follows:

[0048] For Chinese words, punctuation marks, and custom words, the type of the word can be obtained by searching the vocabulary table to see if there is a corresponding word.

[0049] For pure numeric words, regular matching can be used to determine whether the word is a number;

[0050] For English words, common English words can be matched through open source tools in the industry;

[0051] If a word does not belong to the above Chinese words, English words, punctuation marks, numbers, or custom words, it is considered a non-natural language word.

[0052] For example, for the word sequence after word segmentation, if it is a natural language word, its specific type can be obtained according to the above method. For non-natural language words, it is temporarily marked as a non-natural language word and will be further subdivided later.

[0053] Afterwards, please refer to Figure 3 As shown, the method further comprises:

[0054] S301: split the words in the preset vocabulary into characters, and train the language representation model according to the characters by a self-supervised learning algorithm to obtain a non-natural language vocabulary pre-training model;

[0055] S302: obtaining a non-natural language classifier according to the non-natural language vocabulary pre-training model.

[0056] For further information, please refer to Figure 4 As shown, in another embodiment of the present application, adjusting the non-natural language vocabulary pre-training model to obtain a non-natural language classifier includes:

[0057] S401 generates a labeled fine-tuning dataset according to the code base, the class name of the build repository, the registration name of the service registry, the file path, and a randomly generated hash character sequence;

[0058] S402 generates identification data by adding a classification identifier to the header of each word in the fine-tuning data set after splitting, and obtains a type vector by analyzing the identification data through the non-natural language vocabulary pre-training model;

[0059] S403 calculates model parameters by using a gradient descent method according to the loss values ​​of the type vector and the type label, and obtains a non-natural language classifier by using the model parameters and the non-natural language vocabulary pre-training model.

[0060] Specifically, in actual work, the above embodiment is the specific implementation logic of step 4 to step 8, wherein the implementation details of each step in step 4 to step 8 can be referred to as shown in the subsequent embodiments:

[0061] First, in step 4, the words in the vocabulary such as English words, class names, and service names are split into characters, and self-supervised training is performed through a BERT-like model to obtain a non-natural language vocabulary pre-training model.

[0062] Since the number of non-natural language words in the log is endless, such as service names, file paths, hash strings, etc., new words can be obtained by permutations and combinations of different characters. It is impossible to encode each word in the way of assigning a unique ID in the field of natural language processing. In order to encode the endless vocabulary into a word vector of finite dimensions, this application proposes a character-based BERT-like pre-training model for subsequent vocabulary encoding and vocabulary classification. The implementation steps are as follows:

[0063] 1. The pre-training data set is composed of the class names in the code library and the warehouse, the service names of the service registration center, typical file path names, and the common English word library;

[0064] 2. Split each word in the pre-training dataset into a character sequence and generate a character index sequence based on the custom character set.

[0065] Since characters in non-natural languages ​​are usually composed of uppercase and lowercase English letters, numbers, and punctuation marks, the total number of characters is limited. In this example, a character set consisting of 93 characters is used. Therefore, each word is split into characters and then mapped to a character index through the character set, realizing the mapping of any word to a fixed-dimensional vector sequence.

[0066] For example, split "com.example.service1" into "[c,o,m,.,e,x,a,m,p,l,e,.,s,e,r,v,i,c,e,1]", and the character index sequence generated by the custom character set is "[40,52,50,81,42,61,....]"

[0067] 3. Use a BERT-like model to perform self-supervised training on the character index sequence to obtain a vocabulary encoding pre-training model.

[0068] The BERT-like model consists of an embedding layer, a transformer encoder TransformerEncoderLayer, i.e., multiple EncoderLayers of the Transformer model, and a fully connected layer Linear. The model structure is as follows Figure 5 The process of taking the randomly masked character index sequence as input, comparing the model output sequence with the unmasked character index sequence, and adjusting the model parameters according to the loss values ​​calculated from the two is called self-supervised training of the model.

[0069] Then go to step 5 and fine-tune the non-natural language vocabulary pre-training model. Figure 6 As shown, a non-natural language vocabulary classifier is obtained. The steps are as follows:

[0070] 1. Generate a labeled fine-tuning dataset by combining the class names in the code base and build repository, the service names of the service registry, common file paths, and randomly generated hash character sequences.

[0071] 2. For each word in the fine-tuning dataset, after splitting, the classification identifier "[CLS]" is added to its head. After calculation by the non-natural language vocabulary pre-training model, the corresponding hidden layer hidden output is obtained. After a linear transformation LinearLayer and normalization class, the type vector is obtained.

[0072] 3. According to the loss value of the type vector and the type label, the model parameters are optimized by the gradient descent method, and finally the non-natural language vocabulary classifier is obtained.

[0073] For example, the non-natural language words in the sample log include "zookeeper.gz.zone7.test" and "bc28c93". After passing through the above-mentioned BERT-like model, a hidden layer vector can be obtained. After passing through the fully connected layer, the vector forms a type vector. According to the type vector, it can be judged that "zookeeper.gz.zone7.test" is the service name and "bc28c93" is a hash string.

[0074] Next, proceed to step 6 to match the natural language words in the word sequence with the common log vocabulary to obtain a natural language word index.

[0075] like Figure 7 As shown in the figure, the commonly used vocabulary of logs mainly includes Chinese vocabulary, English words, punctuation marks and custom vocabulary of natural language. It can be obtained by analyzing historical logs. For each word in the word sequence, the vocabulary index of the word is queried in the vocabulary. If the word is not in the vocabulary, it is considered to be an unknown word, and its index is the unknown word index. For example: "error_code" is indexed as 15 in the vocabulary, "msg" is indexed as 16 in the vocabulary, and the number "853423" is a natural language word, but it is not in the vocabulary, so its vocabulary index is the unknown word index 0.

[0076] Going to step 7, for the non-natural language words that need to be retained, encode them using the vocabulary pre-training model generated in step 4 to obtain the non-natural language vocabulary encoding;

[0077] For words that are not in the vocabulary, the semantic information of the word is discarded by specifying it as an unknown word in the vocabulary index vector. For information such as service names, class names, file paths, etc., we usually want to retain the semantic information of these words as much as possible. In this application, the retention of semantic information is achieved through vocabulary encoding. For words that do not need to retain semantic information, such as hash strings, this part can be kept as a full 0 vector.

[0078] The semantic encoder uses step 4 to generate a pre-trained model. For each input character, the hidden layer vector corresponding to each character is obtained after the pre-trained model. Then, the encoding of the word can be obtained through the pooling layer and the fully connected layer. The specific structure is as follows: Figure 8 For example, since the vocabulary index corresponding to the service name "zookeeper.gz.zone7.test" is unknown word index 0, the vocabulary index does not contain the semantic information of the word; in order to retain the information of the word, it can be encoded through the above model, and the encoding contains the semantic information of the word.

[0079] Finally, go to step 8, which integrates the output results of steps 3 to 7, and generates word vectors based on word type index, natural language vocabulary index, and non-natural language vocabulary encoding. Fig. 9 As shown, the main steps are:

[0080] 1. Perform OneHot encoding on the word type index and pass it through the word embedding matrix to obtain the word type vector.

[0081] 2. OneHot encode the vocabulary index and pass it through the word embedding matrix to obtain the vocabulary index vector;

[0082] 3. Concatenate the word type vector, vocabulary index vector and vocabulary encoding to get the word vector of the word.

[0083] For example, for "zookeeper.gz.zone7.test", the word type is the service name, the word type index is 3, and the vocabulary index is 0. After word embedding, we can get the word type vector and the vocabulary index vector respectively. The above two vectors are concatenated with the vocabulary encoding vector to finally get the word vector of the word "zookeeper.gz.zone7.test".

[0084] Word embedding consists of two parts: OneHot encoding and linear transformation.

[0085] OneHot encoding is a common encoding form for discrete data in the industry. For example, if the word type index is 3, the corresponding OneHot encoding is [0,0,0,1,0,0,0,0,0], where the position with index 3 is marked as 1, and the other dimensions are marked as 0. The vector has as many dimensions as there are word types.

[0086] After OneHot encoding, most of the word vectors obtained are 0, that is, a sparse vector. In order to reduce the dimension of the vector, it can be further compressed by linear transformation to obtain a dense vector. For example, after OneHot encoding, the word type index obtains a 9-dimensional vector, indicating that there are 9 types in total, and the value of one dimension is 1, indicating which type the word belongs to. When compressing, a 9×3 matrix can be used for linear transformation. After linear transformation, the 9-dimensional sparse vector becomes a 3-dimensional dense vector.

[0087] If the type index and vocabulary index of "zookeeper.gz.zone7.test" are word embedded, we get a 3-dimensional type vector and a 512-dimensional vocabulary index vector respectively. In addition, its vocabulary is encoded as a 512-dimensional vector. Then the 1027-dimensional vector obtained by concatenating the three is the word vector of the word.

[0088] Please refer to Fig.10 As shown, in one embodiment of the present application, the method further comprises:

[0089] S1001 identifies the context sequence of each word sequence in the long text abnormal log data one by one through the word vector;

[0090] S1002 constructs a training data set through the keyword labels of the context sequence and the word sequence, and generates an abnormal feature keyword recognition model through training with the training data set.

[0091] In the above embodiment, identifying the context sequence of each word sequence in the long text exception log data one by one through the word vector includes: obtaining the word sequences at the upper and lower preset positions according to the position of the word sequence in the long text exception log data to generate a context sequence; wherein when there is no word sequence at the upper and lower preset positions in the long text exception log data, filling in the generated context sequence through the preset filling word vector.

[0092] Specifically, the above embodiment mainly implements the specific implementation details of step 9, the purpose of which is to sample the context of each word in the log according to the specified sliding window to obtain the context word vector sequence of the word.

[0093] For example, if the word vector sequence corresponding to the current log ["error_code", ":", "853423", "msg", ":", "registration", "port", ...] is [v1, v2, ..., v n ], the specified sliding window size is 5, then for the first word v1, take the word vectors of the first two words and the last two words to form a context word vector sequence, and get [<pad>, <pad>, v1, v2, v3]. Among them, since there is no other word before the first word v1, two padding word vectors are added <pad>Similarly, we can get the word vector sequence of the second word v2 [<pad>, v1, v2, v3, v4] and the word vector sequence of the third word v3 [v1, v2, v3, v4, v5]. n Since there are no other words after it, two filler word vectors are filled in. <pad>, we get [v n-2 ,v n-1 ,v n ,<pad>,<pad>].

[0094] Then, step 10 is entered to form a training data set based on the context sequence of each word and the label of whether the word is a keyword. Training is performed on the training data set to obtain an abnormal feature keyword identifier. For example, if the word vector sequence corresponding to the current log is [v1, v2, ..., v n ], the specified sliding window size is 5, then for the first word v1, its context sequence is [<pad>, <pad>, v1, v2, v3]. If word v1 is a keyword in the sentence, its label is set to 1, otherwise its label is set to 0. The context sequence corresponding to each word in each log entry and the label of whether it is a keyword are obtained in turn as the training data set.

[0095] The keyword recognition model consists of the Encoder of the Transformer model and a linear layer. The model structure is as follows Fig.11 As shown in the figure. The model obtains the hidden layer vector of the context sequence after multiple TransformerEncodeLayers, and obtains the score of the word after linear transformation and normalization in the fully connected layer. By calculating the loss value of the score and the label and using the gradient descent method to update the model parameters, the score and the label are close enough. Thus, a keyword identifier is obtained. When predicting, the context sequence to be classified is input into the model to obtain a score. If the score exceeds the threshold, it is identified as a keyword, otherwise it is a non-keyword.

[0096] Please refer to Fig.12 As shown, in one embodiment of the present application, the abnormal feature keyword sequence is obtained by analyzing the abnormal feature keyword recognition model trained by using the keyword label and the keyword corresponding context sequence according to the word vector sequence, including:

[0097] S1201 analyzes the word vector sequence through the abnormal feature keyword recognition model to obtain corresponding keyword scoring data, and extracts keyword data according to the keyword scoring data;

[0098] S1202 constructs an abnormal characteristic keyword sequence according to the keyword data.

[0099] Specifically, this embodiment is the aforementioned step 11, for each long text log record, extract the abnormal feature keyword sequence according to the abnormal feature keyword identifier. For example, for a word vector sequence corresponding to a log [v1, v2, ..., v n ], after step 10, we get the keyword score of each word vector [0.82, 0.02, 0.13, .....], and extract the keywords from the log word vector sequence according to the score to form a new subsequence [v1, v5, ..., v m ], this sequence is the characteristic keyword sequence of the log. Finally, execute step 12 to classify the abnormal characteristic keyword sequence and the log type label through the LSTM model to realize the abnormal type judgment. Specifically, if the abnormal characteristic keyword sequence is [v1,v5,...,v m ], and use it as the input of LSTM to get the hidden layer vector h m , h m The fully connected layer is input and normalized to obtain the type vector of the feature keyword sequence. The model parameters are optimized by the gradient descent method, and finally the log anomaly classification model is obtained.

[0100] The present application also provides a long text abnormal log classification device, the device includes a word segmentation module, a recognition module, an extraction module and an analysis module; the word segmentation module is used to obtain a corresponding word sequence by word segmentation processing according to the received long text abnormal log data; the recognition module is used to obtain a word vector by analyzing the word sequence through a natural language classifier and a non-natural language classifier, and construct a word vector sequence corresponding to the long text abnormal log data through the word vector; the extraction module is used to obtain an abnormal feature keyword sequence by analyzing the abnormal feature keyword recognition model trained by using keyword tags and keyword corresponding context sequences according to the word vector sequence; the analysis module is used to obtain the abnormal type of the long text abnormal log data by classifying the abnormal feature keyword sequence and the corresponding log type label through a preset neural network model. Since the principle and method of solving the problem of the device are similar, the implementation of the device can refer to the implementation of the long text abnormal log classification method, and the repeated parts will not be repeated.

[0101] It should be noted that the long text exception log classification method and device provided in the embodiment of the present invention can be used in the financial field, and can also be used in any technical field other than the financial field. The embodiment of the present invention does not limit the application field of the long text exception log classification method and device.

[0102] The beneficial technical effects of the present application are: by converting long text exception logs into short text exception features, the problem of low accuracy when long text exception logs are directly classified is avoided; when extracting features, the present application does not extract features based on word frequency, avoiding the problem of inability to effectively extract abnormal keywords when they are low-frequency words; when extracting features, since the semantics of the vocabulary itself and the context in which the words are located in the log are taken into consideration at the same time, it is possible to accurately identify the situation where a word is a keyword in one context but not a keyword in another context.

[0103] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the computer program.

[0104] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.

[0105] The present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above method is implemented.

[0106] like Fig.13 As shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processor 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily have to include Fig.13 In addition, the electronic device 600 may also include Fig.13 For components not shown, reference may be made to the prior art.

[0107] like Fig.13 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the electronic device 600.

[0108] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 100 may execute the program stored in the memory 140 to implement information storage or processing.

[0109] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.

[0110] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 600 through the central processor 100.

[0111] The memory 140 may also include a data storage unit (data 143) for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit (driver 144) of the memory 140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0112] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.

[0113] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that the sound can be recorded on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.

[0114] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0115] The present application is described with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0116] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0117] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0118] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.< / pad> < / pad>

Claims

1. A method for classifying long text abnormal logs, characterized in that: The method comprises: According to the received long text abnormal log data, the corresponding word sequence is obtained by word segmentation processing; Obtain word vectors according to the word sequence through natural language classifiers and non-natural language classifiers, and construct word vector sequences corresponding to the long text abnormal log data through the word vectors; Obtain an abnormal feature keyword sequence according to the word vector sequence by analyzing an abnormal feature keyword recognition model trained by using keyword labels and keyword corresponding context sequences; The abnormal type of the long text abnormal log data is obtained by classifying the abnormal feature keyword sequence and the corresponding log type label through a preset neural network model.

2. The long text abnormal log classification method according to claim 1 is characterized in that: The word vector obtained by analyzing the word sequence through a natural language classifier and a non-natural language classifier includes: Analyzing the word sequence by a natural language classifier and a non-natural language classifier to obtain word type indexes of natural language vocabulary and non-natural language vocabulary; Matching natural language words in the word sequence with a preset vocabulary to obtain a natural language word index, and transforming non-natural language words in the word sequence through a preset word pre-training model to obtain a non-natural language word encoding; A word vector is generated by encoding the word type index, the natural language vocabulary index and the non-natural language vocabulary.

3. The long text abnormal log classification method according to claim 1 is characterized in that: The method further comprises: Identify the context sequence of each word sequence in the long text abnormal log data one by one through the word vector; A training data set is constructed through the keyword labels of the context sequence and the word sequence, and an abnormal feature keyword recognition model is generated through training with the training data set.

4. The long text abnormal log classification method according to claim 3 is characterized in that: The context sequence of each word sequence in the long text abnormal log data is identified one by one by the word vector, including: According to the position of the word sequence in the long text abnormal log data, word sequences at upper and lower preset positions are obtained to generate a context sequence; When there is no word sequence at the upper and lower preset positions in the long text exception log data, a context sequence is generated by filling in the preset filling word vector.

5. The long text abnormal log classification method according to claim 1 is characterized in that: The method further comprises: Splitting words in a preset vocabulary into characters, and training a language representation model according to the characters through a self-supervised learning algorithm to obtain a non-natural language vocabulary pre-training model; A non-natural language classifier is obtained by adjusting the non-natural language vocabulary pre-training model.

6. The long text abnormal log classification method according to claim 5 is characterized in that: The non-natural language classifier obtained by adjusting the non-natural language vocabulary pre-training model comprises: Generate a labeled fine-tuning dataset based on the code base, the class name of the build repository, the registration name of the service registry, the file path, and a randomly generated hash character sequence; For each word in the fine-tuning data set, after splitting, a classification identifier is added to the header to generate identification data, and the identification data is analyzed by the non-natural language vocabulary pre-training model to obtain a type vector; The model parameters are calculated by the gradient descent method according to the loss values ​​of the type vector and the type label, and the non-natural language classifier is obtained by the model parameters and the non-natural language vocabulary pre-training model.

7. The long text abnormal log classification method according to claim 1 is characterized in that: The abnormal feature keyword sequence obtained by analyzing the abnormal feature keyword recognition model trained by using the keyword label and the keyword corresponding context sequence according to the word vector sequence includes: Analyzing the word vector sequence through the abnormal feature keyword recognition model to obtain corresponding keyword scoring data, and extracting keyword data according to the keyword scoring data; An abnormal characteristic keyword sequence is constructed according to the keyword data.

8. A long text abnormal log classification device, characterized in that: The device comprises a word segmentation module, a recognition module, an extraction module and an analysis module; The word segmentation module is used to obtain a corresponding word sequence by word segmentation processing according to the received long text abnormal log data; The recognition module is used to obtain a word vector according to the word sequence through a natural language classifier and a non-natural language classifier, and to construct a word vector sequence corresponding to the long text abnormal log data through the word vector; The extraction module is used to obtain an abnormal feature keyword sequence according to the word vector sequence by analyzing an abnormal feature keyword recognition model trained by using keyword labels and keyword corresponding context sequences; The analysis module is used to obtain the abnormal type of the long text abnormal log data through a preset neural network model classification according to the abnormal feature keyword sequence and the corresponding log type label.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. 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 method according to any one of claims 1 to 7 is implemented.