Log analysis method, system, device and storage medium

Through the multi-round iterative clustering method of modular length window screening and neural network algorithm, the problem of low efficiency of log analysis is solved, the attack threat can be quickly identified, and the security of network protection is improved.

CN113836300BActive Publication Date: 2024-10-18CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111121626.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-24
Publication Date
2024-10-18
Estimated Expiration
2041-09-24

AI Technical Summary

Technical Problem

Log analysis efficiency in the existing technology is low, making it difficult to quickly identify malicious attacks and affecting network security protection.

Method used

The modular length window screening algorithm and the neural network algorithm are used to cluster log data. Through multiple rounds of iteration and feature vector updates, the clustering accuracy and efficiency are improved, and the log data is quickly classified.

Benefits of technology

It improves the efficiency and accuracy of log analysis, enables managers to quickly identify attack threats, and enhances network protection security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113836300B_ABST
    Figure CN113836300B_ABST
Patent Text Reader

Abstract

The present invention provides a log analysis method, system, device and storage medium, the method comprising the steps of: obtaining a plurality of historical log data with a small number of preset tags, and extracting a feature vector of each log data to form a vector parameter corresponding to each log data; clustering the log data based on the vector parameter and a preset clustering algorithm to obtain an initial clustering result; screening the initial clustering result based on a modulus length window screening algorithm to obtain a friendly clustering log; extracting a feature vector from the log data again based on the friendly clustering log and a preset neural network algorithm, and updating the vector parameter; and clustering the log data again using the updated vector parameter as an input parameter of the preset clustering algorithm, iterating multiple rounds in a loop to obtain a target clustering result, and pushing the target clustering result to a management platform; the present application is conducive to improving the audit and analysis efficiency of network protection security logs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a log analysis method, system, device and storage medium. Background Art

[0002] With the development of information technology, web network security issues have become increasingly prominent, and firewalls play an important role in identifying malicious features and protecting website traffic. Firewalls will record a large number of alarm logs during the security protection process, and the analysis of these logs plays an important role in the configuration and decision-making of firewall protection strategies.

[0003] In the prior art, when managers review and analyze these log data, they need to review them one by one and check all the log data, which leads to low efficiency of log review and analysis and is not conducive to rapid identification of malicious attacks. Summary of the invention

[0004] In view of the problems in the prior art, the purpose of the present invention is to provide a log analysis method, system, device and storage medium to solve the problem of low analysis efficiency in the existing log analysis method.

[0005] To achieve the above object, the present invention provides a log analysis method, which comprises the following steps:

[0006] Acquire multiple log data with preset labels, and extract the feature vector of each log data to form a vector parameter corresponding to each log data;

[0007] Based on the vector parameters and a preset clustering algorithm, clustering the log data to obtain an initial clustering result;

[0008] The initial clustering results are screened based on a modulus length window screening algorithm to obtain a friendly clustering log;

[0009] Based on the friendly clustering log and the preset neural network algorithm, extracting feature vectors from the log data again, and updating the vector parameters; and

[0010] The updated vector parameters are used as input parameters of the preset clustering algorithm, the log data is clustered again to obtain a target clustering result, and the target clustering result is pushed to the management platform.

[0011] Optionally, the using the updated vector parameter as an input parameter of the preset clustering algorithm to cluster the log data again to obtain a target clustering result includes:

[0012] The updated vector parameters are used as input parameters of the preset clustering algorithm, and the steps are repeated: clustering the log data to obtain a second clustering result, filtering the second clustering result based on the modulus length window filtering algorithm to obtain a friendly clustering log, extracting feature vectors from the log data again based on the friendly clustering log and the preset neural network algorithm, and updating the vector parameters; until the preset stop condition is reached, and the target clustering result is obtained.

[0013] Optionally, the steps of screening the initial clustering results based on the modulus window screening algorithm to obtain friendly clustering logs, and extracting feature vectors from the log data again based on the friendly clustering logs and a preset neural network algorithm, and updating the vector parameters further include:

[0014] Based on the previous round of clustering results in the iterative process, the log data with the largest number of repetitions with the previous round of clustering results under each cluster in the current round of clustering results is aligned and mapped to obtain the third clustering result;

[0015] The previous round of clustering results are characterized by a second mapping relationship between log data and clusters, and the current round of clustering results are characterized by a third mapping relationship between log data and clusters;

[0016] The extracting feature vectors from the log data again based on the friendly clustering log and the preset neural network algorithm, and updating the vector parameters includes:

[0017] Based on the friendly clustering log, the third clustering result and the preset neural network algorithm, feature vectors are extracted again from the log data, and the vector parameters are updated.

[0018] Optionally, aligning and mapping the log data with the largest number of repetitions in the previous round of clustering results under each cluster in the current round of clustering results to obtain a third clustering result includes:

[0019] Align and map the log data with the largest number of repetitions with the previous round of clustering results under each cluster in the current round of clustering results; reclassify the log data that have not completed the alignment mapping under each cluster according to the first preset similarity algorithm and the vector parameters corresponding to each cluster center in the previous round of clustering results, determine the cluster corresponding to each log data that has not completed the alignment mapping, and obtain the third clustering result.

[0020] Optionally, the initial clustering result represents a first mapping relationship between log data and clusters;

[0021] The modulus length window screening algorithm is to use the log data whose difference between the modulus length of the corresponding vector parameter and the modulus length of the vector parameter corresponding to a type of cluster center within an interval as the friendly clustering log;

[0022] The interval is [di-2δi, di+2δi], where di = xio-‖c i ‖,

[0023]

[0024] Among them, x io represents the average value of the modulus length of the vector parameters corresponding to all log data contained in the i-th cluster, i is a positive integer; n represents the number of log data contained in the i-th cluster; δ i represents the standard deviation of the modulus of the vector parameters corresponding to all log data contained in the i-th cluster, x i n represents the modulus length corresponding to the nth log data in the ith cluster, ‖c i ‖ represents the modulus of the vector parameters of the cluster center corresponding to the i-th cluster.

[0025] Optionally, the first preset similarity algorithm is:

[0026]

[0027] Among them, m represents the current iteration, m-1 represents the previous iteration, and x mn Represents the vector parameter corresponding to the log data of an uncompleted alignment mapping in the nth cluster of the current iteration, C m-1 Represents the vector parameter of the cluster center corresponding to a type of cluster in the previous iteration; ‖x mn ‖ represents the vector parameter x m The modulus length of n, ‖C m-1 ‖ represents the vector parameter C m-1 The modulus length, S(x mn , C m-1 ) represents the vector parameter x m n and the vector parameter C m-1 The similarity between .

[0028] Optionally, the target clustering result represents a fourth mapping relationship between log data and clusters;

[0029] The step of pushing the target clustering result to the management platform includes:

[0030] A piece of log data is randomly extracted from each cluster, and the log data and the corresponding cluster are pushed to the management platform.

[0031] Optionally, the aligning and mapping the log data with the largest number of repetitions in the previous round of clustering results under each cluster in the current round of clustering results includes:

[0032] The cluster to which the log data with the largest number of repetitions belongs in the current round of clustering results is changed to the cluster to which the log data belongs in the previous round of clustering results.

[0033] Optionally, the acquiring of multiple log data with preset labels and extracting a feature vector of each log data includes:

[0034] Based on the preset neural network algorithm and the preset label, a feature vector of each log data is extracted.

[0035] Optionally, the preset clustering algorithm is a k-means algorithm, and the preset stopping condition is that the number of iterations reaches a preset number of iterations.

[0036] The present invention also provides a log analysis system for implementing the above log analysis method, the system comprising:

[0037] The log vectorization module obtains multiple log data with preset labels and extracts the feature vector of each log data to form a vector parameter corresponding to each log data;

[0038] An initial clustering module, clustering the log data based on the vector parameters and a preset clustering algorithm to obtain an initial clustering result;

[0039] An initial result screening module, which screens the initial clustering results based on a modulus length window screening algorithm to obtain a friendly clustering log;

[0040] a vector parameter updating module, which extracts feature vectors from the log data again based on the friendly clustering log and a preset neural network algorithm, and updates the vector parameters; and

[0041] The iterative clustering module uses the updated vector parameters as input parameters of the preset clustering algorithm, clusters the log data again, obtains the target clustering result, and pushes the target clustering result to the management platform.

[0042] The present invention also provides a log analysis device, comprising:

[0043] processor;

[0044] a memory in which an executable program of the processor is stored;

[0045] Wherein, the processor is configured to execute the steps of any one of the above-mentioned log analysis methods by executing the executable program.

[0046] The present invention also provides a computer-readable storage medium for storing a program, wherein the program implements the steps of any one of the above-mentioned log analysis methods when executed by a processor.

[0047] Compared with the prior art, the present invention has the following advantages and outstanding effects:

[0048] The log analysis method, system, device and storage medium provided by the present invention use a friendly clustering log screened by a modulus length window screening algorithm in the clustering process to guide the extraction of features of log data in the subsequent iteration process, that is, to obtain the semantic feature representation of the log text; this can not only make the clustering converge as quickly as possible and improve the clustering efficiency; it is also conducive to improving the clustering accuracy; at the same time, it avoids the problem that the traditional clustering algorithm will have high-dimensional sparsity in the process of text vectorization, and it is difficult to extract effective features from short logs to achieve log aggregation;

[0049] This application classifies all log data into multiple clusters, so that managers only need to view one piece of log data under each cluster to discover the attack threat level of the log data under that cluster, thereby providing a basis for log processing, perceiving threat intelligence in advance, improving the review and analysis efficiency of network protection security logs, and helping to enhance website security. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Other features, objectives and advantages of the present invention will become more apparent from a reading of the detailed description of non-limiting embodiments made with reference to the following accompanying drawings.

[0051] Figure 1 It is a schematic diagram of a log analysis method in the prior art;

[0052] Figure 2 A schematic diagram of a log analysis method disclosed in an embodiment of the present invention;

[0053] Figure 3 A schematic diagram of a log analysis method disclosed in another embodiment of the present invention;

[0054] Figure 4 A schematic diagram of a log analysis method disclosed in another embodiment of the present invention;

[0055] Figure 5 A structural schematic diagram of a log analysis system disclosed in one embodiment of the present invention;

[0056] Figure 6 A structural schematic diagram of a log analysis system disclosed in another embodiment of the present invention;

[0057] Figure 7 A structural schematic diagram of a log analysis system disclosed in another embodiment of the present invention;

[0058] Figure 8 A schematic diagram of the structure of a log analysis device disclosed in one embodiment of the present invention;

[0059] Fig. 9 A schematic diagram of the structure of a computer-readable storage medium disclosed in one embodiment of the present invention. DETAILED DESCRIPTION

[0060] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated description will be omitted.

[0061] refer to Figure 1 , which is a traditional clustering algorithm implemented by using the k-means algorithm in the prior art. The clustering algorithm includes the following steps:

[0062] S110, extracting a vector matrix corresponding to each piece of log data, taking each piece of log data as a data point, and each data point corresponds to a vector matrix.

[0063] S120, randomly select k data points as initial cluster centers, calculate the similarity between all data points and the initial cluster centers, and classify each data point into the cluster to which the cluster center most similar to the data point belongs. k is a positive integer.

[0064] S130, recalculating the cluster center of the adjusted cluster, and updating the clusters to which all data points belong based on the similarity again.

[0065] S140, determining whether the preset clustering criteria function converges or reaches the number of iterations; if not, returning to step S130, and if so, executing step S150: outputting the final clustering result.

[0066] Since the structure of network security protection log data is generally extremely non-uniform, the vectorization process will cause high-dimensional sparsity problems. Clustering algorithms use this vector as input, making it difficult to achieve log aggregation. Therefore, when using the above traditional clustering methods to perform log clustering, there will be high-dimensional sparsity problems during text vectorization, making it difficult to extract attack features from short logs to achieve log aggregation.

[0067] like Figure 2 As shown, an embodiment of the present invention discloses a log analysis method, which includes the following steps:

[0068] S210, obtaining a plurality of log data with preset labels, and extracting a feature vector of each log data to form a vector parameter corresponding to each log data.

[0069] Specifically, the vector parameter corresponding to a log data in this step is a vector matrix composed of feature vectors corresponding to all features belonging to the log data. This step extracts the feature vectors of each log data based on the preset neural network algorithm and the above-mentioned preset labels. The above-mentioned preset labels are used as pseudo-labels in the process of extracting features of log data by the preset neural network algorithm, and are used to guide the feature extractor of the preset neural network algorithm to perform feature extraction. In the subsequent iterative process, the above-mentioned preset labels are no longer used as the above-mentioned pseudo-labels, but the friendly clustering logs obtained by filtering the modulus window filtering algorithm are used to guide feature extraction. Among them, the above-mentioned preset neural network algorithm can adopt the Transformer model, but the present application is not limited to this.

[0070] S220, clustering the log data based on the above vector parameters and the preset clustering algorithm to obtain an initial clustering result. The initial clustering result represents a first mapping relationship between the log data and the cluster. The preset clustering algorithm uses a similarity algorithm to calculate the similarity between the vector matrices corresponding to each log data, clusters the log data based on the similarity, and obtains an initial clustering result. The specific implementation of this step can be achieved using existing technology, and this application will not go into details. The above similarity algorithm can be calculated using a Euclidean distance algorithm.

[0071] Among them, the above-mentioned preset clustering algorithm can be a k-means algorithm, but the present application is not limited thereto.

[0072] S230, based on the module length window screening algorithm, the above initial clustering results are screened to obtain friendly clustering logs. Specifically, the above initial clustering results contain at least one cluster, each cluster contains multiple log data, and since each log data corresponds to a vector matrix, each cluster contains multiple vector matrices. Moreover, each cluster has a cluster center, and the representation of the cluster center is also a vector matrix.

[0073] The above-mentioned modulus length window screening algorithm uses the log data whose difference between the modulus length of the corresponding vector parameter and the modulus length of the vector parameter corresponding to a type of cluster center within an interval as the friendly clustering log.

[0074] The above interval is [d i -2δ i , d i +2δ i ], where d i =x io -‖c i ‖,

[0075]

[0076] Among them, x ioRepresents the average value of the modulus length of the vector parameters corresponding to all log data contained in the i-th cluster. i is a positive integer. n represents the number of log data contained in the i-th cluster. δ i Represents the standard deviation of the modulus of the vector parameters corresponding to all log data contained in the i-th cluster. ‖c i ‖ represents the modulus of the vector parameter of the cluster center corresponding to the i-th cluster. in represents the modulus length of the nth log data in the ith cluster. Then, for example, the above x i1 Indicates the modulus length of the first log data in the i-th cluster. i2 Indicates the modulus length corresponding to the second log data in the i-th cluster.

[0077] Specifically, according to the above clustering results, each log data belongs to a cluster, and each cluster has a cluster center. When the difference between the vector parameter modulus corresponding to a log data and the modulus of the corresponding cluster center is within the above interval, the log data is determined as a friendly cluster log. The above cluster center refers to the cluster center of the cluster to which the log data belongs.

[0078] Exemplarily, i may be an integer greater than or equal to 1 and less than or equal to N, where N represents the number of clusters included in the clustering result obtained after each round of iteration.

[0079] S240, based on the above-mentioned friendly clustering log and the preset neural network algorithm, extract the feature vector of the above-mentioned log data again, and update the above-mentioned vector parameters. Specifically, in the process of extracting the feature vector of the log data again using the preset neural network algorithm, the feature vector corresponding to the friendly clustering log is used as a pseudo-label in the process of extracting the features of the log data by the preset neural network algorithm to guide its feature extraction process. After extracting the features again, the number of extracted features may be different from the first time, and the extracted features may also change. Then, the above-mentioned vector parameters are updated according to the feature vector extracted again, that is, the vector parameters corresponding to each log data are updated to a vector matrix composed of the feature vector extracted again for the log data.

[0080] S250, using the updated vector parameter as an input parameter of the preset clustering algorithm, clustering the log data again to obtain a target clustering result, and pushing the target clustering result to the management platform. The target clustering result represents a fourth mapping relationship between the log data and the cluster.

[0081] In one embodiment of the present application, the above-mentioned pushing the target clustering result to the management platform includes:

[0082] A piece of log data is randomly selected from each cluster, and the log data and the corresponding cluster are pushed to the management platform. In this way, the management personnel only need to view one piece of log data under each cluster, instead of viewing all the log data, which improves the efficiency of network protection security log review and analysis, and is conducive to enhancing website security.

[0083] This application uses the powerful feature extraction capability of the neural network algorithm to obtain the semantic feature representation of the log text, uses the semantic feature representation for clustering, and in the subsequent feature representation extraction process, uses the feature vector of the friendly clustering log obtained by filtering the modulus window filtering algorithm as a pseudo-label to guide feature extraction, thereby realizing a semi-supervised clustering method, avoiding the problem of high-dimensional sparsity in the traditional clustering algorithm during the text vectorization process, and making it difficult to extract attack features from short logs of various formats to achieve log aggregation.

[0084] In another embodiment of the present application, another log analysis method is disclosed. Figure 3 , step S250 is:

[0085] Determine whether the preset stop condition is met. If not, jump to step S220 and use the updated vector parameters as the input parameters of the above-mentioned preset clustering algorithm; if so, execute step S270: obtain the target clustering result, and push the target clustering result to the management platform.

[0086] The above-mentioned preset stop condition may be that the number of iterations reaches a preset number of iterations, but the present application is not limited thereto.

[0087] In another embodiment of the present application, another log analysis method is disclosed. Figure 4 , between step S230 and step S240, further comprising the steps of:

[0088] S260, based on the previous round of clustering results in the iterative process, align and map the log data with the largest number of repetitions in the previous round of clustering results under each cluster in the current round of clustering results to obtain a third clustering result. The previous round of clustering results characterizes the second mapping relationship between log data and clusters, and the current round of clustering results characterizes the third mapping relationship between log data and clusters. The third clustering result characterizes the fifth mapping relationship between log data and clusters.

[0089] Specifically, in this embodiment, the execution process of alignment mapping includes: changing the cluster to which the log data with the largest number of repetitions belongs in the current round of clustering results to the cluster to which the log data belongs in the previous round of clustering results. Referring to Table 1, in the table, there are clusters 1, 2, and 3 in the current round of clustering results; and there are clusters 1, 2, and 3 in the previous round of clustering results.

[0090] From the second column of Table 1, we can see that there are 28 log data marked as cluster 1 in the current round of clustering results. Among them, 8 were marked as cluster 1 in the previous round, and 20 were marked as cluster 3 in the previous round. From the third column of Table 1, we can see that there are 39 log data marked as cluster 2 in the current round of clustering results. Among them, 38 were marked as cluster 1 in the previous round, and 1 was marked as cluster 3 in the previous round. From the fourth column of Table 1, we can see that there are 42 log data marked as cluster 3 in the current round of clustering results. Among them, 40 were marked as cluster 2 in the previous round, and 2 were marked as cluster 3 in the previous round.

[0091] As shown in Table 1, cluster 1 in the current round of clustering results corresponds to cluster 3 in the previous round of clustering results, cluster 2 in the current round of clustering results corresponds to cluster 1 in the previous round of clustering results, and cluster 3 in the current round of clustering results corresponds to cluster 2 in the previous round of clustering results. Then the execution process of alignment mapping includes: changing cluster 1 in the current round of clustering results to cluster 3, changing cluster 2 in the current round of clustering results to cluster 1, and changing cluster 3 in the current round of clustering results to cluster 2.

[0092] Table 1

[0093]

[0094] In this embodiment, the corresponding step S240 is:

[0095] Based on the friendly clustering log, the third clustering result and the preset neural network algorithm, feature vectors are extracted again from the log data, and the vector parameters are updated.

[0096] In this way, the present application uses the above-mentioned alignment mapping to ensure that each time feature extraction occurs, the cluster labels corresponding to the input log data are consistent, so that the vector parameters corresponding to the friendly clustering logs are used as pseudo-labels for self-supervised learning of the feature extraction process, and the cluster labels obtained by clustering before and after are consistent. This not only allows the feature extraction process to converge as quickly as possible and obtain better feature representation, but also helps to improve clustering accuracy.

[0097] In another embodiment of the present application, another log analysis method is disclosed. Based on the above embodiment, step S260 of the method includes:

[0098] Align and map the log data with the largest number of repetitions in the previous round of clustering results under each cluster in the current round of clustering results; reclassify the log data under each cluster that has not completed alignment mapping according to the first preset similarity algorithm and the vector parameters corresponding to each cluster center in the previous round of clustering results, determine the cluster to which each log data that has not completed alignment mapping belongs, and obtain a third clustering result. The third clustering result represents a fifth mapping relationship between log data and clusters.

[0099] In this embodiment, the first preset similarity algorithm is:

[0100]

[0101] Among them, m represents the current iteration, m-1 represents the previous iteration, and x mn Represents the vector parameter corresponding to the log data of an uncompleted alignment mapping in the nth cluster of the current iteration, C m-1 Represents the vector parameter of the cluster center corresponding to a type of cluster in the previous iteration; ‖x mn ‖ represents the vector parameter x mn The modulus length, ‖C m-1 ‖ represents the vector parameter C m-1 The modulus length, S(x mn , C m-1 ) represents the vector parameter x mn and vector parameter C m-1 The similarity between them is the similarity between the log data without completed alignment mapping and the cluster center.

[0102] In this step, after calculating the similarity between each log data that has not completed the alignment mapping and the cluster center of each cluster, it is classified into the cluster corresponding to the cluster center with the largest similarity. This ensures that the accuracy of the clusters to which all log data belong after clustering is high. After multiple iterations, the accuracy of the final clustering result is guaranteed.

[0103] It should be noted that all the above embodiments disclosed in this application can be freely combined, and the technical solutions obtained after the combination are also within the protection scope of this application.

[0104] like Figure 5 As shown, an embodiment of the present invention further discloses a log analysis system 5, which includes:

[0105] The log vectorization module 51 obtains a plurality of log data with preset tags, and extracts a feature vector of each log data to form a vector parameter corresponding to each log data.

[0106] The initial clustering module 52 clusters the log data based on the vector parameters and a preset clustering algorithm to obtain an initial clustering result.

[0107] The initial result screening module 53 screens the initial clustering results based on the modulus length window screening algorithm to obtain friendly clustering logs.

[0108] The vector parameter updating module 54 extracts feature vectors from the log data again based on the friendly clustering log and the preset neural network algorithm, and updates the vector parameters.

[0109] The iterative clustering module 55 uses the updated vector parameters as input parameters of the above-mentioned preset clustering algorithm, clusters the above-mentioned log data again, obtains the target clustering result, and pushes the target clustering result to the management platform.

[0110] It is understandable that the log analysis system of the present invention also includes other existing functional modules that support the operation of the log analysis system. Figure 5 The log analysis system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0111] The log analysis system in this embodiment is used to implement the above-mentioned log analysis method. Therefore, the specific implementation steps of the log analysis system can refer to the above-mentioned description of the log analysis method, which will not be repeated here.

[0112] In another embodiment of the present application, Figure 6 As shown, the iterative clustering module 55 performs the following steps: determining whether the preset stop condition is reached, if not, jumping to the initial clustering module 52, and using the updated vector parameters as input parameters of the preset clustering algorithm in the initial clustering module 52. If yes, jumping to the result output module 57. The result output module 57 is used to obtain the target clustering result and push the target clustering result to the management platform.

[0113] In another embodiment of the present application, Figure 7 As shown, the above-mentioned log analysis system 5 also includes an alignment mapping module 56, which is used to align and map the log data with the largest number of repetitions with the previous round of clustering results under each cluster in the current round of clustering results based on the previous round of clustering results in the iterative process to obtain a third clustering result.

[0114] In this embodiment, the vector parameter updating module 54 extracts feature vectors from the log data again based on the friendly clustering log, the third clustering result and the preset neural network algorithm, and updates the vector parameters.

[0115] An embodiment of the present invention further discloses a log analysis device, including a processor and a memory, wherein the memory stores an executable program of the processor; the processor is configured to execute the steps in the above-mentioned log analysis method by executing the executable program. Figure 8 Schematic diagram of the structure of the log analysis device disclosed in the present invention. Figure 8 The electronic device 600 according to this embodiment of the present invention is described. Figure 8 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0116] like Figure 8 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0117] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of various exemplary embodiments of the present invention described in the above log analysis method section of this specification. For example, the processing unit 610 can execute the following steps: Figure 2 Follow the steps shown in .

[0118] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0119] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0120] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0121] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.

[0122] The present invention also discloses a computer-readable storage medium for storing a program, which implements the steps in the above-mentioned log analysis method when executed. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps of various exemplary implementations of the present invention described in the above-mentioned log analysis method of this specification.

[0123] As shown above, when the program of the computer-readable storage medium of this embodiment is executed, in the clustering process, the friendly clustering logs screened by the modulus length window screening algorithm are used to guide the extraction of features of the log data in the subsequent iteration process, that is, to obtain the semantic feature representation of the log text; this not only enables the feature extraction to converge as quickly as possible and improves the accuracy of the feature semantic representation, but also helps to improve the clustering accuracy; at the same time, it avoids the problem of high-dimensional sparsity in the process of text vectorization of traditional clustering algorithms, and it is difficult to achieve log aggregation from short logs.

[0124] Fig. 9 Schematic diagram of the structure of the computer-readable storage medium of the present invention. Fig. 9 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0125] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0126] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0127] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0128] The log analysis method, system, device and storage medium provided by the embodiment of the present invention use a friendly clustering log screened by a modulus length window screening algorithm during the clustering process to guide the extraction of features of log data in the subsequent iteration process, that is, to obtain the semantic feature representation of the log text; this can not only make the clustering converge as quickly as possible and improve the clustering efficiency; it is also conducive to improving the clustering accuracy; at the same time, it avoids the problem that the traditional clustering algorithm will have high-dimensional sparsity during the text vectorization process, and it is difficult to extract effective features from short logs to achieve log aggregation;

[0129] This application classifies all log data into multiple clusters, so that managers only need to view one piece of log data under each cluster to discover the attack threat level of the log data under that cluster, thereby providing a basis for log processing, perceiving threat intelligence in advance, improving the review and analysis efficiency of network protection security logs, and helping to enhance website security.

[0130] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A log analysis method, characterized in that: The following steps are involved: Acquire multiple log data with preset labels, and extract the feature vector of each log data to form a vector parameter corresponding to each log data; Based on the vector parameters and a preset clustering algorithm, clustering the log data to obtain an initial clustering result, wherein the initial clustering result represents a first mapping relationship between the log data and the clusters; The initial clustering result is screened based on a modulus length window screening algorithm to obtain a friendly clustering log, wherein the modulus length window screening algorithm uses log data whose difference between the modulus length of the corresponding vector parameter and the modulus length of the vector parameter corresponding to a class of cluster centers is within an interval as the friendly clustering log; The interval is [d i -2δ i ,d i +2δ i ], where d i =x io -‖c i ‖, Among them, x io represents the average value of the modulus length of the vector parameters corresponding to all log data contained in the i-th cluster, i is a positive integer; n represents the number of log data contained in the i-th cluster; δ i represents the standard deviation of the modulus of the vector parameters corresponding to all log data contained in the i-th cluster, x in represents the modulus length corresponding to the nth log data in the ith cluster, ‖c i ‖ represents the modulus of the vector parameter of the cluster center corresponding to the i-th cluster; Based on the previous round of clustering results in the iterative process, the log data with the largest number of repetitions with the previous round of clustering results under each cluster in the current round of clustering results is aligned and mapped to obtain the third clustering result; The previous round of clustering results are characterized by a second mapping relationship between log data and clusters, and the current round of clustering results are characterized by a third mapping relationship between log data and clusters; Based on the friendly clustering log, the third clustering result and the preset neural network algorithm, extracting feature vectors from the log data again, and updating the vector parameters; and The updated vector parameters are used as input parameters of the preset clustering algorithm, the log data is clustered again to obtain a target clustering result, and the target clustering result is pushed to the management platform.

2. The log analysis method according to claim 1, characterized in that: The updated vector parameter is used as an input parameter of the preset clustering algorithm, and the log data is clustered again to obtain a target clustering result, including: The updated vector parameters are used as input parameters of the preset clustering algorithm, and the steps are repeated: clustering the log data to obtain a second clustering result, filtering the second clustering result based on the modulus length window filtering algorithm to obtain a friendly clustering log, extracting feature vectors from the log data again based on the friendly clustering log and the preset neural network algorithm, and updating the vector parameters; until the preset stop condition is reached, and the target clustering result is obtained.

3. The log analysis method according to claim 1, characterized in that: The log data with the largest number of repetitions in each cluster of the current round of clustering results and the previous round of clustering results are aligned and mapped to obtain a third clustering result, including: Align and map the log data with the largest number of repetitions with the previous round of clustering results under each cluster in the current round of clustering results; reclassify the log data that have not completed the alignment mapping under each cluster according to the first preset similarity algorithm and the vector parameters corresponding to each cluster center in the previous round of clustering results, determine the cluster corresponding to each log data that has not completed the alignment mapping, and obtain the third clustering result.

4. The log analysis method according to claim 3, characterized in that: The first preset similarity algorithm is: Among them, m represents the current iteration, m-1 represents the previous iteration, and x mn Represents the vector parameter corresponding to the log data of an uncompleted alignment mapping in the nth cluster of the current iteration, C m-1 Represents the vector parameter of the cluster center corresponding to a type of cluster in the previous iteration; ‖x mn ‖ represents the vector parameter x mn The modulus length, ‖C m-1 ‖ represents the vector parameter C m-1 The modulus length, S(x mn ,C m-1 ) represents the vector parameter x mn and vector parameter C m-1 The similarity between .

5. The log analysis method according to claim 1, characterized in that: The target clustering result represents the fourth mapping relationship between log data and clusters; The step of pushing the target clustering result to the management platform includes: A piece of log data is randomly extracted from each cluster, and the log data and the corresponding cluster are pushed to the management platform.

6. The log analysis method according to claim 1, characterized in that: The alignment mapping of the log data with the largest number of repetitions with the previous round of clustering results under each cluster in the current round of clustering results includes: The cluster to which the log data with the largest number of repetitions belongs in the current round of clustering results is changed to the cluster to which the log data belongs in the previous round of clustering results.

7. The log analysis method according to claim 1, characterized in that: The step of obtaining multiple log data with preset labels and extracting a feature vector of each log data includes: Based on the preset neural network algorithm and the preset label, a feature vector of each log data is extracted.

8. The log analysis method according to claim 2, characterized in that: The preset clustering algorithm is a k-means algorithm, and the preset stopping condition is that the number of iterations reaches a preset number of iterations.

9. A log analysis system, used to implement the log analysis method according to claim 1, characterized in that: The system comprises: The log vectorization module obtains multiple log data with preset labels and extracts the feature vector of each log data to form a vector parameter corresponding to each log data; An initial clustering module, clustering the log data based on the vector parameters and a preset clustering algorithm to obtain an initial clustering result; An initial result screening module, which screens the initial clustering results based on a modulus length window screening algorithm to obtain a friendly clustering log; a vector parameter updating module, which extracts feature vectors from the log data again based on the friendly clustering log and a preset neural network algorithm, and updates the vector parameters; and The iterative clustering module uses the updated vector parameters as input parameters of the preset clustering algorithm, clusters the log data again, obtains the target clustering result, and pushes the target clustering result to the management platform.

10. A log analysis device, characterized in that: include: processor; a memory in which an executable program of the processor is stored; Wherein, the processor is configured to execute the steps of the log analysis method described in any one of claims 1 to 8 by executing the executable program.

11. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the log analysis method described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • System fault diagnosis method and device based on log semantic mining

    CN110288004A

  • Pedestrian re-identification method based on layer-by-layer clustering and enhanced discrimination

    CN112966647A