Industrial internet anomaly behavior detection method and system

By embedding both semantic and location information into log templates, extracting representative words and encoding them into vectors, and training a classifier, the problems of low log parsing efficiency and semantic bias in the industrial internet are solved, and the accuracy and efficiency of abnormal behavior detection are improved.

CN118094432BActive Publication Date: 2026-11-27CHANGCHUN UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410305517.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-18
Publication Date
2026-11-27
Estimated Expiration
2044-03-18

AI Technical Summary

Technical Problem

Existing technologies in the Industrial Internet face challenges in log semantic representation, low parsing efficiency, high computational complexity of high-dimensional vectors, semantic bias due to word order loss, and inability to effectively detect abnormal behavior.

Method used

By embedding both semantic and location information into the log template, representative words are extracted and encoded to form semantic feature vectors and location feature vectors, which are then concatenated into a representation vector. This is used to train an anomaly detection classifier and optimize the model to improve detection accuracy.

Benefits of technology

It achieves fast log parsing, reduces computational complexity, preserves semantic information, and improves the accuracy and efficiency of abnormal behavior detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118094432B_ABST
    Figure CN118094432B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of log mining, and discloses an industrial internet abnormal behavior detection method and system, which comprises the following steps: reading multiple records from an industrial internet log file, taking the read data as a log sample and obtaining label data; analyzing the log sample to extract a log template; extracting representative words from the log template, respectively performing semantic information coding and position information coding on the representative words, and obtaining a semantic feature vector and a position feature vector; splicing the semantic feature vector and the position feature vector to obtain a representation vector containing position information and semantic information; training an abnormality detection classifier based on the representation vector and the label data; optimizing the classifier using a verification set, evaluating the classification model using a test set, and optimizing the model according to the evaluation result to obtain higher accuracy. The application realizes the effects of fast log analysis, simplified representation vector, low calculation complexity and high information mining degree, and helps to improve the safety operation and maintenance of the industrial internet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of log mining technology, specifically to a method and system for detecting abnormal behavior in the industrial internet based on log mining. Background Technology

[0002] Log data serves as a primary data source for anomaly detection in the Industrial Internet, but its semantic representation remains a challenge when conducting automated security analysis. Log mining aims to study semantic representation learning methods based on massive log data, applying technologies such as natural language processing and machine learning to extract system behavioral information features from log data, providing accurate data support for anomaly detection tasks.

[0003] Anomaly detection, aimed at discovering abnormal behavior, plays a crucial role in the security operations and maintenance of the Industrial Internet. Logs are one of the most valuable data sources for anomaly detection. Currently, some log parsing methods only perform well on specific log datasets; as the dataset size increases, parsing efficiency decreases. Anomaly detection based on log semantics has attracted widespread attention. Existing methods based on maintaining word order by concatenating all word vectors may result in high computational costs; while methods based on weighted aggregation of all word vectors may lose semantic relationships of word order, confusing the semantics of two logs with the same words but different word orders, thus failing to maintain a unique representation. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a method and system for detecting abnormal behavior in the industrial internet based on log mining. It has the advantages of fast log parsing, concise representation vectors with low computational complexity, and high information mining efficiency. It solves the problems of low efficiency in automated log analysis, high computational complexity of high-dimensional vectors, and semantic bias caused by word order loss, thus helping to improve the security operation and maintenance of the industrial internet.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] An industrial internet abnormal behavior detection method includes:

[0007] Step 1: Read multiple records from the industrial internet log file, treat each line of data as a log sample, and extract tag data from each line of data;

[0008] Step 2: Parse the log sample to extract the log template;

[0009] Step 3: Extract representative words from the log template, and encode the semantic information and positional information of the representative words to obtain semantic feature vectors and positional feature vectors respectively;

[0010] Step 4: Concatenate the semantic feature vector and the location feature vector to obtain a representation vector containing location information and semantic information. The representation vector is used to represent the log template.

[0011] Step 5: Train an anomaly detection classifier based on the representation vector and the label data;

[0012] Step 6: Optimize the anomaly detection classifier using the validation set, evaluate the optimized anomaly detection classifier using the test set, and optimize the model again based on the evaluation results to obtain an anomaly detection classification model with higher accuracy. The anomaly detection classification model is used to detect abnormal behavior in the industrial internet.

[0013] Accordingly, this invention also proposes an industrial internet abnormal behavior detection system, which includes:

[0014] The log sample acquisition module is used to read multiple records from industrial internet log files, treat each line of data as a log sample, and extract tag data from each line of data;

[0015] The log template extraction module is used to parse the log sample and extract the log template;

[0016] The semantic and positional dual embedding module is used to extract representative words from the log template, and to encode the representative words with semantic information and positional information respectively, thereby obtaining semantic feature vectors and positional feature vectors respectively.

[0017] The representation vector acquisition module is used to concatenate the semantic feature vector and the position feature vector to obtain a representation vector containing position information and semantic information. The representation vector is used to characterize the log template.

[0018] The classifier training module is used to train an anomaly detection classifier based on the representation vector and the label data;

[0019] The optimization and evaluation module is used to optimize the anomaly detection classifier using a validation set, evaluate the optimized anomaly detection classifier using a test set, and further optimize the model based on the evaluation results to obtain an anomaly detection classification model with higher accuracy. The anomaly detection classification model is used to detect abnormal behavior in the industrial internet.

[0020] Compared with existing technologies, the present invention provides a method and system for detecting abnormal behavior in the industrial internet, which has the following beneficial effects:

[0021] 1. Fast log parsing is achieved through template similarity. First, the collected multi-source industrial internet logs are preprocessed. Then, the similarity between log templates is calculated using a text similarity algorithm to obtain a set of similar log templates to be merged. Log templates with similar structures are merged to obtain the final log template, thus achieving the effect of fast log parsing based on template similarity.

[0022] 2. By extracting multiple verbs and nouns from a log template as representative words, and transforming the representative words, the verb word vectors and noun word vectors are sequentially combined to form a sequence vector. Then, the semantic feature vector obtained by connecting the sequence vectors is used to represent the entire log template. This reduces the computational complexity of subsequent analysis tasks. First, the log template is segmented and labeled with parts of speech. Then, by extracting representative words, the main entities of semantic composition are preserved. And the semantic information in the log is represented by a concise vector with approximately lossless performance. This achieves the effect of concise representation vector and low computational complexity.

[0023] 3. By mapping binary ordered coordinates representing location information to the relative position feature vectors representing words in the log template, the final representation vector with correct word order is ensured. First, the first and last words in the log template are labeled. The distances of each word to the first and last words are marked using binary tuples, and these distances are represented as ordered pairs, providing the relative positions of words in the log template. This achieves high information mining efficiency, ensures correct word order through location information embedding, reduces the impact of semantic confusion caused by incorrect word order, and thus improves the accuracy of abnormal behavior detection in the Industrial Internet. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of the industrial internet abnormal behavior detection method according to an embodiment of the present invention;

[0025] Figure 2 This is a flowchart illustrating the process of dual embedding of semantic and location information in this invention;

[0026] Figure 3 This is a schematic diagram of the log parsing method in this invention;

[0027] Figure 4 This is a schematic diagram of the process for obtaining the initial log template in this invention;

[0028] Figure 5 This is a schematic diagram of the process for selecting log templates with similar structures in this invention;

[0029] Figure 6 This is a schematic diagram of the process of obtaining the final log template using the longest common subsequence method in this invention;

[0030] Figure 7 This is a schematic diagram of the process for obtaining word vectors in this invention;

[0031] Figure 8 This is a schematic diagram of the process for obtaining sequence vectors in this invention;

[0032] Figure 9 This is a schematic diagram of the overall framework of the present invention. Detailed Implementation

[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0034] Please see Figure 1 A method for detecting abnormal behavior in the industrial internet based on log mining, comprising:

[0035] In step 1, multiple records are read from an industrial internet log file. Each line of data is taken as a log sample and tag data is extracted from each line of data. The tag data characterizes whether the network behavior corresponding to the log sample is abnormal.

[0036] In step 2, the raw log typically includes log level, time, process, thread, module tag, session, and detailed log content. These fields represent the time the log occurred, which task of which program it belonged to, the type of operation, the session identifier name, and the detailed log content. The detailed log content is the focus, i.e., the log event section. Log events consist of constants and variables. Constants are a series of words that represent system activity and have corresponding semantics; these are words written by developers in the log recording statements. Variables are parameters that carry dynamic runtime information and do not contain semantics. Log parsing automatically converts the log events of each log sample into a specific log template by removing parameters and retaining keywords. That is, it parses the log sample to extract the log template, converting the semi-structured log sample into a structured log template.

[0037] In step 3, all words in the log template extracted in step 2 are filtered to extract representative words. The purpose of filtering words in the log messages is to extract useful information, reduce noise, and simplify the representation of the log template. The specific reasons are as follows: First, it reduces dimensionality: Log message samples may contain a large amount of information, some of which may not be important for anomaly detection. By filtering words, the dimensionality of features can be reduced, making the model more efficient. Second, it eliminates noise: Log message samples may contain some irrelevant information or noise, such as identifiers for specific requests. By filtering words, this information, which is irrelevant to anomaly detection, can be excluded. Third, it simplifies model training: By selecting only words related to anomaly behavior, the model training process can be simplified, training efficiency improved, and the model can better capture the key features of network anomaly behavior. Fourth, it improves generalization performance: By retaining only words related to anomaly behavior, the model is more likely to generalize in different scenarios without relying too much on specific words or contexts. Therefore, this invention encodes the semantic information of representative words in the log template to obtain semantic feature vectors.

[0038] In log data, log messages may contain the same words, but the order of these words can lead to different semantics. This can happen in event descriptions within logs, especially when event details are organized differently. For example, in the following two log statements, the same words in different orders result in different semantics: "Storage interrupt caused by input errors" and "Input errors caused by storage interrupt." Although both log statements use the same words (Storage, Interrupt, Input, Errors), their different order conveys different meanings: in the first log, the main information is a storage interrupt caused by input errors; in the second log, the main information is input errors caused by a storage interrupt. These two examples demonstrate that even when using the same words, the relative position and context of the words can lead to semantic differences in logs. When processing this type of log, it is necessary to ensure that the model can consider word position information in order to correctly understand and distinguish events with different semantics. The relative position representation method of words in the log template can help the model better capture this positional information and improve its ability to understand log statements. Therefore, this invention also encodes the relative positional information of representative words in the log template to obtain positional feature vectors. The specific implementation of step 3, which involves dual embedding of semantic and positional information in the log template, is described in [the following text is incomplete and requires further context]. Figure 2 The details were shown in the document.

[0039] In step 4, the semantic feature vector and the location feature vector obtained in step 3 are concatenated to obtain a representation vector containing both location and semantic information. This representation vector is used to characterize the log template. When concatenating the semantic feature vector and the location feature vector, the semantic feature vector is concatenated first, followed by the location feature vector.

[0040] In step 5, an anomaly detection classifier is trained based on the representation vectors and label data of the log template. This anomaly detection classifier is a model used to perform classification tasks on records in the log file based on semantic information extracted by the encoder. Examples include the softmax model, or some machine learning classification methods such as decision trees, support vector machines, and Naive Bayes.

[0041] In step 6, the anomaly detection classifier obtained in step 5 is optimized using the validation set, and the optimized anomaly detection classifier is evaluated using the test set. Based on the evaluation results, the model is optimized again to obtain an anomaly detection classification model with higher accuracy. This anomaly detection classification model is used to detect abnormal behavior in the industrial internet.

[0042] Please see Figure 3 The image is Figure 1 The flowchart corresponding to step 2 shows that the log template is extracted from the log sample based on the following steps:

[0043] Step 21: Distinguish the variables contained in the log samples through log preprocessing, and use regular expressions to match and replace log variables to obtain a preliminary log template. The specific implementation of step 21 is detailed in... Figure 4 specific display;

[0044] Step 22: Based on the initial log templates, use a text similarity model to filter the log template index set with similar structures. The specific implementation of step 22 is detailed in... Figure 5 specific display;

[0045] Step 23: Based on a log template index set with similar structures, obtain the final log template using the longest common subsequence method. The specific implementation of step 23 is detailed in... Figure 6 shown in detail.

[0046] Please see Figure 4 In step 21, the process of distinguishing variables contained in the log through log preprocessing and using regular expressions to match and replace log variables to obtain a preliminary log template is based on the following steps:

[0047] Step 211: Extract log events from the raw log, where log events are the detailed printed content of the log;

[0048] Step 212: Using regular expressions, replace the variables in the log events obtained in Step 211 with constants of a fixed format. This invention performs fine-grained preprocessing on the log message samples during the preprocessing stage to reduce the workload of subsequent parsing. It prioritizes processing variables of a fixed format, then processes variables containing numbers. Some variables of a fixed format are replaced with specified constants to avoid errors in template extraction caused by different variables represented by the same identifier. For example, IP addresses are replaced with identifiers... <ip>Replace it with an identifier for the website domain. <url>Replace with an identifier for the file path. <path>To replace; for file paths and websites containing the same punctuation marks ' / ' and '-', first use the website-specific top-level domain to determine if the string is a website, then determine if it is a file path, and finally use a uniform identifier to replace variables that contain only numbers and have no other semantics.

[0049] Step 213: In this step, the processed log events and log indexes are saved as <log:index> key-value pairs, generating a hash table of logs = {log:1log2:2,log:3,…,logn:n}. From the logs with completed variable processing, it can be seen that there is a large amount of duplicate data. By removing duplicate logs, the number of remaining logs can be reduced to 1 / 10000 of the original number. Therefore, based on the replaced log events obtained in Step 212, the log data is deduplicated to obtain a preliminary log template. Taking the HDFS dataset as an example, after performing the above operations, only 54 logs remain. At this point, the size of the object from which the log template is to be extracted is reduced from 10 million to 54, greatly reducing the computational complexity of template extraction. These few dozen logs can be called the preliminary log template.

[0050] Please see Figure 5 In step 22, the selection of a log template index set with structural similarity based on the initial log template using a text similarity model is obtained through the following steps:

[0051] Step 221: Use the <log:index> key-value pairs obtained in step 213 above as the corpus for training the TF-IDF model, and train the text similarity based on TF-IDF, where TF is the term frequency, used to calculate the frequency of occurrence of the target word in the corpus, and IDF is the inverse text frequency, which is a measure of the general importance of the target word.

[0052] Step 222: After completing the training of the TF-IDF model, calculate the text similarity between the current log event and the deduplicated logs in the corpus based on the trained text similarity model obtained in Step 221 above. The obtained text similarity is a decimal between 0 and 1. When the contents of two logs are exactly the same, the text similarity is equal to 1.

[0053] Step 223: By setting an appropriate text similarity threshold, a set of log indexes that meet the merging criteria is selected based on the set text similarity threshold. The log index set is obtained from the established key-value pairs. This set is a multi-element set, which can be regarded as a tuple. Using permutation and combination, all pairs in the set are traversed. That is, log templates are extracted from only two logs at a time. Log templates with text similarity higher than the threshold are judged as structurally similar log templates, and a set of structurally similar log template indexes to be merged is generated. For example, if the text similarity threshold is set to 0.75, it can be seen intuitively that the log content is extremely similar and effective log templates can be extracted from it.

[0054] Please see Figure 6 In step 23, the final log template is obtained by using the longest common subsequence method based on a set of log template indexes with similar structures, based on the following steps:

[0055] Two log templates to be merged are obtained from the set of log templates with similar structures to be merged obtained in step 223 above, and the following judgment is made:

[0056] If the log templates have the same length, the `split()` method is used to convert each log template into an array, with each word as an element. For example, with lengths of log1 and log2, this generates two arrays: `array1 = [a1, a2, a3]` and `array2 = [b1, b2, b3]`. If most elements in the arrays are the same, for this type of log, the array indices where the differences are found are first identified, and then the word at that position is replaced with a unique identifier `<*>`, while the other positions remain unchanged to create the final log template.

[0057] If the log templates have different lengths, it is determined whether there is a subsequence relationship between the log templates to be merged. If a subsequence relationship exists, the second log template is an expansion of the content of the first log template, and this is considered the longest common subsequence. , The common subsequences extracted by LCS are the final log template;

[0058] If the log templates have different lengths and there is no subsequence relationship, this often occurs in two long log templates. The LCS algorithm treats each letter as an element rather than each word in the log, so the result of LCS should not be used directly as a log template. Therefore, the result of intersecting the arrays obtained by the split() method is used as the final result. Finally, the preprocessed log-log template key-value pairs are constructed. When a new log arrives, the corresponding final log template can be quickly obtained after preprocessing.

[0059] In step 3, representative words are extracted from the log template, and semantic information and positional information are encoded for each representative word to obtain semantic feature vectors and positional feature vectors. This is based on the following steps:

[0060] Step 31: Perform part-of-speech tagging on the words in the log template, extracting verbs and nouns as representative words. Use a pre-trained word vector model to convert the representative words into corresponding word vectors. Through word segmentation and part-of-speech tagging, a more detailed grammatical analysis of the log template can be obtained, providing a foundation for subsequent semantic information extraction. This process of word segmentation and part-of-speech tagging helps to understand the structure of the log template, making further processing of the words in the template more accurate and meaningful. Verbs and nouns are usually keywords contained in log information. They carry a lot of semantic information about operations, events, or states. Extracting these main entities helps to capture the main meaning of the log information. The process of extracting verbs and nouns is to obtain key semantic information from the log information. The specific implementation of step 31 is as follows: Figure 7 specific display;

[0061] Step 32: Based on the word vectors representing the words obtained in Step 31, the verb word vectors and the first noun word vector following them are sequentially combined to form sequence vectors, resulting in multiple sequence vectors. The encoder is then called to encode these sequence vectors, yielding multiple sequence vectors representing the relationships between words. This step, by concatenating the extracted verb and noun word vectors to form sequence vectors, aims to capture the semantic relationships between key actions and objects in the logs. Such sequence vectors not only provide a more comprehensive understanding of the log information but also serve as input to the encoder in network anomaly detection methods, helping the encoder capture the sequence information between these representative words and generate more meaningful semantic representation vectors, thereby improving the model's performance in training and evaluation. The specific implementation of Step 32 is detailed in... Figure 8 specific display;

[0062] Step 33: Use average pooling to concatenate multiple sequence vectors of a log template to obtain the semantic feature vector of the log template. Average pooling is a way to integrate sequence information. Multiple sequence vectors may have different lengths, but average pooling can adjust their dimensions to the same length, making it easier to connect them. This helps to represent the semantic information of the entire log template in a lower-dimensional space, making it easier to pass to the subsequent classifier. In addition, by considering the average of multiple sequence vectors, the average pooling operation can capture the semantic information of the entire log template. This holistic representation helps the model better understand the overall log information, rather than just focusing on certain segments.

[0063] Step 34: Tag the first and last words in the log template. This can be done using methods such as part-of-speech tagging. The purpose is to determine the start and end positions in the log template.

[0064] Step 35: For each verb and noun extracted in Step 31, which is the main semantic entity of a log template, calculate its distance from the first and last words based on the start and end tags in Step 34 above, and represent the distance as an ordered pair. For example, for a verb, its distance from the first word is n and its distance from the last word is m, which is represented as an ordered pair (n, m). This representation provides the relative position information of the main entity in the log template. Therefore, use tuples to mark the distance of words from the first and last words and represent them as ordered pairs to provide the relative position of the representative words in the log template.

[0065] Step 36: Based on the relative position information of the representative words obtained in Step 35 above, call the encoder to perform encoding processing to obtain the position feature vector of the representative words. The encoder can be any model suitable for sequence data, such as recurrent neural network (RNN), long short-term memory network (LSTM), gated recurrent unit (GRU), etc. The purpose of this step is to use the encoder to capture the sequence relationship between some words, obtain the relative position feature vector of the main entities, ensure word order, and reduce the impact of semantic confusion caused by word order errors.

[0066] Please see Figure 7 In step 31, the words in the log template are tagged with part-of-speech tags, and verbs and nouns are extracted as representative words. The representative words are then converted into corresponding word vectors using a pre-trained word vector model. This is achieved through the following steps:

[0067] Step 311: The process of segmenting and tagging each log template aims to better understand the grammatical roles of each word in the log template, thereby extracting the main entities that express the semantics of the log event. Segmentation divides the text in the log template into individual words or tokens, which helps identify the basic units in the template and makes subsequent part-of-speech tagging more accurate. For the splitting of compound words, a dictionary is used to match the components of the compound word. If the components of the compound word exist in the dictionary, it can be split. For example, a dictionary containing common words can be applied, and the splitting can take into account word form changes, tense, etc. Part-of-speech tagging assigns a corresponding part-of-speech tag to each word, identifying its grammatical role in the sentence structure. Common parts of speech include nouns, verbs, adjectives, etc. Part-of-speech tagging can be performed using natural language processing tools or libraries, such as NLTK (Natural Language Toolkit) or Stanford. NLP provides ready-made part-of-speech tagging capabilities, automatically tagging each word with its part of speech, including verbs and nouns. Part-of-speech tagging helps to understand the grammatical function of each word in the log template in more detail; when dealing with a word that has multiple parts of speech, the context information is considered as needed and one of the main parts of speech is selected.

[0068] Step 312: Iterate through the part-of-speech tagging results obtained in Step 311, and extract verbs and nouns based on the part-of-speech tags. The part-of-speech tags of verbs start with "VB", while the part-of-speech tags of nouns start with "NN". For example, "VB" represents verbs, such as "VB", "VBD" (past tense), "VBG" (gerund), "VBN" (past participle), etc., while "NN" represents nouns, such as "NN", "NNS" (plural form), "NNP" (proper noun), "NNPS" (plural form of proper noun), etc. Filter the extracted verbs and nouns to remove stop words, i.e., common words that do not contribute much to the overall semantics. Organize the extracted verbs and nouns to find representative words and mark an appropriate number of main entities for subsequent feature extraction or analysis.

[0069] Step 313: Select a word vector model that has been trained on a large-scale corpus, such as Word2Vec, GloVe, or FastText. These models learn word vector representations by analyzing word co-occurrence patterns in large amounts of text data. By converting words into dense vectors, the model can understand the semantic meaning of words and map words into vector space. Load the selected pre-trained word vector model using the appropriate library. Different models may have different loading methods, and usually provide corresponding APIs. Then, using the representative words extracted in Step 312, use the pre-trained word vector model to convert the representative words into corresponding word vectors, and organize the converted word vectors into an appropriate data structure for subsequent processing and analysis.

[0070] Please see Figure 8 In step 32, based on the word vectors obtained in step 31, the verb word vectors and the first noun word vector following them are sequentially combined to form sequence vectors, resulting in multiple sequence vectors. The encoder is then used to encode the sequence vectors to obtain multiple sequence vectors representing the relationships between words. This is achieved through the following steps:

[0071] Traverse the part-of-speech tagging results obtained in step 311 to find the verbs in the log template;

[0072] Combine sequence vectors; for each verb, determine whether there is a noun after it. If there is, combine the verb word vector and the noun word vector in sequence to form a new sequence vector; if not, treat the verb word vector as a separate sequence vector; if there is a noun left after concatenation, treat the noun word vector as a separate sequence vector. Then organize the results and arrange the multiple sequence vectors into an appropriate data structure for subsequent processing and analysis.

[0073] The encoder is invoked to encode the concatenated sequence vectors, resulting in multiple sequence vectors representing the relationships between words. In this step, a pre-trained encoder model is used to convert the concatenated sequence vectors into sequence vectors representing the relationships between words. The encoder is used to extract deep semantic information from the log file, also known as a semantic understanding model. It can read the entire text sequence at once, rather than reading it sequentially from left to right or right to left. All layers of the encoder can capture the contextual information from each left and right side of the target word. Common encoders include BERT, BiBERT, LSTM, etc. The encoder is used to encode the multiple sequence vectors obtained, aiming to capture the semantic relationships between key actions and objects in the log. The encoder in this step can be a recurrent neural network (RNN), a long short-term memory network (LSTM), a gated recurrent unit (GRU), etc., to capture the sequence information between vectors.

[0074] Please see Figure 9 This figure is a detailed overall framework flowchart of the present invention, including:

[0075] First, historical logs are obtained, and then the logs are parsed to form a log template that can represent system activities and some variables that carry dynamic runtime information. Next, semantic information embedding is performed. First, the words in the log template are tagged with parts of speech. Verbs and nouns are extracted from the tagged words as representative words of the log template, and these representative words are embedded. Then, the verbs and the nouns following the verbs in the log template are concatenated to form a sequence vector. Thus, a log template can generate one or more sequence vectors, which are then encoded. Finally, the sequence vectors are averaged to obtain the semantic feature vector of the log template. This achieves the representation of the log template with a concise vector. Next, word position information embedding is performed. First, the first and last words in the log template are tagged. Then, the distances of the representative words to the first and last words are calculated, forming a pair and encoded as a position feature vector. This achieves the embedding of correct word order information and reduces the impact of semantic bias caused by word order loss. Next, the semantic feature vector and the position feature vector are concatenated, and the constructed vector is mapped to an input vector acceptable to the model. Finally, the classifier is trained using the training set and tested using the test set. The classifier is iteratively trained based on whether the loss function of the classification model converges until convergence, at which point the model training ends.

[0076] The working principle of this invention is as follows: First, multiple records are read from at least one log file, with each line of data treated as a log sample, and label data is obtained. Next, the log samples are parsed to extract log templates. During the extraction process, log preprocessing is used to distinguish variables contained in the log samples, and regular expressions are used to match and replace log variables to obtain preliminary log templates. Then, a text similarity model is used to filter log templates with similar structures, and the longest common subsequence method is used to obtain the final log template. Next, semantic and positional information are dual-embedded into the log templates. Specifically, semantic information is encoded for representative words in the log templates, including part-of-speech tagging and using a pre-trained word vector model to convert representative words into word vectors. The first noun after a verb is concatenated to form a combined sequence and encoded. Finally, average pooling is used to concatenate multiple sequence vectors of a log template to form a semantic feature vector of the log template. Simultaneously, relative positional information is encoded for representative words, labeling the first and last words, calculating the distances of the extracted representative words to the first and last words, forming tuples, and obtaining positional feature vectors through an encoder. These two feature vectors are concatenated to form a representation vector containing both location and semantic information. Finally, this vector is used to train a classifier and labeled data, resulting in a trained classifier. The classifier is optimized using a validation set and evaluated using a test set. Based on the evaluation results, the model is further optimized to achieve higher accuracy. The entire method combines semantic and location information, leveraging log mining to detect and classify abnormal behavior.

[0077] This invention also provides an industrial internet abnormal behavior detection system, which includes:

[0078] The log sample acquisition module is used to read multiple records from industrial internet log files, treat each line of data as a log sample, and extract tag data from each line of data;

[0079] The log template extraction module is used to parse log samples and extract log templates.

[0080] The semantic and positional dual embedding module is used to extract representative words from the log template, and to encode the semantic information and positional information of the representative words to obtain semantic feature vectors and positional feature vectors respectively.

[0081] The representation vector acquisition module is used to concatenate the semantic feature vector and the location feature vector to obtain a representation vector containing location information and semantic information. This representation vector is used to characterize the log template.

[0082] The classifier training module is used to train an anomaly detection classifier based on representation vectors and label data.

[0083] The optimization and evaluation module is used to optimize the anomaly detection classifier using a validation set, evaluate the optimized anomaly detection classifier using a test set, and further optimize the model based on the evaluation results to obtain an anomaly detection classification model with higher accuracy. This anomaly detection classification model is used to detect abnormal behavior in the industrial internet.

[0084] The specific implementation methods of each module in the industrial internet abnormal behavior detection system of this embodiment can refer to the implementation methods described in the above embodiment of the industrial internet abnormal behavior detection method, and will not be repeated here.

[0085] The industrial internet abnormal behavior detection method and system proposed in this invention achieves rapid log parsing based on template similarity. First, the collected multi-source logs are preprocessed. Then, the similarity between log templates is calculated using a text similarity algorithm to obtain a set of similar log templates to be merged. Log templates with similar structures are merged to obtain the final log template, thereby achieving the effect of rapid log parsing based on template similarity.

[0086] This industrial internet abnormal behavior detection method and system extracts multiple verbs and nouns from a log template as representative words. After transforming the representative words, the verb word vectors and noun word vectors are sequentially combined to form a sequence vector. Then, the semantic feature vector obtained by connecting the sequence vectors replaces the entire log template for representation. This reduces the computational complexity of subsequent analysis tasks. First, the log template is segmented and labeled with parts of speech. Then, by extracting representative words, the main entities of semantic composition are preserved. And the semantic information in the log is represented by a concise vector with approximately lossless accuracy, thereby achieving the effect of reducing computational complexity.

[0087] This industrial internet abnormal behavior detection method and system ensures the correct word order by mapping binary ordered coordinates representing location information to the relative position feature vectors of some words in the log template. First, the first and last words in the log statement are labeled. The distances of each word to the first and last words are marked using binary tuples, and these distances are represented as ordered pairs to provide the relative positions of words in the log template. This dual embedding of semantic and positional information guarantees correct word order and semantic approximation without bias, reducing the impact of semantic confusion caused by incorrect word order.

[0088] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0089] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.< / path> < / url> < / ip>

Claims

1. A method for detecting abnormal behavior in the industrial internet, characterized in that, include: Step 1: Read multiple records from the industrial internet log file, treat each line of data as a log sample, and extract tag data from each line of data; Step 2: Parse the log sample to extract the log template; Step 3: Extract representative words from the log template, and encode the semantic information and positional information of the representative words to obtain semantic feature vectors and positional feature vectors respectively; Step 4: Concatenate the semantic feature vector and the location feature vector to obtain a representation vector containing location information and semantic information. The representation vector is used to represent the log template. Step 5: Train an anomaly detection classifier based on the representation vector and the label data; Step 6: Optimize the anomaly detection classifier using the validation set, evaluate the optimized anomaly detection classifier using the test set, and optimize the model again based on the evaluation results to obtain an anomaly detection classification model with higher accuracy. The anomaly detection classification model is used to detect abnormal behavior in the industrial internet. Step 3 includes the following steps: Step 31: Tag the words in the log template with part-of-speech tags, extract the verbs and nouns as representative words, and use a pre-trained word vector model to convert the representative words into corresponding word vectors; Step 32: Combine the verb word vector and the first noun word vector that follows it in sequence to form a sequence vector, resulting in multiple sequence vectors. Call the encoder to encode the sequence vectors to obtain multiple sequence vectors that represent the relationship between words. Step 33: Use average pooling to concatenate multiple sequence vectors of a log template to obtain the semantic feature vector of the log template; Step 34: Mark the first and last words in the log template respectively; Step 35: Use tuples to represent the distances of the representative word from the first and last words, and represent them as ordered pairs to provide information about the relative position of the representative word; Step 36: Based on the relative position information of the representative word, call the encoder to perform encoding processing to obtain the position feature vector of the representative word.

2. The method for detecting abnormal behavior in the industrial internet according to claim 1, characterized in that, Step 2 includes the following steps: Step 21: By preprocessing the logs, we can distinguish the variables contained in the log samples and use regular expressions to match and replace the log variables to obtain a preliminary log template. Step 22: Based on the preliminary log templates, use a text similarity model to filter the log template index set with similar structures; Step 23: Based on the log template index set with similar structure, obtain the final log template through the longest common subsequence method.

3. The method for detecting abnormal behavior in the industrial internet according to claim 2, characterized in that, Step 21 includes the following steps: Extract log events from the raw logs; Using regular expressions, the variables in the log events are replaced with constants in a fixed format; Based on the replaced log events, the log data is deduplicated to obtain a preliminary log template.

4. The method for detecting abnormal behavior in the industrial internet according to claim 2, characterized in that, Step 22 includes the following steps: The constructed <log:index> key-value pairs are used as the corpus for training the TF-IDF model, and a TF-IDF-based text similarity model is trained. The text similarity between the log events and the deduplicated logs in the corpus is calculated based on the trained text similarity model. Log templates with text similarity higher than a threshold are identified as structurally similar log templates, and a set of similar log template indexes to be merged is generated.

5. The method for detecting abnormal behavior in the industrial internet according to claim 2, characterized in that, Step 23 includes the following steps: Obtain two log templates to be merged and perform the following checks: If the log templates are of the same length, use the uniform identifier <*> instead of the variable as the final log template; If the log templates have different lengths and there is a subsequence relationship, the common subsequence extracted by LCS will be used as the final log template. If the log templates have different lengths and there is no subsequence relationship, the intersection of the words in the two logs is taken as the final log template.

6. The method for detecting abnormal behavior in the industrial internet according to claim 1, characterized in that, Step 31 includes the following steps: Each log template is segmented and tagged with parts of speech. Iterate through the part-of-speech tagging results and extract verbs and nouns as representative words based on the part-of-speech tags; The representative words are converted into corresponding word vectors based on the pre-trained word vector model.

7. The method for detecting abnormal behavior in the industrial internet according to claim 1, characterized in that, Step 32 includes the following steps: Find the verbs in the log template; If a verb is followed by a noun, the verb word vector and the noun word vector are combined sequentially to form a sequence vector; if there is no noun after the verb, the verb word vector is treated as a separate sequence vector; if a noun remains after concatenation, the noun word vector is treated as a separate sequence vector. The encoder is invoked to encode the concatenated sequence vectors, resulting in multiple sequence vectors that represent the relationships between words.

8. An industrial internet abnormal behavior detection system, characterized in that, include: The log sample acquisition module is used to read multiple records from industrial internet log files, treat each line of data as a log sample, and extract tag data from each line of data; The log template extraction module is used to parse the log sample and extract the log template; A semantic and positional dual embedding module is used to extract representative words from the log template, and to encode semantic information and positional information for the representative words to obtain semantic feature vectors and positional feature vectors, respectively. Specifically, this includes: The words in the log template are tagged with part-of-speech tags, and the verbs and nouns are extracted as representative words. The representative words are then converted into corresponding word vectors using a pre-trained word vector model. The verb word vector and the first noun word vector following it are sequentially combined to form a sequence vector, resulting in multiple sequence vectors. The encoder is then called to encode the sequence vectors to obtain multiple sequence vectors that represent the relationships between words. Average pooling is used to concatenate multiple sequence vectors of a log template to obtain the semantic feature vector of the log template. Mark the first and last words in the log template separately; Use tuples to represent the distances of a word from the first and last words, and represent them as ordered pairs to provide information about the relative positions of the words. Based on the relative position information of the representative words, the encoder is invoked to perform encoding processing to obtain the position feature vector of the representative words; The representation vector acquisition module is used to concatenate the semantic feature vector and the position feature vector to obtain a representation vector containing position information and semantic information. The representation vector is used to characterize the log template. The classifier training module is used to train an anomaly detection classifier based on the representation vector and the label data; The optimization and evaluation module is used to optimize the anomaly detection classifier using a validation set, evaluate the optimized anomaly detection classifier using a test set, and further optimize the model based on the evaluation results to obtain an anomaly detection classification model with higher accuracy. The anomaly detection classification model is used to detect abnormal behavior in the industrial internet.

Citation Information

Patent Citations

  • Log anomaly detection method and system fusing BERT feature coding and variant Transform

    CN116450393A

  • Log analysis method and device, equipment and storage medium

    CN116822491A