A method, device, electronic device and storage medium for identifying data flow association
By obtaining and analyzing the characteristics of SQL operation logs and API access logs, calculating similarities and identifying data flow correlations, it solves the problem of high transformation costs in the existing technology and achieves efficient and accurate data flow correlation identification.
Patent Information
- Application Number
- CN202111542182.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-16
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-12-16
AI Technical Summary
In the existing technology, the application system is modified to realize the identification of data flow correlation relationships. The modification cost is high and the modification is difficult, which affects the efficiency of data flow correlation identification.
By obtaining the target SQL operation log and API access log, extract the SQL operation parameter characteristics and API request parameter characteristics, and calculate the similarity to identify the data flow relationship between the client, application server and database server to avoid modification of the application system.
It realizes low-cost and low-complexity identification of data flow correlations, adapts to high concurrency and complex application system scenarios, and improves the accuracy of identification.
Smart Images

Figure CN114357394B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data security technology, and in particular to a method, device, electronic device and storage medium for identifying data flow associations. Background Art
[0002] Data security has become a new trend in the security field. The difference between data security and network security and information security is that it requires persistent security operation capabilities. In the entire data security life cycle, the data transmission and sharing stage is the hardest hit area where data security accidents frequently occur.
[0003] Data flow monitoring is a new data security consensus capability formed to deal with the security issues of data transmission and sharing. Data flow monitoring focuses on how to break the black box of data flow, automatically discover and generate a flow link view of important data of important business systems, and further monitor the security of data assets and identify and monitor the risks of highly sensitive data transmission based on the flow link view, under the premise of zero interruption to the current business of the enterprise and zero intrusion to the network environment. Business data monitoring capabilities. How to accurately build the data flow association relationship between the client (or browser), application server and database server is a key step in data flow monitoring.
[0004] In the related technology, it is usually necessary to transform the application system to realize the identification of data flow association relationships. For example, a watermark is added to the log of the accessed page based on the HOOK function, and a corresponding related watermark is also added to the database log. The data flow association relationship is identified through watermark comparison. Although this method can improve the accuracy of identifying the flow association relationship of data between the client, application server and database server, the transformation cost of the application system is very high, the transformation is difficult, and it is easy to have a negative impact on the application system, thereby affecting the efficiency of identifying data flow association relationships. Summary of the invention
[0005] In order to solve the problem that the prior art method of identifying data flow association relationships by modifying the application system has high modification cost and difficulty, which affects the efficiency of identifying data flow association relationships, the embodiments of the present application provide a data flow association identification method, device, electronic device and storage medium.
[0006] In a first aspect, an embodiment of the present application provides a data flow association identification method, including:
[0007] Obtain a target structured query language SQL operation log and a target application program interface API access log, wherein the target SQL operation log is a SQL statement execution log of a specified application server operating its corresponding database server, and the target API access log is an access log generated by a client accessing the application server;
[0008] Divide the target API access log into corresponding API access log sets according to the identifiers of the API access logs, wherein API access logs with the same identifiers are divided into one API access log set;
[0009] For each SQL operation log in the target SQL operation log, extract SQL operation parameter features and SQL return result features in the SQL operation log; and for each API access log in each API access log set, extract API request parameter features and API response content features in the API access log;
[0010] For the SQL operation log and each API access log set, determine the similarity between the SQL operation log and the API access log set according to the SQL operation parameter feature, the SQL return result feature, the API request parameter feature and the API response content feature of each API access log in the API access log set;
[0011] According to the similarity between each SQL operation log in the target SQL operation log and each API access log set, the data flow association relationship between the client, the application server and the database server is identified.
[0012] In a possible implementation manner, after determining the similarity between the SQL operation log and the API access log set, the method further includes:
[0013] Generate a mapping relationship between the identifier of the SQL operation log, the identifier of the API access log, and the similarity, wherein the identifier of the API access log is the identifier of the API access log in the API access log set;
[0014] If it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated appears for the first time in the pre-established mapping relationship storage table, the mapping relationship is determined as the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, and the target mapping relationship is stored in the mapping relationship storage table, and the occurrence frequency is set to 1;
[0015] If it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated does not appear for the first time in the mapping relationship storage table, then based on the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity and the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, obtain the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, use the target mapping relationship to replace the historical mapping relationship, and increase the frequency of occurrence by 1;
[0016] The identification of the SQL operation log in the mapping relationship storage table, the identification of the API access log in each API access log set and the mapping relationship with the corresponding similarity are arranged in descending order of similarity, and the first N mapping relationships are retained.
[0017] In a possible implementation, the identifier of the SQL operation log is obtained by preprocessing the SQL operation statements in the SQL operation log; and the identifier of the API access log is determined according to the API access path in the API access log.
[0018] In a possible implementation, for the SQL operation log and each API access log set, determining the similarity between the SQL operation log and the API access log set according to the SQL operation parameter feature, the SQL return result feature, and the API request parameter feature and API response content feature of each API access log in the API access log set, specifically includes:
[0019] Determine the similarity of parameter features between the SQL operation log and each API access log in the API access log set according to the SQL operation parameter features and the API request parameter features of each API access log in the API access log set; and
[0020] Determine the similarity of the response characteristics of the SQL operation log and each API access log in the API access log set according to the SQL return result characteristics and the API response content characteristics of each API access log in the API access log set;
[0021] Determine the weights corresponding to the parameter feature similarity and the response feature similarity, respectively, according to the SQL operation type in the SQL operation log and the API request type in the API access log;
[0022] Determine the similarity between the SQL operation log and each API access log in the API access log set according to the parameter feature similarity between the SQL operation log and each API access log in the API access log set, the response feature similarity between the SQL operation log and each API access log in the API access log set, and the weights corresponding to the parameter feature similarity and the response feature similarity respectively;
[0023] The similarity between the SQL operation log and the set of API access logs is determined according to the similarity between the SQL operation log and each of the API access logs.
[0024] In a possible implementation, determining the similarity of parameter features between the SQL operation log and each API access log in the API access log set according to the SQL operation parameter features and the API request parameter features of each API access log in the API access log set specifically includes:
[0025] Determine a first minimum edit distance between the SQL operation parameter feature and an API request parameter feature of each API access log in the API access log set, and determine the reciprocal of each first minimum edit distance as the parameter feature similarity between the SQL operation log and each API access log in the API access log set; and
[0026] Determining the similarity of the response features of the SQL operation log and each API access log in the API access log set according to the SQL return result features and the API response content features of each API access log in the API access log set, specifically including:
[0027] Determine the second minimum edit distance between the SQL return result feature and the API response content feature of each API access log in the API access log set, and determine the reciprocal of each second minimum edit distance as the response feature similarity between the SQL operation log and each API access log in the API access log set.
[0028] In a possible implementation, the similarity between the SQL operation log and any API access log in the API access log set is determined by the following formula:
[0029] V i =w 1 *VP i +w 2 *VR i
[0030] Among them, V irepresents the similarity between the SQL operation log and the i-th API access log in the API access log set, i=1, 2, 3, ..., M, where M is the total number of API access logs in the API access log set;
[0031] VP i Indicates the parameter feature similarity between the SQL operation log and the i-th API access log in the API access log set;
[0032] VR i Indicates the similarity of response features between the SQL operation log and the i-th API access log in the API access log set;
[0033] w 1 A weight representing the similarity of parameter features between the SQL operation log and the i-th API access log in the API access log set;
[0034] w 2 a weight representing the similarity of response features between the SQL operation log and the i-th API access log in the API access log set; and
[0035] Determining the similarity between the SQL operation log and the set of API access logs according to the similarity between the SQL operation log and each of the API access logs specifically includes:
[0036] The similarity between the SQL operation log and the API access log set is determined by the following formula:
[0037]
[0038] in, Indicates the similarity between the SQL operation log and the API access log set.
[0039] In a possible implementation, the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log, and the similarity is obtained by the following formula:
[0040]
[0041] Wherein, SA (sql_id) represents the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, sql_id is the identifier of the SQL operation log, and api_id is the identifier of the API access log;
[0042] SV(sql_id) represents the mapping relationship between the identifier of the SQL operation log currently generated, the identifier of the API access log and the similarity, Indicates the similarity between the SQL operation log and the API access log set. The current occurrence frequency of SV (sql_id) is 1.
[0043] TSV(sql_id) represents the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity. Indicates the historical similarity between the SQL operation log and the API access log set, and the historical occurrence frequency of TSV (sql_id) is p.
[0044] In a second aspect, an embodiment of the present application provides a data flow association identification device, including:
[0045] An acquisition unit, used to acquire a target structured query language SQL operation log and a target application program interface API access log, wherein the target SQL operation log is an SQL statement execution log of a specified application server operating its corresponding database server, and the target API access log is an access log generated by a client accessing the application server;
[0046] A division unit, configured to divide the target API access log into corresponding API access log sets according to the identifiers of the API access logs, wherein API access logs with the same identifiers are divided into one API access log set;
[0047] a feature extraction unit, configured to extract, for each SQL operation log in the target SQL operation log, SQL operation parameter features and SQL return result features in the SQL operation log; and, for each API access log in each API access log set, API request parameter features and API response content features in the API access log;
[0048] A first determining unit is used to determine, for the SQL operation log and each API access log set, a similarity between the SQL operation log and the API access log set according to the SQL operation parameter feature, the SQL return result feature, and the API request parameter feature and API response content feature of each API access log in the API access log set;
[0049] The identification unit is used to identify the data flow association relationship between the client, the application server and the database server according to the similarity between each SQL operation log in the target SQL operation log and each API access log set.
[0050] In a possible implementation manner, the device further includes:
[0051] a generating unit, configured to generate a mapping relationship between an identifier of the SQL operation log, an identifier of the API access log, and the similarity after determining the similarity between the SQL operation log and the set of API access logs, wherein the identifier of the API access log is an identifier of an API access log in the set of API access logs;
[0052] A second determination unit is used for, if it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated appears for the first time in a pre-established mapping relationship storage table, then determining the mapping relationship as a target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, and storing the target mapping relationship in the mapping relationship storage table, and setting the occurrence frequency to 1; if it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated does not appear for the first time in the mapping relationship storage table, then based on the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity and the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, obtaining the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, replacing the historical mapping relationship with the target mapping relationship, and adding 1 to the occurrence frequency;
[0053] A processing unit is used to arrange the mapping relationships of the identifiers of the SQL operation logs in the mapping relationship storage table, the identifiers of the API access logs in the API access log sets, and the corresponding similarities in order of similarity from large to small, and retain the first N mapping relationships.
[0054] In a possible implementation, the identifier of the SQL operation log is obtained by preprocessing the SQL operation statements in the SQL operation log; and the identifier of the API access log is determined according to the API access path in the API access log.
[0055] In a possible implementation manner, the first determining unit is specifically configured to:
[0056] Determine the similarity of parameter features between the SQL operation log and each API access log in the API access log set according to the SQL operation parameter features and the API request parameter features of each API access log in the API access log set; and
[0057] Determine the similarity of the response characteristics of the SQL operation log and each API access log in the API access log set according to the SQL return result characteristics and the API response content characteristics of each API access log in the API access log set;
[0058] Determine the weights corresponding to the parameter feature similarity and the response feature similarity, respectively, according to the SQL operation type in the SQL operation log and the API request type in the API access log;
[0059] Determine the similarity between the SQL operation log and each API access log in the API access log set according to the parameter feature similarity between the SQL operation log and each API access log in the API access log set, the response feature similarity between the SQL operation log and each API access log in the API access log set, and the weights corresponding to the parameter feature similarity and the response feature similarity respectively;
[0060] The similarity between the SQL operation log and the set of API access logs is determined according to the similarity between the SQL operation log and each of the API access logs.
[0061] In a possible implementation manner, the first determining unit is specifically configured to:
[0062] Determine a first minimum edit distance between the SQL operation parameter feature and an API request parameter feature of each API access log in the API access log set, and determine the reciprocal of each first minimum edit distance as the parameter feature similarity between the SQL operation log and each API access log in the API access log set; and
[0063] Determine the second minimum edit distance between the SQL return result feature and the API response content feature of each API access log in the API access log set, and determine the reciprocal of each second minimum edit distance as the response feature similarity between the SQL operation log and each API access log in the API access log set.
[0064] In a possible implementation manner, the first determining unit is specifically configured to determine the similarity between the SQL operation log and any API access log in the API access log set by using the following formula:
[0065] V i =w 1 *VP i +w 2 *VR i
[0066] Among them, V i represents the similarity between the SQL operation log and the i-th API access log in the API access log set, i=1, 2, 3, ..., M, where M is the total number of API access logs in the API access log set;
[0067] VP i Indicates the parameter feature similarity between the SQL operation log and the i-th API access log in the API access log set;
[0068] VR i Indicates the similarity of response features between the SQL operation log and the i-th API access log in the API access log set;
[0069] w 1 A weight representing the similarity of parameter features between the SQL operation log and the i-th API access log in the API access log set;
[0070] w 2 a weight representing the similarity of response features between the SQL operation log and the i-th API access log in the API access log set; and
[0071] Determining the similarity between the SQL operation log and the set of API access logs according to the similarity between the SQL operation log and each of the API access logs specifically includes:
[0072] The similarity between the SQL operation log and the API access log set is determined by the following formula:
[0073]
[0074] in, Indicates the similarity between the SQL operation log and the API access log set.
[0075] In a possible implementation manner, the second determining unit is specifically configured to obtain a target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log, and the similarity through the following formula:
[0076]
[0077] Wherein, SA (sql_id) represents the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, sql_id is the identifier of the SQL operation log, and api_id is the identifier of the API access log;
[0078] SV(sql_id) represents the mapping relationship between the identifier of the SQL operation log currently generated, the identifier of the API access log and the similarity, Indicates the similarity between the SQL operation log and the API access log set. The current occurrence frequency of SV (sql_id) is 1.
[0079] TSV(sql_id) represents the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity. Indicates the historical similarity between the SQL operation log and the API access log set, and the historical occurrence frequency of TSV (sql_id) is p.
[0080] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the data flow association identification method described in the present application is implemented.
[0081] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps in the data flow association identification method described in the present application are implemented.
[0082] The beneficial effects of the embodiments of the present application are as follows:
[0083] The data flow association identification method, device, electronic device and storage medium provided in the embodiment of the present application obtain the target SQL (Structured Query Language, Structured Query Language) operation log and the target API (Application Programming Language) operation log. The target SQL operation log is the SQL statement execution log of the specified application server operating its corresponding database server, and the target API access log is the access log generated by the client accessing the application server. The target API access log is divided into corresponding API access log sets according to the identifier of the API access log, wherein the API access logs with the same identifier of the API access log are divided into an API access log set. For each SQL operation log in the target operation log, the SQL operation parameter feature and the SQL return result feature in the SQL operation log are extracted, and for each API access log in each API access log set, the API request parameter feature and the API response content feature in the API access log are extracted. For the SQL operation log and each API access log set, according to the SQL operation parameter feature, the SQL return result feature, the API request parameter feature and the API response content feature of each API access log in the API access log set, the similarity between the SQL operation log and the API access log set is determined. Then, according to each SQL operation log in the target SQL operation log and its corresponding API access logs, the similarity between the SQL operation log and the API access log set is determined. The similarity of the PI access log set is used to identify the data flow association relationship between the client, application server and database server. In this application, by screening the SQL operation log and the corresponding API access log, by extracting features from the SQL operation parameters and SQL return results in the SQL operation log, and the API request parameters and API response content in the API access log in the API access log set corresponding to the SQL operation log, and then determining the similarity between the SQL operation log and the API access log set based on the SQL operation parameter features, SQL return result features, API request parameter features of the API access log and API response content features, and identifying the data flow relationship between the client, application server and database server through the similarity. Only by extracting and analyzing the features of the SQL operation log and the API access log, the data flow association relationship between the client, application server and database server can be accurately identified. There is no need to transform the application system, and the cost is low. In addition, by analyzing the similarity of the log content (i.e., operation data and response data) of the SQL operation log and the API access log, it can better cope with the scenarios of high concurrency and complex application systems, and improve the accuracy of identification.
[0084] Other features and advantages of the present application will be described in the subsequent description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0086] Figure 1 A schematic diagram of an application scenario of the data flow association identification method provided in an embodiment of the present application;
[0087] Figure 2 A schematic diagram of the implementation process of the data flow association identification method provided in the embodiment of the present application;
[0088] Figure 3 A schematic diagram of an implementation process for determining the similarity between an SQL operation log and any API access log set provided in an embodiment of the present application;
[0089] Figure 4 A schematic diagram of an implementation flow of determining a mapping relationship between an identifier of an SQL operation log, an identifier of an API access log in an API access log set, and a corresponding similarity provided in an embodiment of the present application;
[0090] Figure 5 A schematic diagram of the structure of a data flow association identification device provided in an embodiment of the present application;
[0091] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0092] In order to solve the problems in the background technology, the embodiments of the present application provide a data flow association identification method, device, electronic device and storage medium.
[0093] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.
[0094] In this article, it is necessary to understand that the technical terms involved in this application are:
[0095] 1. SQL operation log: SQL statement execution log of the application server operating the database server, where the database server is a server used to store the data of the application server.
[0096] 2. API operation log: access log generated by the client accessing the application server.
[0097] First reference Figure 1 , which is a schematic diagram of an application scenario of the data flow association identification method provided in an embodiment of the present application. The data flow association identification method provided in an embodiment of the present application is for identifying the data flow association relationship between the client 110, the application server 120 and the database server 130. The client 110 and the application server 120 are connected through a network, and the application server 120 and the database server 130 are connected through a network. When a user requests data from the application server 120 through the client 110 (or a browser), the application server 120 obtains the requested data from the database server 130 and returns it to the client 110. When the client 110 accesses the application server 120, an API operation log is generated, and when the application server 120 accesses the database server 130, an SQL operation log is generated.
[0098] Based on the above application scenarios, the following will refer to the attached Figure 2 to Figure 4 The exemplary embodiments of the present application are described in more detail. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present application, and the implementation of the present application is not limited in any way. On the contrary, the implementation of the present application can be applied to any applicable scenario.
[0099] like Figure 2 As shown, it is a schematic diagram of the implementation process of the data flow association identification method provided in the embodiment of the present application. The data flow association identification method can be applied to a server or a terminal device. The embodiment of the present application does not limit this. The embodiment of the present application only uses the server as the execution subject for explanation. The data flow association identification method can specifically include the following steps:
[0100] S21. Obtain a target SQL operation log and a target API access log, wherein the target SQL operation log is a SQL statement execution log of a specified application server operating its corresponding database server, and the target API access log is an access log generated when a client accesses the application server.
[0101] During specific implementation, the server obtains the SQL statement execution log of the designated application server operating its corresponding database server, namely: the target SQL operation log, and obtains the access log generated by the client (or browser) accessing the designated application server, namely: the target API access log. Among them, the designated application server can be a server that provides any application service. For example, when the application server is a Baidu server, the database server is a database server that stores the data of the Baidu server. There can be multiple designated servers, and this embodiment of the present application does not limit this. An SQL operation log may include, but is not limited to, the following information: SQL operation statement, application server IP, database server IP, SQL operation time, SQL operation type, SQL operation parameters, and SQL return results. An API access log may include, but is not limited to, the following information: API access path (i.e., URL (Uniform Resource Locator)), client IP, application server IP, API response return time, API request parameters, API response content, API request type, and other information. The target SQL operation log and target API access log to be obtained must meet the following conditions: the application server IP in the target SQL operation log is the same as the application server IP in the target API access log, both are the specified application server IP, and the API response return time is greater than the SQL operation time, and the API response return time is less than the SQL operation time + the API maximum timeout period, where the API maximum timeout period can be set based on experience. When a user sends a data request to the application server through a client (or browser), the application server needs to first operate the SQL statement of the database server, and then the database server sends the requested data to the application server, and the application server then responds to the client with an API to return the data sent by the database server to the client. Therefore, the API response return time is greater than the SQL operation time; in a complete API access, the process of data reaching the application server from the database server and then reaching the client (or browser) from the application server is completed within the API maximum timeout period, therefore, the API response return time is less than the SQL operation time + the API maximum timeout period.
[0102] S22: Divide the target API access log into corresponding API access log sets according to the identifiers of the API access logs, wherein API access logs with the same identifiers are divided into one API access log set.
[0103] In specific implementation, the server preprocesses the SQL operation statement in each SQL operation log in the acquired target SQL operation log to obtain the SQL operation log identifier, and determines the API access log identifier according to the API access path in each API access log in the acquired target API access log.
[0104] Specifically, the SQL operation statements in the SQL operation log may be preprocessed according to the following rules to obtain the corresponding SQL operation log identifier:
[0105] (1) Capitalize all letters in SQL statements except for strings in double quotes;
[0106] (2) Replace the string in single quotes in the SQL operation statement with a specified string, such as: #;
[0107] (3) Clear the comments in the SQL operation statement (the comment symbols can be / *……* / , or --, etc.);
[0108] (4) Replace the carriage return, line feed, tab, and other symbols in the SQL operation statement with spaces, replace multiple consecutive spaces with one space, and remove the spaces at the beginning and end of the SQL operation statement;
[0109] (5) Replace the constant value in the expression in the SQL operation statement with 0.
[0110] In this way, the identification of SQL operation logs can be standardized and unified, the dimension of SQL operation logs can be reduced, and multiple mapping relationships with API operation logs due to different writing methods or parameters in the same SQL operation log can be avoided, thereby reducing resource consumption.
[0111] For example, a SQL operation statement in an SQL operation log is:
[0112] select*from abc where name='zhangsan'and age=14, then the identifier of the SQL operation log is: SELET*FROM ABC WHERE NAME='#'AND AGE=0.
[0113] Before determining the identifiers of each API access log in the target API access log, you can first remove the API access path, that is, the API access logs with URL suffixes such as css, js, jpg, gif, ico, and png. Since the above-mentioned API access logs are API access log records generated by page resource loading, they do not involve SQL operations.
[0114] During the implementation process, the following rules can be used to identify API access logs:
[0115] If it is determined that the API access path in the API access log contains a specified symbol, the string before the specified symbol is determined as the identifier of the API access log. If it is determined that the API access path in the API access log does not contain the specified symbol, the API access path is used as the identifier of the API access log. The specified symbol may be a question mark (?).
[0116] For example, the URL of an API access log is:
[0117] https: / / inone.intra.nsfocus.com / confluence / pages / viewpage.action?pageId=15729003, the string before ? https: / / inone.intra.nsfocus.com / confluence / pages / viewpage.action can be used as the identifier of the API access log.
[0118] From the above method of determining the identifier of the API access log, it can be seen that if the character string before ? in the URLs of multiple API access logs is the same, but the character string after ? is different, then these multiple API access logs also have the same identifier. Therefore, the identifier of the same API access log can correspond to multiple different API access logs. Based on this, the target API access logs can be divided into an API access log set according to the identifier of the API access log. In this way, multiple API access log sets can be divided, wherein the API access logs contained in each API access log set have the same identifier.
[0119] S23. For each SQL operation log in the target SQL operation log, extract the SQL operation parameter features and SQL return result features in the SQL operation log; and for each API access log in each API access log set, extract the API request parameter features and API response content features in the API access log.
[0120] In specific implementation, for each SQL operation log in the target SQL operation log, the server can extract the SQL operation parameter features and SQL return result features in the SQL operation log through regular methods, named entity recognition methods, or template techniques, and sort the extracted SQL operation parameter features in lexicographical order and splice them to generate processed SQL operation parameter features, and sort the extracted SQL return result features in lexicographical order and splice them to generate processed SQL return result features. For each API access log in each API access log set, the server extracts the API request parameter features and API response content features in the API access log through regular methods, named entity recognition methods, or template techniques, and sorts the extracted API request parameter features in lexicographical order and splices them to generate processed API request parameter features, and sorts the extracted API response content features in lexicographical order and splices them to generate processed API response content features.
[0121] For example, the SQL operation parameters in a SQL operation log are:
[0122] Varchar:Zhang San Int:18
[0123] Then the SQL operation parameter features are: [Zhang San, 18]. Sort [Zhang San, 18] in lexicographical order and splice them with spaces to get the processed SQL operation parameter features: "18 Zhang San", or "Zhang San 18".
[0124] It should be noted that when sorting the SQL operation parameter features, the order of numbers, words, and English is not limited, as long as the sorting rules for SQL operation parameter features, SQL return result features, API request parameter features, and API response content features are consistent. In this embodiment of the application, only "18 Zhang San" is used as an example for illustration.
[0125] The SQL return result in this SQL operation log is:
[0126] name(Varcher)_age(Int)_no(Varcher)_borth(Varcher)Zhang San_23_20214578_1998-08-15
[0127] Then the SQL return result features are: [Zhang San, 23, 20214578, 1998-08-15]. Sort [Zhang San, 23, 20214578, 1998-08-15] in lexicographical order and splice them with spaces to get the processed SQL operation parameter features: "1998-08-15 20214578 23 Zhang San".
[0128] For example, the API request parameters in an API access log are as follows:
[0129] {"name":"Zhang San", "age":23}
[0130] Then the API request parameter features are: [Zhang San, 23]. After sorting [Zhang San, 23] in lexicographical order and concatenating with spaces, the processed API request parameter features are: "23 Zhang San".
[0131] The API response content in this API access log is:
[0132] {"name":"Zhang San", "age":23, "no":"20214578", "borth":"1998-08-15"}
[0133] Then the API response content features are: [Zhang San, 23, 20214578, 1998-08-15]. After sorting [Zhang San, 23, 20214578, 1998-08-15] in lexicographical order and concatenating with spaces, the processed API response content features are: "1998-08-15 20214578 23 Zhang San".
[0134] The above operations of extracting, sorting, and then concatenating the SQL operation parameter features, SQL return result features, API request parameter features, and API response content features are based on the consideration that during the process of data from the database server to the application server and then from the application server to the client (or browser), the data format, order, etc. are very likely to change. Directly calculating the text similarity values of SQL operation parameters, API request parameters, and SQL return results, API response content will be very low, and the discrimination is not high, which will further affect the accuracy of identifying the data flow association relationship. Therefore, through the above operations of feature extraction, sorting, and concatenation, the influence of data format, order, etc. on similarity can be eliminated, and the accuracy of identifying the data flow association relationship is improved.
[0135] S24. For each SQL operation log and each API access log set, determine the similarity between the SQL operation log and the API access log set according to the SQL operation parameter features, SQL return result features, API request parameter features, and API response content features of each API access log in the API access log set.
[0136] Specifically, for each SQL operation log in the target SQL operation log, for this SQL operation log and each API access log set, as follows Figure 3The process shown in FIG. 1 determines the similarity between the SQL operation log and any API access log set, and may include the following steps:
[0137] S241. Determine the similarity of parameter features between the SQL operation log and each API access log in the API access log set according to the SQL operation parameter features and the API request parameter features of each API access log in the API access log set.
[0138] In specific implementation, the server determines, for the SQL operation log and any API access log set, the minimum edit distance (which can be recorded as the first minimum edit distance) between the SQL operation parameter feature and the API request parameter feature of each API access log in the API access log set, and determines the inverse of each first minimum edit distance as the parameter feature similarity between the SQL operation log and each API access log in the API access log set.
[0139] The minimum edit distance between the SQL operation parameter feature and the API request parameter feature refers to: the minimum number of operations required to convert the SQL operation parameter feature into the API request parameter feature (or convert the API request parameter feature into the SQL operation parameter feature) using character operations. The smaller the minimum edit distance between the SQL operation parameter feature and the API request parameter feature, the more similar the two are. Therefore, the inverse of the minimum edit distance can be used as a measure of the similarity between the two, but is not limited to it. This is not limited to the embodiments of the present application.
[0140] S242: Determine the similarity of the response characteristics of the SQL operation log and each API access log in the API access log set according to the SQL return result characteristics and the API response content characteristics of each API access log in the API access log set.
[0141] In specific implementation, the server determines the second minimum edit distance between the SQL return result feature and the API response content feature of each API access log in the API access log set, and determines the reciprocal of each second minimum edit distance as the similarity of the response feature between the SQL operation log and each API access log in the API access log set.
[0142] Specifically, the minimum edit distance between the SQL return result feature and the API response content feature refers to: the minimum number of operations required to convert the SQL return result feature into the API response content feature (or convert the API response content feature into the SQL return result feature) using character operations. The smaller the minimum edit distance between the SQL operation parameter feature and the API request parameter feature, the more similar the two are.
[0143] In the specific implementation process, when calculating the above-mentioned parameter feature similarity and response feature similarity, it is not limited to using the above-mentioned minimum edit distance algorithm. Any algorithm that can calculate similarity, such as the cosine similarity algorithm and the Hamming distance algorithm, can also be used. The embodiment of the present application does not limit this.
[0144] S243. Determine the weights corresponding to the parameter feature similarity and the response feature similarity, respectively, according to the SQL operation type in the SQL operation log and the API request type in the API access log.
[0145] In specific implementation, the server pre-sets different weight combinations of parameter feature similarity and response feature similarity for different combinations of SQL operation types and API request types. The weights can be set as follows:
[0146]
[0147] Among them, sql_type represents the SQL operation type, api_methon represents the API request type, Otherwise represents other types, Update represents the update operation, Delete represents the delete operation, Insert represents the insert operation, GET represents the GET request in the http protocol, Select represents the select operation, and the weight of the parameter feature similarity is w 1 , the weight of the response feature similarity is w 2 , w 1 +w 2 = 1. When the SQL operation type is an update operation, a delete operation, or an insert operation, and the API request type is not a GET request, the weight combination of the parameter feature similarity and the response feature similarity (w 1 , w 2 ) is set to (a 1 , b 1 ), when the SQL operation type is an update operation, a delete operation, or an insert operation, and the API request type is a GET request, the weights of the parameter feature similarity and the response feature similarity can be combined (w 1 , w 2 ) is set to (a 2 , b 2 ), when the SQL operation type is a select operation, no matter what the API request type is, the weighted combination of parameter feature similarity and response feature similarity (w 1 , w 2 ) is set to (a 3 , b 3 ), when the SQL operation type and the API request type are any other types, the weights of the parameter feature similarity and the response feature similarity can be combined (w 1, w 2 ) is set to (a 4 , b 4 The weights of the above groups can be set according to experience. For example, (a 1 , b 1 ) can be (0.8, 0.2), (a 2 , b 2 ) can be (0.6, 0.4), (a 3 , b 3 ) can be (0.3, 0.7), (a 4 , b 4 ) can be (0.5, 0.5). During the implementation process, the value of each group of weight combinations can be adjusted and optimized according to the actual application scenario and effect, and the embodiment of the present application does not limit this.
[0148] S244. Determine the similarity between the SQL operation log and each API access log in the API access log set based on the parameter feature similarity between the SQL operation log and each API access log in the API access log set, the response feature similarity between the SQL operation log and each API access log in the API access log set, and the weights corresponding to the parameter feature similarity and the response feature similarity.
[0149] In specific implementation, the server can determine the similarity between the SQL operation log and any API access log in the API access log set by using the following formula:
[0150] V i =w 1 *VP i +w 2 *VR i
[0151] Among them, V i represents the similarity between the SQL operation log and the i-th API access log in the API access log set, i=1, 2, 3, ..., M, M is the total number of API access logs in the API access log set;
[0152] VP i Indicates the similarity of parameter features between the SQL operation log and the i-th API access log in the API access log set;
[0153] VR i Indicates the similarity of response features between the SQL operation log and the i-th API access log in the API access log set;
[0154] w 1 The weight representing the similarity of parameter features between the SQL operation log and the i-th API access log in the API access log set;
[0155] w 2 The weight that represents the similarity between the response features of the SQL operation log and the i-th API access log in the API access log set.
[0156] S245. Determine the similarity between the SQL operation log and the set of API access logs according to the similarity between the SQL operation log and each API access log.
[0157] In specific implementation, the server can determine the similarity between the SQL operation log and the API access log set through the following formula:
[0158]
[0159] in, Indicates the similarity between the SQL operation log and the API access log set.
[0160] That is to say, the average of the similarities between the SQL operation log and each API access log in the API access log set is taken as the similarity between the SQL operation log and the API access log set. The identifiers of each API access log in the API access log set are the same. According to the method of determining the identifiers of the aforementioned API access logs, it can be seen that an API access log set is essentially the API access log generated when a client accesses different web pages of the same application server. Then, the similarity between the SQL operation log and an API access log set is essentially the similarity between the SQL operation log and the API access log generated when a client accesses different web pages of the application server.
[0161] It should be noted that in the embodiment of the present application, the execution order of step S241 and step S242 is not limited, and step S241 and step S242 can be executed at the same time.
[0162] S25. According to the similarity between each SQL operation log in the target SQL operation log and each API access log set, the data flow association relationship between the client, the application server and the database server is identified.
[0163] In specific implementation, if the similarity value is larger, it means that the data flow correlation relationship between the data from the client to the application server and the database server is larger.
[0164] As a possible implementation method, in order to further improve the accuracy of identifying data flow association relationships and make it easier for data security maintenance personnel to manage data, in an embodiment of the present application, after calculating the similarity between each SQL operation log and the API access log set, a mapping relationship between the identification of the SQL operation log, the identification of the API access log in the API access log set and the similarity can be further established, and the current mapping relationship can be corrected and updated in real time based on the historical mapping relationship.
[0165] Based on this, after determining the similarity between the SQL operation log and any API access log set, you can also follow the following steps: Figure 4 The process shown determines the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log in the API access log set, and the corresponding similarity, and may include the following steps:
[0166] S31. Generate a mapping relationship between the identifier of the SQL operation log, the identifier of the API access log, and the similarity, where the identifier of the API access log is the identifier of the API access log in the API access log set.
[0167] In specific implementation, the server generates a mapping relationship between the identifier of the SQL operation log, the identifier of the API access log in the API access log set, and the corresponding similarity (i.e., the similarity between the identifier of the SQL operation log and the API access log set) for each SQL operation log in the target SQL operation log and each API access log set.
[0168] S32. If it is determined that the mapping relationship between the identifier of the currently generated SQL operation log, the identifier of the API access log and the similarity appears for the first time in the pre-established mapping relationship storage table, the mapping relationship is determined as the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, and the target mapping relationship is stored in the mapping relationship storage table, and the occurrence frequency is set to 1.
[0169] S33. If it is determined that the mapping relationship between the identifier of the currently generated SQL operation log and the identifier of the API access log and the similarity does not appear for the first time in the mapping relationship storage table, then based on the historical mapping relationship between the identifier of the SQL operation log and the identifier of the API access log and the similarity and the mapping relationship between the identifier of the SQL operation log and the identifier of the API access log and the similarity, the target mapping relationship between the identifier of the SQL operation log and the identifier of the API access log and the similarity is obtained, and the historical mapping relationship is replaced by the target mapping relationship, and the frequency of occurrence is increased by 1.
[0170] During specific implementation, the server maintains a mapping relationship storage table for storing the mapping relationship between the SQL identifier, the identifier of the API access log and the corresponding similarity.
[0171] The server can obtain the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log, and the similarity through the following formula:
[0172]
[0173] Wherein, SA (sql_id) represents the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, sql_id is the identifier of the SQL operation log, and api_id is the identifier of the API access log;
[0174] SV(sql_id) represents the mapping relationship between the identifier of the SQL operation log currently generated, the identifier of the API access log and the similarity, Indicates the similarity between the SQL operation log and the API access log set. The current occurrence frequency of SV (sql_id) is 1.
[0175] TSV(sql_id) represents the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity. Indicates the historical similarity between the SQL operation log and the API access log set, and the historical occurrence frequency of TSV (sql_id) is p.
[0176] S34. Arrange the SQL operation log identifiers in the mapping relationship storage table, the API access log identifiers in each API access log set, and the mapping relationships with corresponding similarities in descending order of similarity, and retain the first N mapping relationships.
[0177] In the specific implementation, for each SQL operation log, the mapping relationship between the identifier of the SQL operation log and the identifiers of the API access logs in each API access log set and the corresponding similarities are arranged in order of similarity from large to small, and only the mapping relationship between the identifiers of the first N SQL operation logs and the identifiers of the API access logs and the corresponding similarities corresponding to the previous SQL operation log is retained, where N can be set according to actual conditions, and the embodiment of the present application does not limit this.
[0178] In this way, the API access logs with high similarity to each SQL operation log can be easily found in the mapping relationship storage table. The higher the similarity, the higher the data flow correlation.
[0179] The data flow association identification method, device, electronic device and storage medium provided in the embodiment of the present application obtain the target SQL (Structured Query Language, Structured Query Language) operation log and the target API (Application Programming Language) operation log. The target SQL operation log is the SQL statement execution log of the specified application server operating its corresponding database server, and the target API access log is the access log generated by the client accessing the application server. The target API access log is divided into corresponding API access log sets according to the identifier of the API access log, wherein the API access logs with the same identifier of the API access log are divided into an API access log set. For each SQL operation log in the target operation log, the SQL operation parameter feature and the SQL return result feature in the SQL operation log are extracted, and for each API access log in each API access log set, the API request parameter feature and the API response content feature in the API access log are extracted. For the SQL operation log and each API access log set, according to the SQL operation parameter feature, the SQL return result feature, the API request parameter feature and the API response content feature of each API access log in the API access log set, the similarity between the SQL operation log and the API access log set is determined. Then, according to each SQL operation log in the target SQL operation log and its corresponding API access logs, the similarity between the SQL operation log and the API access log set is determined. The similarity of the PI access log set is used to identify the data flow association relationship between the client, application server and database server. In this application, by screening the SQL operation log and the corresponding API access log, by extracting features from the SQL operation parameters and SQL return results in the SQL operation log, and the API request parameters and API response content in the API access log in the API access log set corresponding to the SQL operation log, and then determining the similarity between the SQL operation log and the API access log set based on the SQL operation parameter features, SQL return result features, API request parameter features of the API access log and API response content features, and identifying the data flow relationship between the client, application server and database server through the similarity. Only by extracting and analyzing the features of the SQL operation log and the API access log, the data flow association relationship between the client, application server and database server can be accurately identified. There is no need to transform the application system, and the cost is low. In addition, by analyzing the similarity of the log content (i.e., operation data and response data) of the SQL operation log and the API access log, it can better cope with the scenarios of high concurrency and complex application systems, and improve the accuracy of identification.
[0180] Based on the same inventive concept, an embodiment of the present application also provides a data flow association identification device. Since the principle of solving the problem by the above-mentioned data flow association identification device is similar to that of the data flow association identification method, the implementation of the above-mentioned device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0181] like Figure 5 As shown, it is a structural schematic diagram of a data flow association identification device provided in an embodiment of the present application, which may include:
[0182] The acquisition unit 41 is used to acquire a target structured query language SQL operation log and a target application program interface API access log, wherein the target SQL operation log is an SQL statement execution log of a specified application server operating its corresponding database server, and the target API access log is an access log generated by a client accessing the application server;
[0183] A dividing unit 42, configured to divide the target API access log into corresponding API access log sets according to the identifiers of the API access logs, wherein API access logs with the same identifiers are divided into one API access log set;
[0184] The feature extraction unit 43 is used to extract the SQL operation parameter features and the SQL return result features in each SQL operation log in the target SQL operation log; and to extract the API request parameter features and the API response content features in each API access log in each API access log set;
[0185] A first determining unit 44 is configured to determine, for the SQL operation log and each API access log set, a similarity between the SQL operation log and the API access log set according to the SQL operation parameter feature, the SQL return result feature, and the API request parameter feature and API response content feature of each API access log in the API access log set;
[0186] The identification unit 45 is used to identify the data flow association relationship between the client, the application server and the database server according to the similarity between each SQL operation log in the target SQL operation log and each API access log set.
[0187] In a possible implementation manner, the device further includes:
[0188] a generating unit, configured to generate a mapping relationship between an identifier of the SQL operation log, an identifier of the API access log, and the similarity after determining the similarity between the SQL operation log and the set of API access logs, wherein the identifier of the API access log is an identifier of an API access log in the set of API access logs;
[0189] A second determination unit is used for, if it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated appears for the first time in a pre-established mapping relationship storage table, then determining the mapping relationship as a target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, and storing the target mapping relationship in the mapping relationship storage table, and setting the occurrence frequency to 1; if it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated does not appear for the first time in the mapping relationship storage table, then based on the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity and the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, obtaining the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, replacing the historical mapping relationship with the target mapping relationship, and adding 1 to the occurrence frequency;
[0190] A processing unit is used to arrange the mapping relationships of the identifiers of the SQL operation logs in the mapping relationship storage table, the identifiers of the API access logs in the API access log sets, and the corresponding similarities in order of similarity from large to small, and retain the first N mapping relationships.
[0191] In a possible implementation, the identifier of the SQL operation log is obtained by preprocessing the SQL operation statements in the SQL operation log; and the identifier of the API access log is determined according to the API access path in the API access log.
[0192] In a possible implementation manner, the first determining unit 44 is specifically configured to:
[0193] Determine the similarity of parameter features between the SQL operation log and each API access log in the API access log set according to the SQL operation parameter features and the API request parameter features of each API access log in the API access log set; and
[0194] Determine the similarity of the response characteristics of the SQL operation log and each API access log in the API access log set according to the SQL return result characteristics and the API response content characteristics of each API access log in the API access log set;
[0195] Determine the weights corresponding to the parameter feature similarity and the response feature similarity, respectively, according to the SQL operation type in the SQL operation log and the API request type in the API access log;
[0196] Determine the similarity between the SQL operation log and each API access log in the API access log set according to the parameter feature similarity between the SQL operation log and each API access log in the API access log set, the response feature similarity between the SQL operation log and each API access log in the API access log set, and the weights corresponding to the parameter feature similarity and the response feature similarity respectively;
[0197] The similarity between the SQL operation log and the set of API access logs is determined according to the similarity between the SQL operation log and each of the API access logs.
[0198] In a possible implementation manner, the first determining unit 44 is specifically configured to:
[0199] Determine a first minimum edit distance between the SQL operation parameter feature and an API request parameter feature of each API access log in the API access log set, and determine the reciprocal of each first minimum edit distance as the parameter feature similarity between the SQL operation log and each API access log in the API access log set; and
[0200] Determine the second minimum edit distance between the SQL return result feature and the API response content feature of each API access log in the API access log set, and determine the reciprocal of each second minimum edit distance as the response feature similarity between the SQL operation log and each API access log in the API access log set.
[0201] In a possible implementation manner, the first determining unit 44 is specifically configured to determine the similarity between the SQL operation log and any API access log in the API access log set by using the following formula:
[0202] V i =w 1 *VP i +w 2 *VR i
[0203] Among them, V i represents the similarity between the SQL operation log and the i-th API access log in the API access log set, i=1, 2, 3, ..., M, where M is the total number of API access logs in the API access log set;
[0204] VP i Indicates the parameter feature similarity between the SQL operation log and the i-th API access log in the API access log set;
[0205] VR i Indicates the similarity of response features between the SQL operation log and the i-th API access log in the API access log set;
[0206] w 1 A weight representing the similarity of parameter features between the SQL operation log and the i-th API access log in the API access log set;
[0207] w 2 a weight representing the similarity of response features between the SQL operation log and the i-th API access log in the API access log set; and
[0208] Determining the similarity between the SQL operation log and the set of API access logs according to the similarity between the SQL operation log and each of the API access logs specifically includes:
[0209] The similarity between the SQL operation log and the API access log set is determined by the following formula:
[0210]
[0211] in, Indicates the similarity between the SQL operation log and the API access log set.
[0212] In a possible implementation manner, the second determining unit is specifically configured to obtain a target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log, and the similarity through the following formula:
[0213]
[0214] Wherein, SA (sql_id) represents the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, sql_id is the identifier of the SQL operation log, and api_id is the identifier of the API access log;
[0215] SV(sql_id) represents the mapping relationship between the identifier of the SQL operation log currently generated, the identifier of the API access log and the similarity, Indicates the similarity between the SQL operation log and the API access log set. The current occurrence frequency of SV (sql_id) is 1.
[0216] TSV(sql_id) represents the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity. Indicates the historical similarity between the SQL operation log and the API access log set, and the historical occurrence frequency of TSV (sql_id) is p.
[0217] Based on the same technical concept, the embodiment of the present application also provides an electronic device 500, referring to Figure 6 As shown, the electronic device 500 is used to implement the data flow association identification method described in the above method embodiment. The electronic device 500 of this embodiment may include: a memory 501, a processor 502, and a computer program stored in the memory and executable on the processor, such as a data flow association identification program. When the processor executes the computer program, the steps in the above data flow association identification method embodiments are implemented, such as Figure 2 Alternatively, the processor implements the functions of each module / unit in the above-mentioned device embodiments, such as step S21.
[0218] The specific connection medium between the memory 501 and the processor 502 is not limited in the embodiment of the present application. Figure 6 In the embodiment, the memory 501 and the processor 502 are connected via a bus 503. The bus 503 is connected to the processor 502 via a bus 503. Figure 6 The connection between other components is shown by bold lines, which is only for schematic illustration and is not intended to be limiting. The bus 503 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0219] The memory 501 may be a volatile memory, such as a random-access memory (RAM); the memory 501 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 501 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 501 may be a combination of the above memories.
[0220] Processor 502, used to implement Figure 2 A data flow association identification method shown includes:
[0221] The processor 502 is used to call the computer program stored in the memory 501 to execute the following Figure 2 Steps S21 to S25 shown in FIG.
[0222] An embodiment of the present application also provides a computer-readable storage medium that stores computer-executable instructions required to execute the above-mentioned processor, which includes a program required to execute the above-mentioned processor.
[0223] In some possible implementations, various aspects of the data flow association identification method provided by the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the data flow association identification method according to various exemplary implementations of the present application described above in this specification. For example, the electronic device may execute the following steps: Figure 2 Steps S21 to S25 shown in FIG.
[0224] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0225] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (apparatus), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0226] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0227] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0228] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0229] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A data flow association identification method, characterized in that: include: Obtain a target structured query language SQL operation log and a target application program interface API access log, wherein the target SQL operation log is a SQL statement execution log of a specified application server operating its corresponding database server, and the target API access log is an access log generated by a client accessing the application server; Divide the target API access log into corresponding API access log sets according to the identifiers of the API access logs, wherein API access logs with the same identifiers are divided into one API access log set; For each SQL operation log in the target SQL operation log, extract SQL operation parameter features and SQL return result features in the SQL operation log; and for each API access log in each API access log set, extract API request parameter features and API response content features in the API access log; For the SQL operation log and each API access log set, determine the similarity between the SQL operation log and the API access log set according to the SQL operation parameter feature, the SQL return result feature, the API request parameter feature and the API response content feature of each API access log in the API access log set; According to the similarity between each SQL operation log in the target SQL operation log and each API access log set, the data flow association relationship between the client, the application server and the database server is identified.
2. The method according to claim 1, characterized in that After determining the similarity between the SQL operation log and the API access log set, the method further includes: Generate a mapping relationship between the identifier of the SQL operation log, the identifier of the API access log, and the similarity, wherein the identifier of the API access log is the identifier of the API access log in the API access log set; If it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated appears for the first time in the pre-established mapping relationship storage table, the mapping relationship is determined as the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, and the target mapping relationship is stored in the mapping relationship storage table, and the occurrence frequency is set to 1; If it is determined that the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity currently generated does not appear for the first time in the mapping relationship storage table, then based on the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity and the mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, obtain the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, use the target mapping relationship to replace the historical mapping relationship, and increase the frequency of occurrence by 1; The identification of the SQL operation log in the mapping relationship storage table, the identification of the API access log in each API access log set and the mapping relationship with the corresponding similarity are arranged in descending order of similarity, and the first N mapping relationships are retained.
3. The method according to claim 2, characterized in that The identifier of the SQL operation log is obtained by preprocessing the SQL operation statements in the SQL operation log; the identifier of the API access log is determined according to the API access path in the API access log.
4. The method according to claim 1, characterized in that For the SQL operation log and each API access log set, determining the similarity between the SQL operation log and the API access log set according to the SQL operation parameter feature, the SQL return result feature, the API request parameter feature and the API response content feature of each API access log in the API access log set, specifically including: Determine the similarity of parameter features between the SQL operation log and each API access log in the API access log set according to the SQL operation parameter features and the API request parameter features of each API access log in the API access log set; and Determine the similarity of the response characteristics of the SQL operation log and each API access log in the API access log set according to the SQL return result characteristics and the API response content characteristics of each API access log in the API access log set; Determine the weights corresponding to the parameter feature similarity and the response feature similarity, respectively, according to the SQL operation type in the SQL operation log and the API request type in the API access log; Determine the similarity between the SQL operation log and each API access log in the API access log set according to the parameter feature similarity between the SQL operation log and each API access log in the API access log set, the response feature similarity between the SQL operation log and each API access log in the API access log set, and the weights corresponding to the parameter feature similarity and the response feature similarity respectively; The similarity between the SQL operation log and the set of API access logs is determined according to the similarity between the SQL operation log and each of the API access logs.
5. The method according to claim 4, characterized in that Determining the similarity of parameter features of the SQL operation log and each API access log in the API access log set according to the SQL operation parameter features and the API request parameter features of each API access log in the API access log set, specifically comprising: Determine a first minimum edit distance between the SQL operation parameter feature and an API request parameter feature of each API access log in the API access log set, and determine the reciprocal of each first minimum edit distance as the parameter feature similarity between the SQL operation log and each API access log in the API access log set; and Determining the similarity of the response features of the SQL operation log and each API access log in the API access log set according to the SQL return result features and the API response content features of each API access log in the API access log set, specifically including: Determine the second minimum edit distance between the SQL return result feature and the API response content feature of each API access log in the API access log set, and determine the reciprocal of each second minimum edit distance as the response feature similarity between the SQL operation log and each API access log in the API access log set.
6. The method according to claim 5, characterized in that The similarity between the SQL operation log and any API access log in the API access log set is determined by the following formula: V i =w1*VP i +w2*VR i Among them, V i represents the similarity between the SQL operation log and the i-th API access log in the API access log set, i=1, 2, 3, ..., M, where M is the total number of API access logs in the API access log set; VP i Indicates the parameter feature similarity between the SQL operation log and the i-th API access log in the API access log set; VR i Indicates the similarity of response features between the SQL operation log and the i-th API access log in the API access log set; w1 represents the weight of the similarity of parameter features between the SQL operation log and the i-th API access log in the API access log set; w2 represents the weight of the similarity between the response features of the SQL operation log and the i-th API access log in the API access log set; and Determining the similarity between the SQL operation log and the set of API access logs according to the similarity between the SQL operation log and each of the API access logs specifically includes: The similarity between the SQL operation log and the API access log set is determined by the following formula: in, Indicates the similarity between the SQL operation log and the API access log set.
7. The method according to claim 2, characterized in that The target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity is obtained by the following formula: Wherein, SA (sql_id) represents the target mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity, sql_id is the identifier of the SQL operation log, and api_id is the identifier of the API access log; SV(sql_id) represents the mapping relationship between the identifier of the SQL operation log currently generated, the identifier of the API access log and the similarity, Indicates the similarity between the SQL operation log and the API access log set. The current occurrence frequency of SV (sql_id) is 1. TSV(sql_id) represents the historical mapping relationship between the identifier of the SQL operation log, the identifier of the API access log and the similarity. Indicates the historical similarity between the SQL operation log and the API access log set, and the historical occurrence frequency of TSV (sql_id) is p.
8. A data flow association identification device, characterized in that: include: An acquisition unit, used to acquire a target structured query language SQL operation log and a target application program interface API access log, wherein the target SQL operation log is an SQL statement execution log of a specified application server operating its corresponding database server, and the target API access log is an access log generated by a client accessing the application server; A division unit, configured to divide the target API access log into corresponding API access log sets according to the identifiers of the API access logs, wherein API access logs with the same identifiers are divided into one API access log set; a feature extraction unit, configured to extract, for each SQL operation log in the target SQL operation log, SQL operation parameter features and SQL return result features in the SQL operation log; and, for each API access log in each API access log set, API request parameter features and API response content features in the API access log; A first determining unit is used to determine, for the SQL operation log and each API access log set, a similarity between the SQL operation log and the API access log set according to the SQL operation parameter feature, the SQL return result feature, and the API request parameter feature and API response content feature of each API access log in the API access log set; The identification unit is used to identify the data flow association relationship between the client, the application server and the database server according to the similarity between each SQL operation log in the target SQL operation log and each API access log set.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the data flow association identification method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the data flow association identification method as described in any one of claims 1 to 7 are implemented.
