Alarm log compression method and device, equipment and storage medium
The twin neural network model is used to process alarm logs, which solves the problems of poor alarm log compression robustness and reliance on human experience in the existing technology, and achieves efficient and accurate alarm log compression.
Patent Information
- Application Number
- CN202410076826.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-18
- Publication Date
- 2024-10-18
AI Technical Summary
Existing alarm log compression solutions have poor robustness and rely on human experience, resulting in the inability to fully discover the similarities between alarms, inaccurate matching results, and low compression efficiency.
Use the twin neural network model to determine the alarm type by obtaining the alarm time, source IP address, destination IP address and destination port of the alarm log, build a prediction matrix, input the data similarity matching model, calculate the similarity value, and add the alarm type label Perform compression.
Without the participation of experts, the constructed prediction matrix can contain the difference information of all rules in the rule base. The model has strong generalization ability, which improves the accuracy and efficiency of alarm log compression.
Smart Images

Figure CN118796595A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an alarm log compression method, device, equipment and storage medium. Background Art
[0002] With the development of informatization, many portal websites and business systems have been suffering from continuous attacks. In order to protect the security of system data, portal websites generally use security equipment to protect against network attacks.
[0003] In order to facilitate the subsequent statistical update, the security equipment will continue to record the attacks suffered by the system during the attack protection period and report them to the operation and maintenance personnel in the form of alarm logs. However, since many attacks are repeated attacks of the same type and the attack frequency is very high, this greatly increases the burden on the operation and maintenance personnel, and in the massive alarm logs, the operation and maintenance personnel are prone to overlook important alarms.
[0004] To address the above issues, the commonly used alarm log processing methods are mainly the following:
[0005] Method 1, clustering: This method mainly extracts the features of specified fields and uses algorithm clustering on the extracted data to reduce the number of duplicate logs.
[0006] However, the problem with this method is that a complete clustering model can only be trained when the amount of data is large enough and the types of data are well covered. In addition, since this method is trained on existing experience to obtain the model, when variant alarms appear, it will have poor robustness, that is, it will miss the alarm.
[0007] Method 2, preset rules: This method specifies the relationship between alarm types and compression rules, and selects compression rules for alarm data according to its alarm type based on the preset relationship to achieve compression of alarms.
[0008] The problem with this method is that the preset rules need to be set by human experience, and experience varies from person to person, and sometimes human experience is incomplete, and it is impossible to fully discover the similarities between alarms. It can only use the rules of a single type of alarm, and it is impossible to discover the differences between different alarm type combinations. In addition, the preset rules can only match alarms that meet the rules, which is a "hard match" and does not have generalization capabilities.
[0009] It can be seen that there is an urgent need for a method that can efficiently and accurately compress alarm data. Summary of the invention
[0010] The embodiment of the present application provides an alarm log compression method to solve the problem that the existing alarm log compression scheme has poor robustness and mainly relies on human experience when matching alarm logs, resulting in inability to fully discover the similarities between alarms, which in turn leads to inaccurate matching results and low compression efficiency.
[0011] The embodiment of the present application also provides an alarm log compression device to solve the problem that the existing alarm log compression scheme has poor robustness and mainly relies on human experience when matching alarm logs, resulting in an inability to fully discover the similarities between alarms, which in turn leads to inaccurate matching results and low compression efficiency.
[0012] The embodiment of the present application also provides an alarm log compression device to solve the problem that the existing alarm log compression scheme has poor robustness and mainly relies on human experience when matching alarm logs, resulting in an inability to fully discover the similarities between alarms, which in turn leads to inaccurate matching results and low compression efficiency.
[0013] The embodiment of the present application also provides a computer-readable storage medium to solve the problem that the existing alarm log compression scheme has poor robustness and mainly relies on human experience when matching alarm logs, resulting in an inability to fully discover the similarities between alarms, which in turn leads to inaccurate matching results and low compression efficiency.
[0014] The present application embodiment adopts the following technical solutions:
[0015] A method for compressing an alarm log, comprising: obtaining a first alarm log, wherein the alarm fields carried by the first alarm log include at least one of the following: alarm time, source IP address, destination IP address, destination port and request header; obtaining an alarm classification list, and judging whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type; when the judgment result is yes, constructing a prediction matrix according to the first alarm log and the alarm type matching the alarm log; inputting the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; adding an alarm type label to the first alarm log according to the similarity value, and compressing the first alarm log according to the alarm type label.
[0016] An alarm log compression device comprises: an alarm log acquisition unit, used to acquire a first alarm log, wherein the alarm fields carried by the first alarm log include at least one of the following: alarm time, source IP address, destination IP address, destination port and request header; an alarm type matching unit, used to acquire an alarm classification list, and judge whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address and the destination port, wherein the alarm classification list includes the alarm type and at least one corresponding to the alarm type. a second alarm data; a prediction matrix construction unit, used to construct a prediction matrix according to the first alarm log and the alarm type matching the alarm log when the judgment result obtained by the alarm type matching unit is yes; a similarity calculation unit, used to input the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; a compression unit, used to add an alarm type label to the first alarm log according to the similarity value, and compress the first alarm log according to the alarm type label.
[0017] An alarm log compression device, comprising:
[0018] A processor; and a memory arranged to store computer executable instructions, which when executed cause the processor to perform the following operations: obtain a first alarm log, wherein the alarm fields carried by the first alarm log include at least one of the following: alarm time, source IP address, destination IP address, destination port and request header; obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list based on the alarm time, the source IP address, the destination IP address and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type; when the judgment result is yes, construct a prediction matrix based on the first alarm log and the alarm type matching the alarm log; input the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; add an alarm type label to the first alarm log based on the similarity value, and compress the first alarm log based on the alarm type label.
[0019] A computer-readable storage medium stores one or more programs, which, when executed by an electronic device including multiple application programs, enable the electronic device to perform the following operations: obtain a first alarm log, wherein the alarm field carried by the first alarm log includes at least one of the following: alarm time, source IP address, destination IP address, destination port and request header; obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address and the destination port, wherein the alarm classification list includes the alarm type and at least one second alarm data corresponding to the alarm type; when the judgment result is yes, construct a prediction matrix according to the first alarm log and the alarm type matching the alarm log; input the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; according to the similarity value, add an alarm type label to the first alarm log, and compress the first alarm log according to the alarm type label.
[0020] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0021] By adopting the alarm log compression method provided in the embodiment of the present application, for the alarm log generated by the system security device, it is first possible to determine whether the alarm type of the alarm log exists in a pre-set alarm classification list based on the alarm time, source IP address, destination IP address and destination port of the alarm log. When the judgment result is yes, a prediction matrix can be further constructed based on the first alarm log and the alarm type matching the first alarm log, and the prediction matrix can be input into a data similarity matching model pre-trained based on the twin neural network model to obtain the similarity value between the first alarm log and the second alarm data output by the data similarity matching model; according to the similarity value, an alarm type label is added to the first alarm log, and according to the alarm type label, the first alarm log is compressed. By adopting the method provided in the embodiment of the present application, when constructing the prediction matrix, the existing knowledge system is fully utilized, and the construction of the prediction matrix is realized without the participation of experts, so that the constructed prediction matrix can contain the difference information of all rules in the rule base, and thus the model trained using this prediction matrix can have the possibility of surpassing all the rules in the rule base; secondly, the data similarity matching model in the embodiment of the present application is constructed based on the idea of twin neural networks. Compared with traditional clustering methods, twin neural networks can learn the difference rules between different data with a small amount of data combination, so the model has a strong generalization ability, thereby improving the accuracy and efficiency of compressing the alarm log. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0023] Figure 1 A schematic diagram of a specific process of an alarm log compression method provided in an embodiment of the present application;
[0024] Figure 2 A schematic diagram of the specific structure of an alarm log compression device provided in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of the specific structure of an alarm log compression device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0027] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0028] An alarm log compression method provided in an embodiment of the present application is used to solve the problem that the existing alarm log compression scheme has poor robustness and mainly relies on human experience when matching alarm logs, resulting in an inability to fully discover the similarities between alarms, which in turn leads to inaccurate matching results and low compression efficiency.
[0029] The executor of the alarm log compression method provided in the embodiment of the present application may be, but is not limited to, at least one of a website server, a security management server, a log management server, a website security protection system, and an alarm data compression management system; in addition, the executor of the method may also be the application (Application, APP) itself running on these servers.
[0030] For ease of description, the following takes the method being performed by an alarm data compression management system as an example to introduce the implementation of the method. It can be understood that the method being performed by an alarm data compression management system is only an exemplary description and should not be understood as a limitation on the method.
[0031] The specific implementation flow diagram of the alarm log compression method provided in this application is as follows: Figure 1 As shown, it mainly includes the following steps:
[0032] Step 11, obtaining the first alarm log;
[0033] In an embodiment of the present application, the alarm data compression management system can access the network security device through the log data collection module and obtain the alarm log generated by the network security device in real time.
[0034] In addition, it should be noted that the alarm log obtained here can be a five-tuple data. The alarm field carried by the alarm log includes five parameters. In one embodiment, the alarm field carried by the alarm log may include but is not limited to the following five types: alarm time, source IP address, destination IP address, destination port and request header.
[0035] The alarm data compression management system can obtain various alarm logs generated by network security devices in real time, and generate a list of alarm logs to be compressed as shown in Table 1 below.
[0036] Table 1 List of alarm logs to be compressed
[0037] index time Source IP Destination IP Destination Port Request Header 1 2021 / 10 / 1 100.1.1.1 100.1.1.10 10 XXXXXXXXXX 2 2021 / 10 / 1 100.1.1.1 100.1.1.10 10 XXXXXXXXXX 3 2021 / 10 / 1 100.1.1.1 100.1.1.10 12 XXXXXXXXXX
[0038] Step 12, obtaining an alarm classification list, and judging whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, source IP address, destination IP address, and destination port of the first alarm log obtained by executing step 11;
[0039] It should be noted here that the alarm log obtained by executing step 11 is subsequently input into the pre-trained data similarity matching model for analysis and calculation, and the data similarity matching model only accepts digital data as input and cannot accept text data. Since the alarm log is text data, the alarm data compression management system will first convert the text alarm log into digital data before performing subsequent operations.
[0040] In one embodiment, the alarm data compression management system can convert text-type alarm logs into digital-type data by the following method, including: using word segmentation technology to perform word segmentation on the request header carried by the first alarm log to obtain a word list corresponding to the request header; performing word vectorization on the word list to obtain a word matrix corresponding to the word list; summing the word matrix and storing the summation result in the field corresponding to the request header.
[0041] In one embodiment, the alarm data compression management system can perform word vectorization according to the "request header" field in the alarm log. First, the request header can be segmented by word segmentation technology to obtain a word list corresponding to the request header; then, the word list obtained can be word vectorized by word vectorization technology. It should be noted that there are many kinds of word vectorization technologies, such as one-hot encoding, bag of words model, TF-IDF, and word embedding model based on deep learning, etc. In the embodiment of the present application, the alarm data compression management system can select a suitable word vectorization technology for word vectorization according to the actual business scenario. The embodiment of the present application does not specifically limit which word vectorization technology is used to vectorize the alarm log. Finally, the alarm data compression management system can perform an averaging operation on the vectors of all words, and store the obtained results in the "request header" field. Taking the alarm log in Table 1 as an example, after the above processing, the alarm data compression management system can generate a list of alarm logs to be compressed after the word vector conversion as shown in Table 2 below.
[0042] Table 2 List of alarm logs to be compressed after word vector conversion
[0043]
[0044]
[0045] In an embodiment of the present application, the alarm data compression management system can generate an alarm classification list based on the existing alarm log, wherein the alarm classification list can include seven parts of data, namely, alarm time, source IP address, destination IP address, destination port, request header characteristics, group label and class label. Among them, the "group label" field is obtained by combining the four fields of alarm time, source IP address, destination IP address and destination port, and the class label is the only field generated in the alarm classification list and is used to distinguish the alarm log category.
[0046] In one implementation, the alarm classification list obtained by the alarm data compression management system may be as shown in Table 3 below.
[0047] Table 3 Alarm classification list
[0048] index time Source IP Destination IP Destination Port Request header characteristics Group Label Class Label 1 2021 / 10 / 1 100.1.1.1 100.1.1.10 10 [1,3,5,10,..,1] 1 1-1 2 2021 / 10 / 1 100.1.1.1 100.1.1.10 10 [1,3,5,10,..,2] 1 1-2 3 2021 / 10 / 1 100.1.1.1 100.1.1.10 10 [1,3,5,10,..,3] 1 1-3 4 2021 / 10 / 1 100.1.1.1 100.1.1.10 11 [1,3,5,10,..,3] 2 2-1
[0049] In an embodiment of the present application, the alarm data compression management system can determine whether each alarm log in the alarm log list to be compressed is in the alarm classification list based on the data in the four fields of alarm time, source IP address, destination IP address and destination port.
[0050] When the judgment result is yes, step 13 is executed, and when the judgment result is no, step 16 is executed.
[0051] Step 13: when the judgment result obtained by executing step 12 is yes, construct a prediction matrix according to the first alarm log and the alarm type matching the first alarm log;
[0052] In one embodiment, the specific implementation method of step 13 may include: selecting second alarm data having the same alarm time, source IP address, destination IP address and destination port as the first alarm log from the alarm types matching the first alarm log; combining the first alarm log with the second alarm data to construct a prediction matrix.
[0053] Specifically, the alarm data compression management system can select all alarm data with the same alarm time, source IP address, destination IP address and destination port as the first alarm log in the alarm classification list, that is, data with the same "group label", and combine the alarm data with the same "group label" in the first alarm log and the alarm classification list in pairs to form a new prediction matrix.
[0054] Still taking the above Tables 2 and 3 as an example, by screening according to the alarm time, source IP address, destination IP address and destination port, the alarm data compression management system can determine that the alarm logs corresponding to "Index 1" and "Index 2" in Table 2 are in the alarm classification list, and then by combining these two alarm logs and the alarm data in the same group in Table 3 in pairs, the prediction matrix corresponding to the two alarm logs is obtained, as shown in Tables 4 and 5 below.
[0055] Table 4 Prediction Matrix-1
[0056] index Feature_N Feature_F Index_F 1 [1,3,5,10,..,1] [1,3,5,10,..,1] 1 2 [1,3,5,10,..,1] [1,3,5,10,..,2] 2 3 [1,3,5,10,..,1] [1,3,5,10,..,3] 3
[0057] Table 5 Prediction Matrix-2
[0058] index Feature_N Feature_F Index_F 1 [1,3,5,10,..,5] [1,3,5,10,..,1] 1 2 [1,3,5,10,..,5] [1,3,5,10,..,2] 2 3 [1,3,5,10,..,5] [1,3,5,10,..,3] 3
[0059] Among them, feature_N is the feature extracted from the data N request header field, feature_F is the feature in the alarm classification list, and index_F is the index of the data in the filter list, so as to find its group label.
[0060] Step 14, inputting the prediction matrix constructed by executing step 13 into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the data similarity matching model;
[0061] Among them, the data similarity matching model is constructed through the twin neural network model.
[0062] In the embodiment of the present application, the alarm data compression management system can train the data similarity matching model according to the following sub-steps, specifically including:
[0063] Sub-step 1401, obtaining historical alarm data;
[0064] The alarm fields carried by the historical alarm data include at least one of the following: alarm time, source IP address, destination IP address, source port, destination port and request header.
[0065] Sub-step 1402, aggregating the historical alarm data according to the preset alarm field to obtain grouped historical alarm data;
[0066] In one embodiment, in order to accelerate the fitting speed of subsequent models and reduce the training time of models, the alarm data compression management system can group and aggregate the historical data obtained by executing sub-step 1401 according to the setting of specified fields and preset time windows.
[0067] For example, if the historical alarm data contains the following seven fields: source IP, destination IP, alarm time, attack list, source port, destination port, and request header, the alarm data compression management system can aggregate by setting the time window to 24 hours and specifying the aggregation fields as: source IP, destination IP, and destination port, so that alarm logs with the same time window and the same specified fields are grouped together.
[0068] Sub-step 1403, extracting features of the grouped historical alarm data according to the request header carried by the historical alarm data to obtain a feature set of the grouped historical alarm data;
[0069] In one embodiment, the alarm data compression management system can use word segmentation technology to perform word segmentation processing on the request header to obtain a word list corresponding to the request header; then, the word list obtained can be word vectorized by word vectorization technology. It should be noted here that there are many kinds of word vectorization technologies, such as one-hot encoding, bag of words model, TF-IDF and word embedding model based on deep learning, etc. In the embodiment of the present application, the alarm data compression management system can select appropriate word vectorization technology for word vectorization processing according to the actual business scenario. The embodiment of the present application does not specifically limit which word vectorization technology is used to vectorize the alarm log. Finally, the alarm data compression management system can perform an averaging operation on the vectors of all words and store the results in the "request header" field. Taking the alarm log in Table 1 as an example, after the above processing, the alarm data compression management system can obtain a grouped historical alarm data feature set.
[0070] Sub-step 1404, constructing a training data set according to the grouped historical alarm data feature set;
[0071] In the embodiment of the present application, the alarm data compression management system may add similarity tags to the feature set of the grouped historical alarm data after the grouping in sub-step 1403 .
[0072] For example, similarity tags can be added to the historical alarm data of the two combinations according to the "attack list" field. Specifically, the embodiment of the present application can calculate the similarity of the historical alarm data of the two combinations according to the following formula [1]:
[0073] Samilarity=(A a ∩B a) / (A a ∪B a )[1]
[0074] Among them, Aa is the alarm field "attack list" in the group historical alarm data A, Ba is the alarm field "attack list" in the group historical alarm data B, and the group historical alarm data A and the group historical alarm data B belong to the same group after aggregation by executing sub-step 1402.
[0075] Because the "attack list" field of historical alarm data is generated based on rules, each type of historical alarm data has multiple attacks. By comparing the intersection over union (IoU) of the "attack lists" of two data, the similarity between different data can be obtained, and then the two historical alarm data are labeled with similarity.
[0076] Sub-step 1405, training the pre-constructed twin neural network model according to the training data set constructed by executing sub-step 1404 to obtain the data similarity matching model.
[0077] It should be noted here that the twin neural network in the embodiment of the present application refers to a broad sense, that is, the two sub-networks can have the same structure or not, and the weights can be shared or not. The specific network structure used and whether the weights are shared depends on the business scenario.
[0078] In an embodiment of the present application, the training data that are combined in pairs can be input into the two subnets of the twin neural network, and the twin neural network can be fitted according to the label value (similarity) and the loss function until the preset accuracy or the maximum training algebra is reached, thereby completing the training of the twin neural network and obtaining a data similarity matching model.
[0079] In one implementation, the prediction matrix constructed by executing step 13 is input into a trained data similarity matching model to obtain a similarity list for the prediction matrix.
[0080] For example, still taking Table 4 and Table 5 as examples, the two prediction matrices of Table 4 and Table 5 are input into the trained data similarity matching model, and the similarity lists of Table 6 and Table 7 can be obtained respectively.
[0081] Table 6 Similarity List-1
[0082] index Similarity Index_F 1 1 1 2 0.9 2 3 0.8 3
[0083] Table 7 Similarity List-2
[0084] index Similarity Index_F 1 0.7 1 2 0.8 2 3 0.75 3
[0085] Among them, "similarity" represents the result after the prediction matrix is input into the neural network, and "index_F" is the index of the same group of data combined with the historical alarm data in the filter list.
[0086] Step 15: adding an alarm type tag to the first alarm log according to the similarity value calculated by executing step 14, and compressing the first alarm log according to the alarm type tag.
[0087] In one embodiment, the alarm data compression management system can select a group of data with the highest similarity based on the similarity list obtained by executing step 14, and filter the similarity list output by step 14. Taking Tables 6 and 7 above as examples, the data obtained after filtering are (1, 1) and (0.8, 2), respectively, where the first data represents the similarity and the second data represents the index in the alarm classification list.
[0088] The alarm logs are clustered by presetting the similarity threshold. Assuming that the preset threshold is 0.9, the similarity of the filtered Table 6 is 1, which meets the threshold, and its corresponding index is 1. In the alarm classification list, the "class label" corresponding to "index 1" is "1_1", and then the "class label 1_1" can be added to the alarm log corresponding to Table 6.
[0089] The similarity of the filtered Table 7 is 0.8, which does not meet the preset threshold, and its corresponding index is 2. In the alarm classification list, the group label corresponding to "index 2" is 1. The alarm data compression management system can generate a new class label for the alarm log corresponding to Table 7 based on the group label 1, and update the alarm classification list based on the newly generated class label.
[0090] By adding "class tags" to the alarm logs to be compressed, the categories to which the alarm logs belong are indicated, so as to complete logical alarm compression. For example, if there are 100 alarm logs in the database, with five "class tags" of "A, B, C, D, E", there are only 5 data logically displayed. If a new alarm log N is generated by the security device at this time, and the alarm log N is analyzed in the previous steps, the class tag "A" is added. Although there are 101 data in the database, only 5 alarm logs are logically displayed, which is convenient for operation and maintenance personnel to view and analyze.
[0091] Step 16: When the judgment result obtained by executing step 12 is no, the alarm classification list is updated according to the first alarm log.
[0092] When it is determined by executing step 12 that the first alarm log to be compressed is not in the alarm classification list, the alarm data compression management system can directly add the first alarm log to the alarm classification list, and generate a "group label" and a new "class label" for the first alarm log to update the alarm classification list.
[0093] By adopting the alarm log compression method provided in the embodiment of the present application, for the alarm log generated by the system security device, it is first possible to determine whether the alarm type of the alarm log exists in a pre-set alarm classification list based on the alarm time, source IP address, destination IP address and destination port of the alarm log. When the judgment result is yes, a prediction matrix can be further constructed based on the first alarm log and the alarm type matching the first alarm log, and the prediction matrix can be input into a data similarity matching model pre-trained based on the twin neural network model to obtain the similarity value between the first alarm log and the second alarm data output by the data similarity matching model; according to the similarity value, an alarm type label is added to the first alarm log, and according to the alarm type label, the first alarm log is compressed. By adopting the method provided in the embodiment of the present application, when constructing the prediction matrix, the existing knowledge system is fully utilized, and the construction of the prediction matrix is realized without the participation of experts, so that the constructed prediction matrix can contain the difference information of all rules in the rule base, and thus the model trained using this prediction matrix can have the possibility of surpassing all the rules in the rule base; secondly, the data similarity matching model in the embodiment of the present application is constructed based on the idea of twin neural networks. Compared with traditional clustering methods, twin neural networks can learn the difference rules between different data with a small amount of data combination, so the model has a strong generalization ability, thereby improving the accuracy and efficiency of compressing the alarm log.
[0094] In one implementation, the present application also provides an alarm log compression device to solve the problem that the existing alarm log compression scheme has poor robustness and mainly relies on human experience when matching alarm logs, resulting in inability to fully discover the similarities between alarms, which in turn leads to inaccurate matching results and low compression efficiency. The specific structural diagram of the alarm log compression device is shown in FIG. Figure 2 As shown, it includes: an alarm log obtaining unit 21, an alarm type matching unit 22, a prediction matrix building unit 23, a similarity calculating unit 24 and a compression unit 25.
[0095] The alarm log acquisition unit 21 is used to acquire a first alarm log, wherein the alarm field carried by the first alarm log includes at least one of the following: alarm time, source IP address, destination IP address, destination port, and request header;
[0096] The alarm type matching unit 22 is used to obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address, and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type;
[0097] A prediction matrix construction unit 23, configured to construct a prediction matrix according to the first alarm log and the alarm type matching the alarm log when the judgment result obtained by the alarm type matching unit is yes;
[0098] A similarity calculation unit 24 is used to input the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model;
[0099] The compression unit 25 is configured to add an alarm type tag to the first alarm log according to the similarity value, and compress the first alarm log according to the alarm type tag.
[0100] In one embodiment, the prediction matrix construction unit 23 is specifically used to: select second alarm data having the same alarm time, source IP address, destination IP address and destination port as the first alarm log from the alarm types matching the first alarm log; combine the first alarm log with the second alarm data to construct a prediction matrix.
[0101] In one embodiment, it also includes a word vectorization unit 32, which is specifically used to use word segmentation technology to perform word segmentation on the request header carried by the first alarm log to obtain a word list corresponding to the request header; perform word vectorization on the word list to obtain a word matrix corresponding to the word list; sum the word matrix and store the sum result in the field corresponding to the request header.
[0102] In one embodiment, the data similarity matching model is constructed through a twin neural network model.
[0103] In one embodiment, it also includes a model training unit, which is specifically used to obtain historical alarm data, and the alarm fields carried by the historical alarm data include at least one of the following: alarm time, source IP address, destination IP address, source port, destination port and request header; the historical alarm data is aggregated according to preset alarm fields to obtain group historical alarm data; according to the request header carried by the historical alarm data, the group historical alarm data is feature extracted to obtain a feature set of the group historical alarm data; according to the feature set of the group historical alarm data, a training data set is constructed; according to the training data set, a pre-constructed twin neural network model is trained to obtain the data similarity matching model.
[0104] In one implementation, an updating unit is further included, which is specifically configured to update the alarm classification list according to the first alarm log when the judgment result obtained by the alarm type matching unit 22 is negative.
[0105] By using the alarm log compression device provided in the embodiment of the present application, for the alarm log generated by the system security device, it is first possible to determine whether the alarm type of the alarm log exists in a pre-set alarm classification list based on the alarm time, source IP address, destination IP address and destination port of the alarm log. When the judgment result is yes, a prediction matrix can be further constructed based on the first alarm log and the alarm type matching the first alarm log, and the prediction matrix can be input into a data similarity matching model pre-trained based on the twin neural network model to obtain the similarity value between the first alarm log and the second alarm data output by the data similarity matching model; according to the similarity value, an alarm type label is added to the first alarm log, and according to the alarm type label, the first alarm log is compressed. By adopting the method provided in the embodiment of the present application, when constructing the prediction matrix, the existing knowledge system is fully utilized, and the construction of the prediction matrix is realized without the participation of experts, so that the constructed prediction matrix can contain the difference information of all rules in the rule base, and thus the model trained using this prediction matrix can have the possibility of surpassing all the rules in the rule base; secondly, the data similarity matching model in the embodiment of the present application is constructed based on the idea of twin neural networks. Compared with traditional clustering methods, twin neural networks can learn the difference rules between different data with a small amount of data combination, so the model has a strong generalization ability, thereby improving the accuracy and efficiency of compressing the alarm log.
[0106] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 3At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0107] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0108] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0109] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming an alarm log compression device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0110] Obtain a first alarm log, wherein the alarm fields carried by the first alarm log include at least one of the following: alarm time, source IP address, destination IP address, destination port and request header; obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type; when the judgment result is yes, construct a prediction matrix according to the first alarm log and the alarm type matching the alarm log; input the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; according to the similarity value, add an alarm type label to the first alarm log, and compress the first alarm log according to the alarm type label.
[0111] The above application Figure 3 The method performed by the alarm log compression electronic device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in software form. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0112] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0113] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations:
[0114] Obtain a first alarm log, wherein the alarm fields carried by the first alarm log include at least one of the following: alarm time, source IP address, destination IP address, destination port and request header; obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type; when the judgment result is yes, construct a prediction matrix according to the first alarm log and the alarm type matching the alarm log; input the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; according to the similarity value, add an alarm type label to the first alarm log, and compress the first alarm log according to the alarm type label.
[0115] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0116] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented 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 generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0119] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0120] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0121] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0122] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0123] 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 on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0124] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for compressing an alarm log, characterized in that: include: Obtain a first alarm log, wherein the alarm field carried by the first alarm log includes at least one of the following: alarm time, source IP address, destination IP address, destination port, and request header; Obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address, and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type; When the judgment result is yes, constructing a prediction matrix according to the first alarm log and the alarm type matching the first alarm log; Inputting the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the data similarity matching model; According to the similarity value, an alarm type tag is added to the first alarm log, and according to the alarm type tag, the first alarm log is compressed.
2. The method according to claim 1, characterized in that The constructing a prediction matrix according to the first alarm log and the alarm type matching the alarm log specifically includes: Selecting second alarm data having the same alarm time, source IP address, destination IP address and destination port as the first alarm log from the alarm types matching the first alarm log; The first alarm log and the second alarm data are combined to construct a prediction matrix.
3. The method according to claim 1, characterized in that Obtaining an alarm classification list, and before determining, according to the alarm time, the source IP address, the destination IP address, and the destination port, whether there is an alarm type matching the first alarm log in the alarm classification list, further comprising: Using word segmentation technology, the request header carried by the first alarm log is segmented to obtain a word list corresponding to the request header; Performing word vectorization on the word list to obtain a word matrix corresponding to the word list; The word matrix is summed up, and the summation result is stored in the field corresponding to the request header.
4. The method according to claim 1, characterized in that The data similarity matching model is constructed through a twin neural network model.
5. The method according to claim 1, characterized in that: Pre-training the data similarity matching model specifically includes: Acquire historical alarm data, where the alarm fields carried by the historical alarm data include at least one of the following: alarm time, source IP address, destination IP address, source port, destination port, and request header; Aggregating the historical alarm data according to preset alarm fields to obtain grouped historical alarm data; Extracting features of the grouped historical alarm data according to a request header carried by the historical alarm data to obtain a feature set of the grouped historical alarm data; Constructing a training data set according to the grouped historical alarm data feature set; According to the training data set, the pre-constructed twin neural network model is trained to obtain the data similarity matching model.
6. The method according to claim 1, characterized in that Also includes: When the judgment result is no, the alarm classification list is updated according to the first alarm log.
7. An alarm log compression device, characterized in that: include: An alarm log acquisition unit is used to acquire a first alarm log, wherein the alarm field carried by the first alarm log includes at least one of the following: alarm time, source IP address, destination IP address, destination port, and request header; an alarm type matching unit, configured to obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address, and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type; a prediction matrix construction unit, configured to construct a prediction matrix according to the first alarm log and the alarm type matching the alarm log when the judgment result obtained by the alarm type matching unit is yes; A similarity calculation unit, used for inputting the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; A compression unit is used to add an alarm type label to the first alarm log according to the similarity value, and compress the first alarm log according to the alarm type label.
8. The device according to claim 7, characterized in that Prediction matrix building unit, specifically used for: Selecting second alarm data having the same alarm time, source IP address, destination IP address and destination port as the first alarm log from the alarm types matching the first alarm log; The first alarm log and the second alarm data are combined to construct a prediction matrix.
9. An alarm log compression device, comprising: processor; a memory arranged to store computer executable instructions which, when executed, cause the processor to: Obtain a first alarm log, wherein the alarm field carried by the first alarm log includes at least one of the following: alarm time, source IP address, destination IP address, destination port, and request header; Obtain an alarm classification list, and determine whether there is an alarm type matching the first alarm log in the alarm classification list according to the alarm time, the source IP address, the destination IP address, and the destination port, wherein the alarm classification list includes an alarm type and at least one second alarm data corresponding to the alarm type; When the judgment result is yes, constructing a prediction matrix according to the first alarm log and the alarm type matching the alarm log; Inputting the prediction matrix into a pre-trained data similarity matching model to obtain a similarity value between the first alarm log and the second alarm data output by the twin neural network model; According to the similarity value, an alarm type tag is added to the first alarm log, and according to the alarm type tag, the first alarm log is compressed.
10. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of application programs, enable the electronic device to execute the method as claimed in any one of claims 1 to 6.
