Data lifecycle analysis method, device and product based on audit log
Through the data life cycle analysis method based on audit logs, the problem of traditional data classification methods not being associated with usage is solved, and efficient and accurate data classification and metadata acquisition are achieved. It is suitable for large-scale data warehouses and improves the data life cycle. Management efficiency and accuracy.
Patent Information
- Application Number
- CN202410677122.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-05-29
AI Technical Summary
Traditional data classification methods cannot be correlated with the usage of data tables, resulting in incorrect classification and processing strategies, and inefficient acquisition of metadata information, affecting the accuracy and efficiency of data lifecycle management.
Using the data life cycle analysis method based on audit logs, by obtaining the audit log summary table, setting the row number dimension table, filtering and cross-correlation, an intermediate result set table is generated to count the latest access time of the data table, and then conduct cold and warm data Analysis, avoiding the problem of inefficiency in metadata acquisition.
It improves the accuracy and work efficiency of data classification, avoids logical errors caused by statistical errors, significantly improves data summary efficiency, is suitable for large-scale data warehouses, and reduces development and maintenance costs.
Smart Images

Figure CN118260366B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data management technology, and in particular to a data lifecycle analysis method, device and product based on audit logs. Background Art
[0002] Data lifecycle management is an inevitable problem in data warehouse management, which usually occurs in the middle and late stages of data warehouse operation. As storage resources are constantly occupied by data, data warehouse storage resources are becoming increasingly scarce, so the need for data updates is becoming increasingly urgent.
[0003] Usually, data in a data warehouse is managed in the form of data objects, such as data tables. Data lifecycle management is to classify data tables according to their usage characteristics, and adopt different data table processing strategies for different types. For example, data tables can be classified into hot data, warm data, and cold data according to whether they have not been used in the past three months, six months, or a year. The separated cold data can be removed from the data warehouse by adopting a strategy of off-site migration or destruction, thereby releasing more storage resources and alleviating the storage pressure of the data warehouse.
[0004] Traditional data classification methods include: (1) statistics based on the timestamp marked on the data table name; (2) statistics based on the creation time of the data table; (3) statistics based on the update time of the data in the data table. First, none of the above methods can be associated with the usage of the table (including reading and writing), which will cause incorrect classification methods and lead to incorrect data processing strategies. For example: the table was created 3 years ago, but it has been read in the last month. This type of statistical method will classify such data as cold data, causing the table to be deleted eventually. Secondly, since metadata information such as table creation time and update time cannot be obtained in batches, when the number of tables is huge, the efficiency of obtaining this type of information is extremely low. For example: in a data warehouse with 500,000 tables, it takes at least 4 hours to traverse and obtain this type of information. Summary of the invention
[0005] The present invention aims to solve the problem that the traditional classification method is not associated with the usage of the table, which easily leads to erroneous statistics, and then leads to erroneous data processing strategies, as well as low efficiency in extracting metadata information for analysis. To this end, the present invention provides a data lifecycle analysis method, device and product based on audit logs, which realizes the classification function of data tables on the basis of comprehensively considering the association with the usage of the table, avoiding the problem of low efficiency in metadata acquisition, and high integration, and greatly improves the accuracy of the results and work efficiency.
[0006] The present invention provides a data life cycle analysis method based on audit logs, and the technical solution adopted is as follows:
[0007] Obtain an audit log summary table, where the audit log summary table is an audit log of a data table output in the form of a table;
[0008] Set the maximum number of rows that can be split into a single row, and create a row number dimension table according to the maximum number of rows that can be split into a single row;
[0009] Set a start time, filter the audit log summary table according to the start time, and then filter out useless keywords in the audit log summary table, and generate an intermediate result set table A after filtering;
[0010] The row number dimension table and the intermediate result set table A are cross-correlated to realize a self-built Cartesian product, and an intermediate result set table B is generated. The intermediate result set table B counts the most recent access time of each of the data tables;
[0011] Filter out data tables that are not of interest to cold, warm, and hot data analysis from the intermediate result set table B to generate a basic analysis data table;
[0012] Cold, warm and hot data analysis is performed according to the basic analysis data table to obtain data life cycle analysis results.
[0013] Furthermore, the audit log of the data table is an audit log of the data table stored in the database cluster.
[0014] Furthermore, the row number dimension table is created in the form of a temporary table and a non-duplicate table, the maximum number of rows that can be split from the single row is not less than the maximum number of tables in a single row of the audit log summary table, and the creation process of the row number dimension table is: cyclically inserting numbers representing row numbers in the row number dimension table, the starting and ending positions of the numbers are 1 and the maximum number of rows that can be split from the single row.
[0015] Furthermore, the data tables that are not concerned with the cold-warm-hot data analysis include tables under the system library and tables that do not exist in the system tables.
[0016] The process of filtering out the tables that do not exist in the system table from the intermediate result set table B is as follows: creating an intermediate result set table C, the intermediate result set table C being used to store the library name and the table name in the system table, and then filtering out the tables that do not exist in the intermediate result set table C from the intermediate result set table B;
[0017] The process of filtering out the tables under the system library from the intermediate result set table B is as follows: directly filtering out the tables of the system library from the intermediate result set table B.
[0018] The present invention also provides a data lifecycle analysis device based on audit logs, which adopts the following technical solution: comprising an audit log summary table acquisition module, a row number dimension table generation module, a filtering module A, a cross-correlation module, a filtering module B and a cold, warm and hot data analysis module,
[0019] The audit log summary table acquisition module is connected to the filter module A, the filter module A and the row number dimension table generation module are respectively connected to the cross-correlation module, the cross-correlation module is connected to the filter module B, and the filter module B is connected to the cold, warm and hot data analysis module.
[0020] The audit log summary table acquisition module is used to obtain an audit log summary table, where the audit log summary table is an audit log of a data table output in the form of a table.
[0021] The row number dimension table generating module is used to receive the maximum number of rows that can be split into a single row, and create a row number dimension table according to the maximum number of rows that can be split into a single row;
[0022] The filtering module A is used to receive the start time, filter the audit log summary table according to the start time, and then filter out useless keywords in the audit log summary table, and generate an intermediate result set table A after filtering;
[0023] The cross-correlation module is used to cross-correlate the row number dimension table and the intermediate result set table A to realize a self-built Cartesian product and generate an intermediate result set table B. The intermediate result set table B counts the most recent access time of each of the data tables;
[0024] The filtering module B is used to filter out data tables that are not of interest to the cold, warm and hot data analysis from the intermediate result set table B, and generate a basic analysis data table;
[0025] The cold-warm-hot data analysis module is used to perform cold-warm-hot data analysis according to the basic analysis data table to obtain data life cycle analysis results.
[0026] Furthermore, the audit log of the data table is an audit log of the data table stored in the database cluster.
[0027] Furthermore, the row number dimension table generation module is used to create the row number dimension table by using a temporary table and a copyless table. The creation process of the row number dimension table is: cyclically inserting numbers representing row numbers in the row number dimension table, the starting and ending positions of the numbers are 1 and the maximum number of rows that can be split into a single row, and the maximum number of rows that can be split into a single row is not less than the maximum value of the number of tables in a single row of the audit log summary table.
[0028] Furthermore, the data tables that are not concerned with the cold-warm-hot data analysis include tables under the system library and tables that do not exist in the system tables.
[0029] The process of filtering the table that does not exist in the system table from the intermediate result set table B by the filtering module B is as follows: creating an intermediate result set table C, the intermediate result set table C is used to store the library name and table name in the system table, and then filtering out the table that does not exist in the intermediate result set table C from the intermediate result set table B;
[0030] The process in which the filtering module B filters out the tables under the system library from the intermediate result set table B is: directly filtering out the tables of the system library from the intermediate result set table B.
[0031] The present invention also provides a computer program product, including a computer program, which implements the above-mentioned data lifecycle analysis method based on audit log when executed by a processor.
[0032] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:
[0033] 1. The present invention changes the traditional way of classifying data life cycle by table creation time, utilizes usage information of data tables, and relies on audit logs to classify data tables, thus avoiding logical errors in statistical results caused by statistics showing that the table creation time is long and the usage time is short.
[0034] 2. The present invention avoids accessing metadata tables, greatly improving the efficiency of data analysis and aggregation. Secondly, since the creation time of tables in the metadata interface information_schema is extremely inefficient, it generally takes at least 4 hours to traverse and obtain such information in a data warehouse with 500,000 tables. However, the present invention obtains audit log information, and it only takes about 50 minutes to summarize 5 billion audit logs, which is nearly 4 times more efficient.
[0035] 3. The present invention builds a Cartesian product through cross-correlation to implement the operation logic of converting one row into multiple rows, and converts each row of string records involving multiple tables into multiple rows of data, so that the generated intermediate result set table B can count the most recent access time of each of the data tables.
[0036] 4. The main implementation logic of the present invention can be compiled and solidified into the database in the form of stored procedures, so that people who do not understand SQL (Structured Query Language) can also use it, which greatly reduces the complexity of operation and brings convenient conditions for promotion and use.
[0037] 5. The main logic changes of the present invention are realized by using parameters. The call of the stored procedure only needs to modify two parameters according to actual needs: the maximum number of rows that can be split into a single row and the start time. No secondary development is required, which greatly reduces the development and maintenance costs.
[0038] 6. The present invention can meet the requirements of database clusters of different versions and is also applicable to virtual clusters, thus improving the compatibility of the present invention.
[0039] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 It is a flow chart of the method provided by the present invention.
[0042] Figure 2 This is a sample diagram of the audit log provided by the present invention.
[0043] Figure 3 This is a GBASE database cluster audit log framework diagram provided by the present invention.
[0044] Figure 4 It is a structural schematic diagram of the device provided by the present invention.
[0045] Reference numerals:
[0046] 1. Audit log summary table acquisition module; 2. Row number dimension table generation module; 3. Filter module A; 4. Cross-correlation module; 5. Filter module B; 6. Cold, warm and hot data analysis module. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.
[0048] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0049] Combine the following Figure 1-Figure 4 The present invention is further described in detail, and a data lifecycle analysis method, device and product based on audit logs of the present invention are described:
[0050] In this embodiment, Figure 1 As shown, a data lifecycle analysis method based on audit logs is provided, including the following steps:
[0051] Step 1: Obtain an audit log summary table, wherein the audit log summary table is an audit log of a data table output in the form of a table. The audit log of the data table is an audit log of a data table stored in a database cluster.
[0052] Take the GBASE database cluster as an example, its audit log is as follows Figure 2 As shown, reference Figure 2 The content in the box, the table_list field of the audit_log table in the database indicates the table used by each SQL statement. All table names are stored in each row corresponding to the SQL statement, separated by commas, and are divided into three types: WRITE, READ, and OTHER. If you want detailed data on time and table name, you need to convert a single row to multiple rows, so you need to first output the audit log in the form of a table to obtain an audit log summary table. Since the audit log summary table may have a situation where the most recent access time of a table corresponds to multiple table names, it cannot be directly used for the analysis of cold, warm, and hot data.
[0053] To obtain the audit log summary table, you first need to enable the audit log function of the database. The following also takes the GBASE database cluster as an example to illustrate the process of enabling the audit log function and initializing its related configuration.
[0054] Step 1.1: Enable the audit log function and initialize the relevant configuration parameters. Set the database system parameter "Audit log switch" to on; set the database system parameter "Execution time length" to the shortest "zero"; set the database system parameter "Log output" to "table" so that the audit results are stored in the table, ensuring that the output is the audit log summary table; create a new audit policy.
[0055] Step 1.2: Adjust the frequency of audit log data aggregation. First, disable "Import audit log" in event management; then adjust the execution plan of the event to aggregate once every hour; then enable "Import audit log" in event management. This step adjusts the frequency of audit log data aggregation to once every hour. The frequency of audit log data aggregation can be changed according to usage needs, for example, set to aggregate once every half hour or once every two hours.
[0056] Step 1.3: Check the validity of the audit log summary data. The application randomly sends add, delete, modify, and query statements to the database for a cumulative period of more than 1 year; check whether the audit log summary table has generated summary data. The cumulative period of more than 1 year is set by the user according to usage needs and can be changed according to actual needs. Manually check the contents of the audit log summary table. If there is summary data in the table, it means that the audit log summary table has been successfully generated.
[0057] The audit log framework of the GBASE database cluster is shown in the figure below: Figure 3 As shown, through the operations of steps 1.1 to 1.3, the event manager of the database imports audit log events, summarizes the audit logs stored in multiple scheduling nodes, and outputs them in the form of a table to generate the audit log summary table.
[0058] Step 2: Set the maximum number of rows that can be split from a single row, and create a row number dimension table according to the maximum number of rows that can be split from a single row.
[0059] The row number dimension table is created in a temporary table and a non-duplicate table manner. The creation process of the row number dimension table is: cyclically inserting numbers representing row numbers in the row number dimension table, where the starting and ending positions of the numbers are 1 and the maximum number of rows that can be split from the single row.
[0060] The maximum number of rows that can be split from the single row is not less than the maximum value of the number of tables in a single row of the audit log summary table.
[0061] The maximum number of rows that can be split from a single row is set based on actual experience. The number of tables involved in each SQL statement is generally no more than 100, so the maximum number of rows that can be split from a single row is generally set to 100. If necessary, you can modify the number of rows.
[0062] Step 3: Set the start time, filter the audit log summary table according to the start time, and filter out the content before the start time; then filter out useless keywords in the audit log summary table, and generate the intermediate result set table A after filtering. Useless keywords include operation instructions for the table, such as: WRITE, READ and OTHER.
[0063] The sample table of the intermediate result set table A is shown in Table 1. The content in Table 1 corresponds to Figure 2 SQL statements in the box. In Table 1, start_time is the most recent access time of the table, tbl is the corresponding table name (table name list), and the table name format is database name.data table name. For example, ssbm.customer, ssbm is the database name, and customer is the data table name. When a single SQL statement involves multiple data tables, the content of tbl in the intermediate result set table A will also have multiple table names.
[0064] Table 1 Intermediate result set table A sample table
[0065]
[0066] Step 4: Cross-correlate the row number dimension table and the intermediate result set table A to build a Cartesian product, and create an intermediate result set table B according to the result set of the cross-correlation self-built Cartesian product. The intermediate result set table B counts the most recent access time of each table.
[0067] The cross-correlation self-built Cartesian product realizes the effect of converting a single row to multiple rows, and is used to realize the function of cutting data of different rows according to the row number. Creating the intermediate result set table B according to the result set of the cross-correlation self-built Cartesian product is essentially a screening process, which screens out the most recent access time of each table. In the intermediate result set table B, each table occupies one row, and there is no duplicate table name. The sample table of the intermediate result set table B is shown in Table 2.
[0068] Table 2 Intermediate result set table B sample table
[0069]
[0070] Step 5: There are some data tables in the intermediate result set table B that are not concerned with cold, warm and hot data analysis. They are mainly divided into two categories: one is the table under the system library, and the other is the table that does not exist in the system table. Therefore, it is necessary to filter out the data tables that are not concerned with cold, warm and hot data analysis from the intermediate result set table B to generate a basic analysis data table. The basic analysis data table can be used for the analysis of cold, warm and hot data.
[0071] Step 5.1: In actual application systems, some temporary tables may be cleaned up after use. The temporary tables do not exist in the system tables, but the operations on the temporary tables are still retained in the audit logs. Therefore, such temporary tables need to be removed from the intermediate result set table B.
[0072] The processes of creating the row number dimension table, intermediate result set table A, and intermediate result set table B are all completed in the database, but the system table is not stored in the database, and the database cannot directly read the system table. Therefore, it is necessary to set the database parameter "gbase_query_path" to "1" so that the two different engines can exchange data. Create an intermediate result set table C, and use the intermediate result set table C to store the library name and table name in the system table outside the database. Then compare the intermediate result set table C with the intermediate result set table B, and filter out the tables that do not exist in the intermediate result set table C from the intermediate result set table B.
[0073] Step 5.2: The tables under the system library do not belong to the data stored in the database itself, nor to the data concerned by the cold-warm-hot data analysis, and need to be removed from the intermediate result set table B. The tables under the system library are stored in the database, so the tables under the system library can be directly filtered out from the intermediate result set table B.
[0074] Step 5.3: After filtering the intermediate result set table B, a basic analysis data table is generated.
[0075] Step 6: Perform cold, warm and hot data analysis based on the basic analysis data table to obtain data life cycle analysis results.
[0076] Step 6.1: Specify the life cycle data of cold, warm and hot data according to business needs. The life cycle data of cold, warm and hot data is specified according to industry and customer needs. Taking the classification scenario of the mobile communication industry as an example, in general, data turnover within 60 days is hot data, 60-90 days is warm data, and more than 90 days is cold data.
[0077] Step 6.2: Classify the basic analysis data table according to the specified life cycle data to obtain the type corresponding to each table in the basic analysis data table, including cold data, warm data and hot data. Subsequently, cold, warm and hot data analysis can be performed according to customer needs to obtain data life cycle analysis results. Indicatively, all detailed data of cold, warm and hot data can be simply exported. Or the cold, warm and hot data can be summed separately to calculate the total number of cold, warm and hot data respectively; on this basis, the percentage of the three data types in the total can also be calculated. Or the number of cold, warm and hot data can be counted by grouping by database name to find out which databases have more cold data, and the data tables in the database can be cleaned up first. The analysis results of cold, warm and hot data can provide a basis for customers to process their data, facilitate customers to make reasonable judgments, and make decisions such as data cleaning and data migration.
[0078] The present invention realizes the reconstruction of audit log summary data, and completes the summary of basic analysis data in steps in the form of stored procedures. On the basis of the basic analysis data, the data tables in the library are flexibly classified and processed, and finally analytical data assets that can be used for delivery are produced.
[0079] The present invention implements the logic inside the stored procedure and is completed inside the database. Previously, attempts were made to divide the entire column of data in the table_list field into two categories, one for a single table and one for multiple tables. The data of multiple tables was exported out of the library, processed using the sed command, and then loaded into the library. However, this solution involves repeated operations inside and outside the library, which is not as convenient as the present invention which is only implemented inside the library. Moreover, when operating outside the library, when the amount of data is large and the file to be processed is large, the processing efficiency of the sed command will be greatly reduced, and the processing efficiency cannot be guaranteed.
[0080] In this embodiment, Figure 4 As shown, a data lifecycle analysis device based on an audit log is also provided, and the technical solution adopted is as follows: it includes an audit log summary table acquisition module 1, a row number dimension table generation module 2, a filtering module A3, a cross-correlation module 4, a filtering module B5, and a cold, warm, and hot data analysis module 6. The audit log summary table acquisition module 1 is connected to the filtering module A3, the filtering module A3 and the row number dimension table generation module 2 are respectively connected to the cross-correlation module 4, the cross-correlation module 4 is connected to the filtering module B5, and the filtering module B5 is connected to the cold, warm, and hot data analysis module 6.
[0081] The audit log summary table acquisition module 1 is used to obtain the audit log summary table, which is an audit log of a data table output in the form of a table. The audit log of the data table is an audit log of a data table stored in a database cluster. The fields of the audit log summary table include start_time and tbl, where start_time is the most recent access time of the table, and tbl is the corresponding table name (table name list), and the table name format is database name.data table name. The audit log summary table acquisition module 1 sends the audit log summary table to the filtering module A3.
[0082] The row number dimension table generation module 2 is used to receive the maximum number of rows that can be split from a single row, and create a row number dimension table according to the maximum number of rows that can be split from a single row. The row number dimension table generation module 2 sends the row number dimension table to the cross-correlation module 4.
[0083] The row number dimension table generation module 2 creates the row number dimension table in a temporary table and a non-duplicate table manner. The creation process of the row number dimension table is: cyclically inserting numbers representing row numbers in the row number dimension table, the starting and ending positions of the numbers are 1 and the maximum number of rows that can be split into a single row, and the maximum number of rows that can be split into a single row is not less than the maximum value of the number of tables in a single row of the audit log summary table. The maximum number of rows that can be split into a single row is a parameter manually set by the user according to actual conditions, and can be set to 100 indicatively.
[0084] The filtering module A3 is used to receive the start time and filter the audit log summary table according to the start time. The content before the start time will be filtered out, and then the useless keywords in the audit log summary table are filtered out, and the intermediate result set table A is generated after filtering. The useless keywords include operation instructions for the table. The filtering module A3 sends the intermediate result set table A to the cross-correlation module 4. The start time is a parameter set by the user according to the actual situation. Indicatively, it can be set to 180 days.
[0085] The cross-correlation module 4 is used to cross-correlate the row number dimension table and the intermediate result set table A to realize self-built Cartesian product and generate the intermediate result set table B. The intermediate result set table B counts the most recent access time of each data table. In the intermediate result set table B, each table occupies one row, and there is no duplicate table name. The cross-correlation module 4 sends the intermediate result set table B to the filtering module B5.
[0086] The filtering module B5 is used to filter out the data tables that are not concerned with the cold, warm and hot data analysis from the intermediate result set table B to generate a basic analysis data table. The filtering module B5 sends the basic analysis data table to the cold, warm and hot data analysis module 6.
[0087] The data tables that are not concerned with the cold-warm-hot data analysis generally include tables under the system library and tables that do not exist in the system tables.
[0088] The process of the filtering module B5 filtering out the tables that do not exist in the system table from the intermediate result set table B is as follows: creating an intermediate result set table C, the intermediate result set table C stores the library name and table name in the system table outside the database, and then filtering out the tables that do not exist in the intermediate result set table C from the intermediate result set table B.
[0089] The process of filtering the system library tables from the intermediate result set table B by the filtering module B5 is as follows: directly filtering the system library tables from the intermediate result set table B.
[0090] The cold-warm-hot data analysis module 6 is used to perform cold-warm-hot data analysis according to the basic analysis data table to obtain data life cycle analysis results.
[0091] The life cycle data of cold, warm and hot data is specified according to business needs. The life cycle data of cold, warm and hot data is manually specified according to industry and customer needs. Taking the classification scenario of the mobile communication industry as an example, under normal circumstances, data turnover within 60 days is hot data, 60-90 days is warm data, and more than 90 days is cold data.
[0092] The basic analysis data table is classified according to the specified life cycle data to obtain the type corresponding to each table in the basic analysis data table, including cold data, warm data and hot data. Subsequently, cold, warm and hot data analysis can be performed according to customer needs to obtain data life cycle analysis results. Indicatively, all detailed data of cold, warm and hot data can be simply exported. Or the cold, warm and hot data can be summed separately to calculate the total number of cold, warm and hot data respectively; on this basis, the percentage of the three data types in the total can also be calculated. Or the number of cold, warm and hot data can be counted by grouping by database name to find out which databases have more cold data, and the data tables in the database can be cleaned up first. The analysis results of cold, warm and hot data can provide a basis for customers to process their data, facilitate customers to make reasonable judgments, and make decisions such as data cleaning and data migration.
[0093] This device can be compiled and solidified into the database in the form of a stored procedure. Only two parameters need to be modified according to actual needs: the maximum number of rows that can be split into a single row and the start time. Each module works according to the preset logic, automatically summarizes the audit logs of the data table stored in the database cluster, saves the library name and table name in the system table outside the database, creates each table, and finally outputs the analysis results of cold, warm and hot data.
[0094] This embodiment also provides a computer program product, including a computer program, which implements the above-mentioned data lifecycle analysis method based on audit logs when executed by a processor.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data life cycle analysis method based on audit logs, characterized in that: include: Obtain an audit log summary table, where the audit log summary table is an audit log of a data table output in the form of a table; The maximum number of rows that can be split from a single row is set, and a row number dimension table is created according to the maximum number of rows that can be split from a single row. The creation process of the row number dimension table is: cyclically inserting numbers representing row numbers into the row number dimension table, where the starting and ending positions of the numbers are 1 and the maximum number of rows that can be split from a single row; Set a start time, filter the audit log summary table according to the start time, and then filter out useless keywords in the audit log summary table, and generate an intermediate result set table A after filtering; The row number dimension table and the intermediate result set table A are cross-correlated to realize a self-built Cartesian product, and an intermediate result set table B is generated. The intermediate result set table B counts the most recent access time of each of the data tables; Filter out data tables that are not of interest to cold, warm, and hot data analysis from the intermediate result set table B to generate a basic analysis data table; Cold, warm and hot data analysis is performed according to the basic analysis data table to obtain data life cycle analysis results.
2. A data lifecycle analysis method based on audit logs as claimed in claim 1, characterized in that: The audit log of the data table is the audit log of the data table stored in the database cluster.
3. A data lifecycle analysis method based on audit logs as described in claim 1 or 2, characterized in that: The row number dimension table is created in a temporary table and a non-duplicate table manner, and the maximum number of rows that can be split into a single row is not less than the maximum number of tables in a single row of the audit log summary table.
4. A data lifecycle analysis method based on audit logs as described in claim 1 or 2, characterized in that: The data tables that are not concerned with the cold, warm and hot data analysis include tables under the system library and tables that do not exist in the system table. The process of filtering out the tables that do not exist in the system table from the intermediate result set table B is as follows: creating an intermediate result set table C, which is used to store library names and table names in the system table, and then filtering out the tables that do not exist in the intermediate result set table C from the intermediate result set table B.
5. A data lifecycle analysis device based on audit logs, characterized in that: The method is used to perform a data lifecycle analysis method based on an audit log as described in any one of claims 1 to 4, comprising an audit log summary table acquisition module, a row number dimension table generation module, a filtering module A, a cross-correlation module, a filtering module B and a cold-warm-hot data analysis module. The audit log summary table acquisition module is connected to the filter module A, the filter module A and the row number dimension table generation module are respectively connected to the cross-correlation module, the cross-correlation module is connected to the filter module B, and the filter module B is connected to the cold, warm and hot data analysis module. The audit log summary table acquisition module is used to obtain an audit log summary table, where the audit log summary table is an audit log of a data table output in the form of a table. The row number dimension table generation module is used to receive the maximum number of rows that can be split from a single row, and create a row number dimension table according to the maximum number of rows that can be split from a single row. The row number dimension table creation process is: cyclically inserting numbers representing row numbers into the row number dimension table, the starting and ending positions of the numbers are 1 and the maximum number of rows that can be split from a single row; The filtering module A is used to receive the start time, filter the audit log summary table according to the start time, and then filter out useless keywords in the audit log summary table, and generate an intermediate result set table A after filtering; The cross-correlation module is used to cross-correlate the row number dimension table and the intermediate result set table A to realize a self-built Cartesian product and generate an intermediate result set table B. The intermediate result set table B counts the most recent access time of each of the data tables; The filtering module B is used to filter out data tables that are not of interest to the cold, warm and hot data analysis from the intermediate result set table B, and generate a basic analysis data table; The cold-warm-hot data analysis module is used to perform cold-warm-hot data analysis according to the basic analysis data table to obtain data life cycle analysis results.
6. The data lifecycle analysis device based on audit logs according to claim 5, characterized in that: The audit log of the data table is the audit log of the data table stored in the database cluster.
7. A data lifecycle analysis device based on audit logs as claimed in claim 5 or 6, characterized in that: The row number dimension table generation module is used to create the row number dimension table in a temporary table and a copy-free table manner, and the maximum number of rows that can be split into a single row is not less than the maximum number of tables in a single row of the audit log summary table.
8. A data lifecycle analysis device based on audit logs as claimed in claim 5 or 6, characterized in that: The data tables that are not concerned with the cold, warm and hot data analysis include tables under the system library and tables that do not exist in the system table. The process of the filtering module B filtering out the tables that do not exist in the system table from the intermediate result set table B is as follows: creating an intermediate result set table C, the intermediate result set table C being used to store the library names and table names in the system table, and then filtering out the tables that do not exist in the intermediate result set table C from the intermediate result set table B.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the audit log-based data lifecycle analysis method described in any one of claims 1 to 4 is implemented.
