Log operation behavior determination method and device, equipment and readable storage medium
By extracting and clustering the numerical and content features of log data, and constructing an operation behavior table, it solves the problem of low efficiency in classifying log operation behaviors in traditional methods, and achieves efficient classification and accurate identification of massive log data.
Patent Information
- Application Number
- CN202410287368.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-13
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-03-13
AI Technical Summary
Traditional methods have low efficiency in classifying massive log data and are prone to misjudgments, making it difficult to accurately determine log operation behavior, especially in scenarios with large amounts of data and high complexity.
By extracting numerical features and content features from historical log data, the distance between each historical log data is determined, clustering is performed based on preset neighborhood parameters, and an operation behavior table is constructed, which is ultimately used to determine the operation behavior of new log data. .
It improves the processing efficiency of log operation behaviors, reduces the need for re-clustering, enhances the accuracy of classification, and can effectively distinguish between normal and abnormal log operations.
Smart Images

Figure CN118797430A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security, and in particular to a method, device, equipment and readable storage medium for determining log operation behavior. Background Art
[0002] Using traditional statistical methods to classify user log operation behaviors is inefficient and prone to misjudgment. Auditors classify the login logs and background operation logs of personnel accounts on the system based on traditional statistical methods. This method is easier to operate on a small amount of data. When the amount of data increases dramatically, it is difficult to classify user log operation behaviors manually and the efficiency is low;
[0003] The traditional density-based spatial clustering algorithm (DBSCAN) has a low classification efficiency. Whenever new log data appears, all data needs to be re-clustered. The traditional K-means algorithm requires the number of categories / clusters to be selected in advance. In massive log data, due to the uncertainty and complexity of log operations, the number of categories / clusters is highly random, and it is difficult to ensure the accuracy of classification by selecting categories / clusters in advance. The disadvantage of the Mean-Shift algorithm is that the window size / radius is fixed. In complex scenarios with massive logs, when the window size / radius is not set reasonably, the classification effect is relatively poor. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, device and readable storage medium for determining log operation behavior, so as to solve the technical problem of low efficiency of existing methods for determining log operation behavior.
[0005] In a first aspect, an embodiment of the present application provides a method for determining a log operation behavior, including:
[0006] Extract numerical features and content features from historical log data;
[0007] Determining the distance between each of the historical log data based on the numerical feature and the content feature;
[0008] Based on the distance and the preset neighborhood parameter, clustering processing is performed on each of the historical log data to obtain the operation behavior corresponding to each of the historical log data;
[0009] Based on the numerical feature, the content feature and the operation behavior corresponding to each of the historical log data, construct an operation behavior table;
[0010] Based on the operation behavior table, the operation behavior of the new log data is determined.
[0011] In one embodiment, the numerical feature includes operation time and operation type; the content feature includes operation content vector; and determining the distance between each of the historical log data based on the numerical feature and the content feature includes:
[0012] Determining the similarity between the operation content vectors;
[0013] Based on the similarity and the normalized operation time and operation type, the distance between each of the historical log data is determined.
[0014] In one embodiment, the preset neighborhood parameters include a preset number and a preset distance; the clustering of the historical log data based on the distance and the preset neighborhood parameters to obtain the operation behavior corresponding to each historical log data includes:
[0015] Determine core data in each of the historical log data according to the distance between each of the historical log data, the number of log data in the neighborhood of the core data is greater than the preset number, the neighborhood of the core data is centered on the core data, and the preset distance is determined as the radius;
[0016] Based on the neighborhood of the core data, normal log data and abnormal log data in each of the historical log data are determined, the operation behavior corresponding to the normal log data is a normal operation, the abnormal log data is not in the neighborhood of the core data, and the operation behavior corresponding to the abnormal log data is an abnormal operation.
[0017] In one embodiment, the constructing the operation behavior table based on the numerical feature, the content feature, and the operation behavior corresponding to each of the historical log data includes:
[0018] Determine a normal cluster based on each of the normal log data, wherein the distance between each of the normal log data in the normal cluster is less than or equal to the preset distance;
[0019] Determine an abnormal cluster based on each of the abnormal log data, wherein the distance between each of the abnormal log data in the abnormal cluster is less than or equal to the preset distance;
[0020] It is determined that the operation behavior table includes the operation time, the operation type, the operation content vector and the operation label, and the operation label includes the normal cluster, the abnormal cluster and abnormal log data.
[0021] In one embodiment, determining the operation behavior of the new log data based on the operation behavior table includes:
[0022] Determine the operation label corresponding to the new log data based on the preset neighborhood parameter and the distance between the new log data and each of the historical log data;
[0023] In a case where the operation label corresponding to the new log data is the normal cluster, it is determined that the operation behavior corresponding to the new log data is a normal operation.
[0024] In one embodiment, the determining the operation label corresponding to the new log data based on the preset neighborhood parameter and the distance between the new log data and each of the historical log data includes:
[0025] When the operation label corresponding to the new log data is the abnormal log data and the new log data is within the neighborhood of the abnormal log data, merging the new log data and the abnormal log data to obtain a new abnormal cluster;
[0026] When the operation label corresponding to the new log data is the abnormal cluster and the number of abnormal log data in the abnormal cluster is greater than the first number, clustering processing is performed on the new log data and each of the historical log data to obtain an operation behavior classification result.
[0027] In a second aspect, an embodiment of the present application provides a log operation behavior determination device, including:
[0028] Feature extraction module, used to extract numerical features and content features from historical log data;
[0029] A distance determination module, used for determining the distance between each of the historical log data based on the numerical feature and the content feature;
[0030] A cluster processing module, used for performing cluster processing on each of the historical log data based on the distance and a preset neighborhood parameter to obtain an operation behavior corresponding to each of the historical log data;
[0031] An operation behavior table construction module, used to construct an operation behavior table based on the numerical feature, the content feature and the operation behavior corresponding to each of the historical log data;
[0032] The operation behavior classification module is used to determine the operation behavior of the new log data based on the operation behavior table.
[0033] In a third aspect, an embodiment of the present application provides a device, including a processor and a memory storing a computer program, wherein when the processor executes the computer program, the log operation behavior determination method described in the first aspect is implemented.
[0034] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for determining log operation behavior described in the first aspect is implemented.
[0035] The log operation behavior determination method, apparatus, device and readable storage medium provided in the embodiments of the present application extract features from historical log data, determine the distance between each historical log data based on the extracted numerical features and content features, cluster each historical log data based on the distance and a preset neighborhood parameter, obtain the operation behavior corresponding to each historical log data, then construct an operation behavior table based on the obtained numerical features and content features, and the operation behavior corresponding to each historical log data, and finally determine the operation behavior of new log data through the operation behavior table, thereby improving the processing efficiency of log operation behavior. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0037] Figure 1 This is one of the flow charts of the method for determining log operation behavior provided in the embodiment of the present application;
[0038] Figure 2 This is the second flow chart of the method for determining log operation behavior provided in the embodiment of the present application;
[0039] Figure 3 This is the third flow chart of the method for determining log operation behavior provided in the embodiment of the present application;
[0040] Figure 4 It is a structural diagram of a log operation behavior determination device provided in an embodiment of the present application;
[0041] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0043] Reference Figure 1 , Figure 1 This is one of the flow charts of the method for determining log operation behavior in the embodiment of the present application. The method for determining log operation behavior provided in the embodiment of the present application may include:
[0044] Step 100, extracting numerical features and content features from historical log data;
[0045] Specifically, the specific content of the log operation behavior determination method provided in the embodiment of the present application for feature extraction of the log operation data to be processed is as follows:
[0046] The operation time and operation type of historical log data are used as numerical features, and the operation content (vector) of historical log data is used as content features; the operation time and operation content are converted, and the operation time can be converted into different log formats according to the different requirements of the statistical period; the operation content is segmented by natural language processing, and the content after segmentation is vectorized through word2vec to construct a text similarity feature vector of the operation content.
[0047] By extracting features from historical log data, we can obtain the behavioral features of user operation historical log data. The specific features and feature values are as follows:
[0048] Extract the user account, operation time, operation type, and operation content of the historical log data, add a unique identification field for the log record to distinguish each historical log data, and group them according to the user account (Zhang San will be used as an alternative in the following description). Table 1 below shows some historical log operation data records of the extracted account Zhang San at a certain time (such as June 1, 2023), and the log operations are recorded as p1-p11 respectively. Among them, the operation time field is recorded as x, and the operation type field is recorded as y. The code meanings of the operation type in Table 1 are as follows: 1 means user login, 2 means query data, 3 means export data list, 4 means delete data, and 5 means modify data.
[0049] Operation record ID Log operation time (x) Operation type (y) Operation content (z) p1 2023-06-01 09:01:25 1 Zhang San logs into system a p2 2023-06-01 09:06:04 2 Zhang San queries system B p3 2023-06-01 10:18:21 3 Zhang San logs into system a p4 2023-06-01 11:12:12 1 Query P5 2023-06-01 12:06:01 3 Zhang San logs into system a p6 2023-06-01 13:00:11 1 Query system p7 2023-06-01 13:30:05 2 Zhang San logs into system a p8 2023-06-01 15:19:01 2 Query system p9 2023-06-01 23:01:01 1 Zhang San logs into system a p10 2023-06-01 23:30:28 2 Login p11 2023-06-02 00:02:10 4 Login system
[0050] Table 1
[0051] The specific contents of feature preprocessing are as follows: Operation time and operation content are converted. Operation time can be processed into different log formats according to different requirements of statistical cycles. For example, if logs are analyzed with a daily cycle, data of one day (from 0:00 to 24:00) is selected and processed into decimal form with hours as the unit. If the statistical cycle is a month, the data can be converted into a second-level timestamp. Since the time difference span is large, the time difference needs to be normalized, that is, the time field is normalized to between 0 and 1 according to the selected time period offset. For example, the minimum operation time in June 2023 is 2023-06-01 09:01:25, and the corresponding second-level timestamp is 1685581264. The maximum operation time is 2023-06-30 23:59:00, and the corresponding timestamp is 1688140740. The process of calculating the normalized value corresponding to the operation time 2023-06-15 10:25:11 is as follows: convert it into the timestamp 1686795911, substitute it into the normalization formula, and the normalized time value is 0.47.
[0052] For the text features of the operation content, natural language processing technology is used to segment the operation content, and then the operation content is vectorized through word2vec to construct the text similarity feature vector of the operation content. In summary, the normalized historical log data format is shown in Table 2 below. Each log operation record in Table 2 corresponds to a historical log data and also corresponds to a data point.
[0053] Operation record ID Log operation time (x) Operation type (y) Operation content (z) p1 9 1 [[1,2],[3,4]] p2 9.1 2 [[2,2],[3,4]] p3 10.3 3 [[1,3],[3,4]] p4 11.2 1 [[1,2],[3,4]] P5 12.1 3 [[4,2],[3,4]] p6 13 1 [[2,5],[3,4]] p7 13.5 2 [[2,2],[3,4]] p8 15.3 2 [[1,2],[3,4]] p9 23 1 [[5,6],[3,4]] p10 23.5 2 [[6,7],[3,4]] p11 24 4 [[3,2],[3,4]]
[0054] Table 2
[0055] Step 200: Determine the distance between each of the historical log data based on the numerical feature and the content feature;
[0056] The log operation behavior determination method provided in the embodiment of the present application may also include:
[0057] Step 210, determining the similarity between the operation content vectors;
[0058] Step 220: Determine the distance between each of the historical log data based on the similarity and the normalized operation time and operation type.
[0059] Specifically, as shown in Table 1 and Table 2, each historical log data corresponds to a data point. The embodiment of the present application provides a method for calculating the neighborhood distance between each data point based on the operation behavior characteristics. As shown in Formula 1, the calculation result of the following Formula 1 is the neighborhood distance. Assuming that one historical log data is (p1, x1, y1, A) and the other is (p2, x2, y2, B), where p is the operation record identifier, x represents the operation time, y represents the operation type, and AB represents the operation content vector matrix respectively. The distance calculation between the two historical log data is shown in Formula 1.
[0060]
[0061] sim(A,B) represents the similarity between two operation content vectors. The greater the similarity, the closer the distance between the two historical log data. The similarity is converted to between 0 and 1 through the sigmoid function. 1-sigmoid represents the change in distance. The K value is used to adjust the weight of the operation content in calculating the distance between historical log data. It can be adjusted and optimized according to the classification results.
[0062] Step 300: performing clustering processing on each of the historical log data based on the distance and the preset neighborhood parameter to obtain the operation behavior corresponding to each of the historical log data;
[0063] Step 400: construct an operation behavior table based on the numerical feature, the content feature and the operation behavior corresponding to each of the historical log data;
[0064] Specifically, the embodiment of the present application sets the neighborhood parameters Eps and MinPts of DBSCAN (i.e., the preset neighborhood parameters in the present embodiment), as well as the distance calculation formula, wherein Eps describes the neighborhood distance threshold of the historical log data, and MinPts describes the threshold value of the number of historical log data in the neighborhood with a distance of Eps. The DBSCAN clustering algorithm proposed in the embodiment of the present application is used to perform cluster analysis on the operation behavior characteristics of Zhang San's account, such as the operation time, operation type, and operation content, to obtain the operation behavior corresponding to each historical log data. Thus, it is determined which are regular operations and which are abnormal operations. The above-obtained operation behavior determination results are recorded and stored, and a log operation behavior table of user Zhang San is generated, so that the operation behavior of Zhang San's new log operation data can be determined based on the operation behavior table in the future.
[0065] Step 400: Determine the operation behavior of the new log data based on the operation behavior table.
[0066] Specifically, the operation behavior corresponding to Zhang San's new log operation data is determined by the above-mentioned feature extraction and cluster analysis method, and the label value corresponding to the new log operation data is obtained, wherein the label value includes normal operation, abnormal operation and normal operation cluster. The normal cluster contains normal log operation data. The operation behavior features of the new log data and the corresponding label value are updated to the operation behavior table.
[0067] This embodiment extracts features from historical log data, determines the distance between each historical log data based on the extracted numerical features and content features, clusters each historical log data based on the distance and preset neighborhood parameters, obtains the operation behavior corresponding to each historical log data, and then constructs an operation behavior table based on the obtained numerical features and content features, as well as the operation behavior corresponding to each historical log data. Finally, the operation behavior of new log data is determined through the operation behavior table, thereby improving the processing efficiency of log operation behavior.
[0068] Reference Figure 2 , Figure 2 This is the second flow chart of the method for determining log operation behavior in the embodiment of the present application. In one embodiment, the method for determining log operation behavior provided in the embodiment of the present application may also include:
[0069] Step 310, determining core data in each of the historical log data according to the distance between each of the historical log data, the number of log data in the neighborhood of the core data being greater than the preset number, the neighborhood of the core data being centered on the core data and determined by the preset distance as a radius;
[0070] Step 320, based on the neighborhood of the core data, determine the normal log data and the abnormal log data in each of the historical log data, the operation behavior corresponding to the normal log data is a normal operation, the abnormal log data is not in the neighborhood of the core data, and the operation behavior corresponding to the abnormal log data is an abnormal operation.
[0071] The log operation behavior determination method provided in the embodiment of the present application may also include:
[0072] Step 410, determining a normal cluster based on each of the normal log data, wherein the distance between each of the normal log data in the normal cluster is less than or equal to the preset distance;
[0073] Step 420, determining an abnormal cluster based on each of the abnormal log data, wherein the distance between each of the abnormal log data in the abnormal cluster is less than or equal to the preset distance;
[0074] Step 430 , determining that the operation behavior table includes the operation time, the operation type, the operation content vector, and the operation tag, wherein the operation tag includes the normal cluster, the abnormal cluster, and abnormal log data.
[0075] Specifically, as shown in Table 2 above, each historical log data corresponds to a data point. According to the operation time field, filter out the historical log data of the user in the past period of time, calculate the average distance of each historical log data as the preset distance Eps in the preset neighborhood parameter, and then sample the core data points n in each historical log data according to Eps, and calculate these core points P1, P2, ..., P n Points Pts1, Pts2, ..., Pts within the preset distance Eps n , through the following formula 2, the average value of these points is calculated as the preset number MinPts in the preset neighborhood parameter.
[0076]
[0077] First find an unvisited point p4 (11.2, 1, [[1, 2], [3, 4]]). If this point is a core (data) point, create a new cluster C1, put the points in the neighborhood of the core point into this cluster, and traverse the data points in its neighborhood; if the point p3 (10.3, 3, [[4, 2], [3, 4]]) in the neighborhood of the core point is also a core point, then the points in the neighborhood of point p3 (10.3, 3, [[4, 2], [3, 4]]) are also included in cluster C1. The definition of a core point is: if the number of data points within the Eps of a certain point exceeds Minpts, then this point is a core point; until cluster C1 no longer expands; until all points are processed; mark whether the point has been processed: set up two lists, the unvisited list stores unprocessed points, and the visited list stores processed points. Each time a point is processed, the unvisited list deletes the point and the visited list adds the point to change the processing status of the data point.
[0078] The definition of reachable number in the improved DBSCN algorithm proposed in this application is: if a point a is in the neighborhood of point b, then b is directly reachable by the core point a, and if point c is in the neighborhood of point b, then point c is indirectly reachable by point a, and a and c are connected in number; and the definition of abnormal data points / outlier data points, abnormal clusters / outlier clusters is: if a point is not in the neighborhood of a core point, it is not reachable in number from any core point, and a point that is neither a core point nor a boundary point is called an abnormal data point or an outlier data point. If the distance between two outlier data points is within Eps, the two outlier points are clustered into an abnormal cluster or an outlier cluster.
[0079] User log operation behaviors have certain complexity, and abnormal operation behaviors may also exist in normal clusters (for example, a scenario in which a large number of abnormal behaviors are performed in a certain period of time. If the operations in this scenario are relatively frequent and time-concentrated, they may be aggregated into a normal cluster in the DSCCAN classification). Abnormal points and abnormal clusters may also contain some normal operations (such as specific maintenance operations). Therefore, the normal clusters, abnormal points or abnormal clusters in the DBSCAN concept are related to high and low density areas, which are different from the actual concepts of normal and illegal operations. Therefore, it is necessary to further verify and determine the results of the operation behavior determination of this application, and finally determine which are the user's unconventional operations or abnormal operations.
[0080] Record Identification Log operation time Operation Type Username Operation content Tag value p1 2023-06-01 09:06:25 1 Zhang San [[1,2],[3,4]] <![CDATA[C1]]> p2 2023-06-01 09:01:04 2 Zhang San [[2,2],[3,4]] <![CDATA[C1]]> p3 2023-06-01 10:18:21 3 Zhang San [[1,3],[3,4]] <![CDATA[C1]]> p4 2023-06-01 11:12:12 1 Zhang San [[1,2],[3,4]] <![CDATA[C1]]> P5 2023-06-01 12:06:01 3 Zhang San [[4,2],[3,4]] <![CDATA[C1]]> p6 2023-06-01 13:00:11 1 Zhang San [[2,5],[3,4]] <![CDATA[C1]]> p7 2023-06-01 13:30:05 2 Zhang San [[2,2],[3,4]] <![CDATA[C1]]> p8 2023-06-01 15:19:01 2 Zhang San [[1,2],[3,4]] <![CDATA[C1]]> p9 2023-06-01 23:01:01 1 Zhang San [[5,6],[3,4]] <![CDATA[UC1]]> p10 2023-06-01 23:30:28 2 Zhang San [[6,7],[3,4]] <![CDATA[UC1]]> p11 2023-06-01 24:02:10 4 Zhang San [[3,2],[3,4]] <![CDATA[UP1]]>
[0081] Table 3
[0082] As shown in Table 3, the operation behavior table of user Zhang San in a certain period of time is selected. The fields in the table include the unique identifier of each historical log data, log operation time, operation type, user name, operation content and label value. Among them, the label value represents the operation behavior determination result of cluster analysis. Normal cluster label values are C1, C2, C3, ..., C n Indicates that abnormal clusters are UC1, UC2, UC3, ..., UC n Indicates that abnormal points are UP1, UP2, ..., UP n express.
[0083] This embodiment can store and record the log operation behavior determination result by using the improved DBSCAN quantity clustering algorithm, thereby improving the efficiency of log operation behavior determination.
[0084] Reference Figure 3 , Figure 3 This is a flow chart of the method for determining log operation behavior in an embodiment of the present application. In one embodiment, the method for determining log operation behavior provided in an embodiment of the present application may further include:
[0085] Step 510, determining an operation label corresponding to the new log data based on the preset neighborhood parameter and the distance between the new log data and each of the historical log data;
[0086] Step 520: When the operation tag corresponding to the new log data is the normal cluster, determine that the operation behavior corresponding to the new log data is a normal operation.
[0087] The log operation behavior determination method provided in the embodiment of the present application may also include:
[0088] Step 530: When the operation label corresponding to the new log data is the abnormal log data and the new log data is within the neighborhood of the abnormal log data, merge the new log data and the abnormal log data to obtain a new abnormal cluster;
[0089] Step 540 , when the operation label corresponding to the new log data is the abnormal cluster and the number of abnormal log data in the abnormal cluster is greater than the first number, clustering processing is performed on the new log data and each of the historical log data to obtain an operation behavior classification result.
[0090] Specifically, the operation behavior corresponding to the newly generated log operation data of the user (i.e., the new log data in this embodiment) is determined through the operation behavior table, and the operation behavior table is incrementally updated. The process of determining the operation behavior is the process of cluster analysis. First, the new log data needs to be converted into the corresponding data format. For example, when the user Zhang San has new log operation data, first, it is calculated according to the normal cluster points in the above content. If the data point corresponding to the new log data can reach the number of a normal cluster (C1 in this example), it is classified as the current normal cluster C1; if the data point corresponding to the new log data does not belong to any existing normal cluster, it is further checked whether it belongs to an abnormal point or is in the neighborhood of the abnormal cluster UC1; if it is in the neighborhood of the abnormal cluster UC1, it is classified into the abnormal cluster UC1; if it belongs to an abnormal point, it is merged with the abnormal point UP1 into a new abnormal cluster UC2; if neither of them belongs, it is classified into the new abnormal point UP2.
[0091] The specific process of updating the operation behavior table is as follows:
[0092] Filter outliers in the past period of time based on the operation time field, and calculate the average distance between two outliers based on the custom distance formula as the initial value of the radius threshold uEps. Then, based on uEps, sample n outliers uP1, uP2, ..., uP n , calculate the number of n abnormal points within the radius threshold range uPts1, uPts2..., uPts n , take the average value of these points as the initial value uMinPts of the abnormal cluster data quantity threshold, and the calculation formula of uMinPts is as follows:
[0093] As shown in formula 3;
[0094]
[0095] Calculate the custom distance between the new log data and some of the extracted core points. If the distance between the new log data point and a core point is less than or equal to the neighborhood radius Eps, add the new data to the neighborhood of the core point.
[0096] If the new log data is classified into the neighborhood of a core point, check whether the number of points within the neighborhood radius of the new data point exceeds MinPts. If so, mark it as a core point and add the data points in its neighborhood to the cluster.
[0097] If the new data is not added to the neighborhood of any core point, that is, the number of all core points is unreachable and is not in the neighborhood of other outliers and outlier clusters, it will be marked as an outlier. If the distance between the new outlier and the known outlier is less than the radius uEps, the two are merged into a new outlier cluster; if the distance to the known outlier is greater than the radius uEps, it is classified as a new outlier. If the distance to a point in a known outlier cluster is less than the radius uEps, it is merged into the outlier cluster. When the number of points in an outlier cluster exceeds the threshold uMinPts of the number of outlier clusters after being updated, in this case, in order to ensure the accuracy of clustering, the entire data set needs to be clustered again in the above steps.
[0098] The log operation behavior determination method provided in this embodiment uses the operation behavior table to determine the log operation behavior of new log data, thereby reducing the re-clustering operations and improving the efficiency of log operation behavior determination.
[0099] refer to Figure 4 , Figure 4 It is a structural diagram of the log operation behavior determination device in the embodiment of the present application. The log operation behavior determination device provided in the embodiment of the present application is described below. The log operation behavior determination device described below and the log operation behavior determination method described above can be referenced to each other.
[0100] Feature extraction module 401, used to extract numerical features and content features from historical log data;
[0101] A distance determination module 402, configured to determine the distance between each of the historical log data based on the numerical feature and the content feature;
[0102] A clustering processing module 403 is used to perform clustering processing on each of the historical log data based on the distance and a preset neighborhood parameter to obtain an operation behavior corresponding to each of the historical log data;
[0103] An operation behavior table construction module 404 is used to construct an operation behavior table based on the numerical feature, the content feature and the operation behavior corresponding to each of the historical log data;
[0104] The operation behavior classification module 405 is used to determine the operation behavior of the new log data based on the operation behavior table.
[0105] Optionally, the numerical feature includes operation time and operation type; the content feature includes an operation content vector; and the distance determination module includes:
[0106] A similarity determination unit, used to determine the similarity between the operation content vectors;
[0107] The distance determination unit is used to determine the distance between each of the historical log data based on the similarity and the normalized operation time and operation type.
[0108] Optionally, the preset neighborhood parameters include a preset number and a preset distance; and the clustering processing module includes:
[0109] A core data determination unit, configured to determine core data in each of the historical log data according to the distance between each of the historical log data, wherein the number of log data in the neighborhood of the core data is greater than the preset number, and the neighborhood of the core data is centered on the core data and the preset distance is determined as a radius;
[0110] The log data classification unit is used to determine the normal log data and the abnormal log data in each of the historical log data based on the neighborhood of the core data, the operation behavior corresponding to the normal log data is a normal operation, the abnormal log data is not in the neighborhood of the core data, and the operation behavior corresponding to the abnormal log data is an abnormal operation.
[0111] Optionally, the operation behavior table construction module includes:
[0112] A normal cluster determining unit, configured to determine a normal cluster based on each of the normal log data, wherein the distance between each of the normal log data in the normal cluster is less than or equal to the preset distance;
[0113] An abnormal cluster determining unit, configured to determine an abnormal cluster based on each of the abnormal log data, wherein the distance between each of the abnormal log data in the abnormal cluster is less than or equal to the preset distance;
[0114] The operation behavior table construction unit is used to determine that the operation behavior table includes the operation time, the operation type, the operation content vector and the operation label, and the operation label includes the normal cluster, the abnormal cluster and abnormal log data.
[0115] Optionally, the operation behavior classification module includes:
[0116] A first operation label determination unit, configured to determine an operation label corresponding to the new log data based on the preset neighborhood parameter and the distance between the new log data and each of the historical log data;
[0117] The second operation label determination unit is configured to determine, when the operation label corresponding to the new log data is the normal cluster, that the operation behavior corresponding to the new log data is a normal operation.
[0118] Optionally, the log operation behavior determination device further includes:
[0119] a data merging module, configured to merge the new log data with the abnormal log data to obtain a new abnormal cluster when the operation label corresponding to the new log data is the abnormal log data and the new log data is within the neighborhood of the abnormal log data;
[0120] The data clustering module is used to cluster the new log data and each of the historical log data to obtain an operation behavior classification result when the operation label corresponding to the new log data is the abnormal cluster and the number of abnormal log data in the abnormal cluster is greater than the first number.
[0121] Figure 5 The following is an example of a physical structure diagram of a device, such as Figure 5 As shown, the device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call a computer program in the memory 530 to execute the steps of the log operation behavior determination method.
[0122] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0123] On the other hand, an embodiment of the present application further provides a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the computer can execute the steps of the log operation behavior determination method provided in the above embodiments.
[0124] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0125] Through the description of the above implementation methods, technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the log operation behavior determination method described in each embodiment or some parts of the embodiment.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for determining log operation behavior, characterized in that: include: Extract numerical features and content features from historical log data; Determining the distance between each of the historical log data based on the numerical feature and the content feature; Based on the distance and the preset neighborhood parameter, clustering processing is performed on each of the historical log data to obtain the operation behavior corresponding to each of the historical log data; Based on the numerical feature, the content feature and the operation behavior corresponding to each of the historical log data, construct an operation behavior table; Based on the operation behavior table, the operation behavior of the new log data is determined.
2. The log operation behavior determination method according to claim 1, characterized in that: The numerical feature includes the operation time and the operation type; the content feature includes the operation content vector; and the determining the distance between each of the historical log data based on the numerical feature and the content feature includes: Determining the similarity between the operation content vectors; Based on the similarity and the normalized operation time and operation type, the distance between each of the historical log data is determined.
3. The log operation behavior determination method according to claim 1, characterized in that: The preset neighborhood parameters include a preset number and a preset distance; the clustering process is performed on each of the historical log data based on the distance and the preset neighborhood parameters to obtain the operation behavior corresponding to each of the historical log data, including: Determine core data in each of the historical log data according to the distance between each of the historical log data, the number of log data in the neighborhood of the core data is greater than the preset number, the neighborhood of the core data is centered on the core data, and the preset distance is determined as the radius; Based on the neighborhood of the core data, normal log data and abnormal log data in each of the historical log data are determined, the operation behavior corresponding to the normal log data is a normal operation, the abnormal log data is not in the neighborhood of the core data, and the operation behavior corresponding to the abnormal log data is an abnormal operation.
4. The log operation behavior determination method according to claim 3, characterized in that: The constructing the operation behavior table based on the numerical feature, the content feature and the operation behavior corresponding to each of the historical log data includes: Determine a normal cluster based on each of the normal log data, wherein the distance between each of the normal log data in the normal cluster is less than or equal to the preset distance; Determine an abnormal cluster based on each of the abnormal log data, wherein the distance between each of the abnormal log data in the abnormal cluster is less than or equal to the preset distance; It is determined that the operation behavior table includes the operation time, the operation type, the operation content vector and the operation label, and the operation label includes the normal cluster, the abnormal cluster and abnormal log data.
5. The log operation behavior determination method according to claim 4, characterized in that: Determining the operation behavior of the new log data based on the operation behavior table includes: Determine the operation label corresponding to the new log data based on the preset neighborhood parameter and the distance between the new log data and each of the historical log data; In a case where the operation label corresponding to the new log data is the normal cluster, it is determined that the operation behavior corresponding to the new log data is a normal operation.
6. The log operation behavior determination method according to claim 5, characterized in that: The step of determining the operation label corresponding to the new log data based on the preset neighborhood parameter and the distance between the new log data and each of the historical log data includes: When the operation label corresponding to the new log data is the abnormal log data and the new log data is within the neighborhood of the abnormal log data, merging the new log data and the abnormal log data to obtain a new abnormal cluster; When the operation label corresponding to the new log data is the abnormal cluster and the number of abnormal log data in the abnormal cluster is greater than the first number, clustering processing is performed on the new log data and each of the historical log data to obtain an operation behavior classification result.
7. A device for determining log operation behavior, characterized in that: include: Feature extraction module, used to extract numerical features and content features from historical log data; A distance determination module, used for determining the distance between each of the historical log data based on the numerical feature and the content feature; A cluster processing module, used for performing cluster processing on each of the historical log data based on the distance and a preset neighborhood parameter to obtain an operation behavior corresponding to each of the historical log data; An operation behavior table construction module, used to construct an operation behavior table based on the numerical feature, the content feature and the operation behavior corresponding to each of the historical log data; The operation behavior classification module is used to determine the operation behavior of the new log data based on the operation behavior table.
8. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the log operation behavior determination method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for determining log operation behavior according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Abnormal operation behavior detection processing method and device
CN108696486A
Abnormal behavior detection method and device, electronic equipment and storage medium
CN111538642A
Log analysis method and device, electronic equipment and medium
CN113238922A
Log classification method and system, computer equipment and readable storage medium
CN113656354A
Log anomaly detection method, device and equipment and computer readable storage medium
CN115344465A
Cited By
User information management method and system
CN121958319A
