Non-intrusive java type application log desensitization method
By rewriting the Java framework log module method and adding desensitization logic, the application logs are subject to non-invasive desensitization, which solves the problems of invasiveness and large development workload in the existing technology, and achieves the problem of log desensitization in the first technology. Effective protection of sensitive information and maintain log validity and readability.
Patent Information
- Application Number
- CN202411481158.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-23
AI Technical Summary
The prior art is invasive when implementing log desensitization in applications, increasing development workload and difficult to effectively protect sensitive information in logs.
By rewriting the Java framework log module method, desensitization logic is added, and log recording information is used to perform preliminary judgment, regular matching analysis and cyclic judgment, desensitization processing is performed, and desensitization efficiency and accuracy coefficients are calculated for real-time renew.
Achieve non-invasive Java-type application log desensitization, effectively protecting sensitive information in the log, reducing the risk of data leakage, maintaining the effectiveness and readability of the log, and improving the desensitization efficiency and accuracy through optimized processing flow .
Smart Images

Figure CN119442309A_ABST
Abstract
Description
Technical Field
[0001] The invention proposes a non-intrusive java type application log desensitization method, which relates to the technical field of data desensitization, and specifically to the technical field of non-intrusive java type application log desensitization. Background Art
[0002] The application will output logs during operation. The logs record detailed information during the application operation, including but not limited to application interface dependency call records, application status, error information, user operation traces, and other record information;
[0003] When outputting application logs, the output of logs may not be standardized due to problem analysis or other reasons, resulting in sensitive information of users, including but not limited to user ID number / mobile phone number, being recorded in the logs. According to the requirements of the National Personal Information Protection Law, it is not allowed to illegally collect, use, process, transmit, provide or disclose other people's personal information. Therefore, when outputting personal privacy information, the application should perform obfuscation / encryption or desensitization before output to avoid public display;
[0004] All applications need to implement desensitization logic by themselves and call desensitization methods for processing when applying various methods to output logs. This is invasive to existing applications and increases the development workload. Summary of the invention
[0005] The present invention provides a non-intrusive Java type application log desensitization method to solve the above problems:
[0006] The present invention proposes a non-intrusive Java type application log desensitization method, the method comprising:
[0007] S1. Rewrite the Java framework log module method through the desensitization program, add desensitization logic to the log content to the rewritten method, and obtain additional data information;
[0008] S2. Obtain log record information through a desensitization program, make a preliminary judgment on the log record information to obtain preliminary judgment information, and obtain judgment pass data according to the preliminary judgment information;
[0009] S3, parsing the judgment information according to the preset single-line log regular matching through the desensitization program, and then performing a cyclic judgment on the k value to obtain the cyclic judgment information, performing desensitization processing according to the cyclic judgment result, and obtaining the final processing result;
[0010] S4. Calculate the desensitization efficiency coefficient, judge the desensitization efficiency, and then calculate the desensitization accuracy coefficient, judge the desensitization accuracy, and update the desensitization process data in real time according to the judgment result;
[0011] S5. After all the cycle judgments are desensitized, the desensitization completion result is obtained, and the log record information after or without desensitization is output.
[0012] Further, the S1 includes:
[0013] Obtain the log record information output by the application during operation, rewrite the Java framework log module method data through the desensitization program, and obtain the rewritten method data;
[0014] Add desensitization rule information to log record information through rewritten method data to obtain added data information;
[0015] The added data information is preprocessed to obtain the preprocessed added data information.
[0016] Further, the S2 includes:
[0017] Performing a preliminary judgment on the rewritten method data; the preliminary judgment includes judging the log length and judging the regular rule;
[0018] Get the log length judgment result and regular rule judgment result;
[0019] Acquire method data that meets a preset range of log length according to the log length determination result;
[0020] Then, according to the regular rule judgment result, method data that meets the preset range of the regular rule is obtained;
[0021] Then, the judgment passing data after the preliminary judgment is obtained.
[0022] Further, the S3 includes:
[0023] Obtaining preset single-line log regular matching rule information, splitting the judgment data according to the preset single-line log regular matching information through a desensitization program, and obtaining multiple k or v fields;
[0024] Loop through each k field. When the k field is within the preset range of fields to be desensitized, desensitize the v value corresponding to k to obtain the desensitization result.
[0025] When k is not within the preset range of fields to be desensitized, the loop processing continues to obtain the final processed data.
[0026] Further, the S4 includes:
[0027] Obtaining desensitization process data, and calculating a desensitization efficiency coefficient according to the desensitization process data;
[0028] Comparing the desensitization efficiency coefficient with a preset efficiency coefficient threshold to obtain an efficiency comparison result;
[0029] When the desensitization efficiency coefficient is greater than the preset efficiency coefficient threshold, the desensitization accuracy coefficient is calculated;
[0030] Compare the desensitization accuracy coefficient with a preset accuracy threshold to obtain an accuracy comparison result;
[0031] Determine whether to update the desensitization process based on the accuracy comparison result.
[0032] Furthermore, the desensitization system comprises:
[0033] The rewriting module is used to rewrite the Java framework log module method through the desensitization program, add desensitization logic to the log content to the rewritten method, and obtain additional data information;
[0034] A preliminary judgment module is used to obtain log record information through a desensitization program, perform preliminary judgment on the log record information, obtain preliminary judgment information, and obtain judgment pass data according to the preliminary judgment information;
[0035] The desensitization parsing module is used to parse the judgment information according to the preset single-line log regular matching through the desensitization program, and then perform a cyclic judgment on the k value to obtain the cyclic judgment information, perform desensitization processing according to the cyclic judgment result, and obtain the final processing result;
[0036] The performance calculation module is used to calculate the desensitization efficiency coefficient, judge the desensitization efficiency, and then calculate the desensitization accuracy coefficient, judge the desensitization accuracy, and update the desensitization process data in real time according to the judgment results;
[0037] S5. After all the cycle judgments are desensitized, the desensitization completion result is obtained, and the log record information after or without desensitization is output.
[0038] Furthermore, the rewriting module includes:
[0039] Obtain the log record information output by the application during operation, rewrite the Java framework log module method data through the desensitization program, and obtain the rewritten method data;
[0040] Add desensitization rule information to log record information through rewritten method data to obtain added data information;
[0041] The added data information is preprocessed to obtain the preprocessed added data information.
[0042] Furthermore, the preliminary judgment module includes:
[0043] Performing a preliminary judgment on the rewritten method data; the preliminary judgment includes judging the log length and judging the regular rule;
[0044] Get the log length judgment result and regular rule judgment result;
[0045] Acquire method data that meets a preset range of log length according to the log length determination result;
[0046] Then, according to the regular rule judgment result, method data that meets the preset range of the regular rule is obtained;
[0047] Then, the judgment passing data after the preliminary judgment is obtained.
[0048] Furthermore, the desensitization parsing module includes:
[0049] Obtaining preset single-line log regular matching rule information, splitting the judgment data according to the preset single-line log regular matching information through a desensitization program, and obtaining multiple k or v fields;
[0050] Loop through each k field. When the k field is within the preset range of fields to be desensitized, desensitize the v value corresponding to k to obtain the desensitization result.
[0051] When k is not within the preset range of fields to be desensitized, the loop processing continues to obtain the final processed data.
[0052] Furthermore, the performance calculation module includes:
[0053] Obtaining desensitization process data, and calculating a desensitization efficiency coefficient according to the desensitization process data;
[0054] Comparing the desensitization efficiency coefficient with a preset efficiency coefficient threshold to obtain an efficiency comparison result;
[0055] When the desensitization efficiency coefficient is greater than the preset efficiency coefficient threshold, the desensitization accuracy coefficient is calculated;
[0056] Compare the desensitization accuracy coefficient with a preset accuracy threshold to obtain an accuracy comparison result;
[0057] Determine whether to update the desensitization process based on the accuracy comparison result.
[0058] Beneficial effects of the present invention: Through desensitization processing, sensitive information in the log is effectively protected from being illegally obtained and used, reducing the risk of data leakage. While protecting privacy, the validity and readability of log records are maintained, which is helpful for subsequent log analysis and troubleshooting. By calculating the desensitization efficiency coefficient, the system can continuously optimize the processing flow and increase the speed of desensitization processing. By calculating the desensitization accuracy coefficient, the system can ensure the accuracy of the desensitization processing and avoid accidental deletion or omission of sensitive information. : The system supports real-time updating of desensitization process data, and can quickly adjust the processing strategy according to the latest evaluation results, thereby improving the flexibility and adaptability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 This is a schematic diagram of a non-intrusive Java application log desensitization method. DETAILED DESCRIPTION
[0060] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0061] In one embodiment of the present invention, a power-on sequence control method and circuit are provided, and the method includes:
[0062] S1. Rewrite the Java framework log module method through the desensitization program, add desensitization logic to the log content to the rewritten method, and obtain additional data information;
[0063] S2. Obtain log record information through a desensitization program, make a preliminary judgment on the log record information to obtain preliminary judgment information, and obtain judgment pass data according to the preliminary judgment information;
[0064] S3, parsing the judgment information according to the preset single-line log regular matching through the desensitization program, and then performing a cyclic judgment on the k value to obtain the cyclic judgment information, performing desensitization processing according to the cyclic judgment result, and obtaining the final processing result;
[0065] S4. Calculate the desensitization efficiency coefficient, judge the desensitization efficiency, and then calculate the desensitization accuracy coefficient, judge the desensitization accuracy, and update the desensitization process data in real time according to the judgment result;
[0066] S5. After all the cycle judgments are desensitized, the desensitization completion result is obtained, and the log record information after or without desensitization is output, such as Figure 1 shown.
[0067] The working principle of the above technical solution is as follows: obtain the original log record information. Use the desensitization program to make a preliminary judgment on these log record information to distinguish which information needs to be desensitized (i.e. sensitive information) and which information can remain unchanged (i.e. non-sensitive information). After the preliminary judgment, a set of judgment-passing data is obtained, which contains the log record information that needs to be further processed (i.e. desensitized). The desensitization program uses the preset single-line log regular matching rules to parse the data that has passed the judgment. These regular matching rules are used to identify specific formats or contents in the log, such as personal identity information, account information and other sensitive data. The program enters a loop judgment process and performs a loop judgment on the identified sensitive information with a k value (which may represent a certain loop or iteration condition, such as the type or quantity of sensitive information). Ensure that all sensitive information is correctly identified and processed. In the loop judgment process, the sensitive information is desensitized according to the judgment results, such as replacing the real data with placeholders, hash values or fuzzification, etc., to protect privacy and security. At the same time or after the desensitization process, the system will calculate the desensitization efficiency coefficient and the desensitization accuracy coefficient. Used to evaluate the speed and accuracy of the desensitization process. The desensitization accuracy coefficient may be evaluated by comparing the data differences before and after desensitization and whether the necessary non-sensitive information is retained. Based on the evaluation results, the system may update the desensitization process data in real time to optimize the subsequent processing efficiency and accuracy. When all cycle judgments are completed and all sensitive information has been desensitized, the system obtains the final desensitization completion result. The system will output the log record information after desensitization, or directly output the original record for some information that does not need to be desensitized. This can protect sensitive information from being leaked while maintaining the integrity and readability of the log.
[0068] The technical effects of the above technical solution are: through desensitization processing, sensitive information in the log is effectively protected from illegal acquisition and use, reducing the risk of data leakage. While protecting privacy, the validity and readability of log records are maintained, which is helpful for subsequent log analysis and troubleshooting. By calculating the desensitization efficiency coefficient, the system can continuously optimize the processing flow and improve the speed of desensitization processing. By calculating the desensitization accuracy coefficient, the system can ensure the accuracy of desensitization processing and avoid accidental deletion or omission of sensitive information. : The system supports real-time updating of desensitization process data, and can quickly adjust the processing strategy according to the latest evaluation results, thereby improving the flexibility and adaptability of the system.
[0069] In one embodiment of the present invention, the S1 includes:
[0070] Obtain the log record information output by the application during operation, rewrite the Java framework log module method data through the desensitization program, and obtain the rewritten method data;
[0071] Add desensitization rule information to log record information through rewritten method data to obtain added data information;
[0072] The added data information is preprocessed to obtain the preprocessed added data information.
[0073] The working principle of the above technical solution is as follows: the system or framework will continuously generate and output log information during operation. These log information contains various types of data such as the running status of the application, user behavior, system anomalies, etc. In order to achieve the desensitization of log information, it is necessary to rewrite the method responsible for logging in the Java framework. This usually involves modifying or extending the API call of the logging framework (such as Log4j, SLF4J, etc.). New logging methods are created through inheritance or decoration mode, etc. These methods will first desensitize the log information before calling the original logging method internally. In the rewritten method data, desensitization rule information for the log information is added. These rules are based on regular expressions, keyword matching or other custom logic to identify and mark sensitive data that needs to be desensitized. Desensitization rules can be flexibly configured to adapt to different data protection requirements and application scenarios. Log records containing desensitization rule information are preprocessed. The preprocessing step may include: identifying and extracting the sensitive data part in the log information. Applying the corresponding desensitization rules to replace the sensitive data with a desensitized form (such as placeholders, hash values, etc.). Ensure that non-sensitive data remains unchanged to maintain the integrity and readability of the log. The preprocessed log information will no longer contain the original sensitive data, but retain enough information for subsequent analysis and troubleshooting.
[0074] The technical effect of the above technical solution is: by desensitizing the log record information, the leakage of sensitive data (such as user personal information, system passwords, etc.) is effectively prevented, and the security of data protection is enhanced. Although the sensitive data is desensitized, the preprocessing step ensures the integrity and readability of non-sensitive data, so that the desensitized log still has high availability, which is convenient for subsequent analysis and troubleshooting. Desensitization rules can be flexibly configured and expanded according to actual needs to adapt to different data protection needs and application scenarios. This makes the entire desensitization process more flexible and controllable. By rewriting and expanding at the log framework level, desensitization of log record information is achieved without modifying the business code. This reduces interference with business logic and reduces maintenance costs. Desensitization processing, as part of the system security strategy, helps to improve the security of the entire system. By reducing the risk of exposure of sensitive data, the possibility of the system being attacked maliciously and data leaks is reduced.
[0075] In one embodiment of the present invention, S2 includes:
[0076] Performing a preliminary judgment on the rewritten method data; the preliminary judgment includes judging the log length and judging the regular rule;
[0077] Get the log length judgment result and regular rule judgment result;
[0078] Acquire method data that meets a preset range of log length according to the log length determination result;
[0079] Then, according to the regular rule judgment result, method data that meets the preset range of the regular rule is obtained;
[0080] Then, the judgment passing data after the preliminary judgment is obtained.
[0081] The working principle of the above technical solution is as follows: make a preliminary judgment on the rewritten log recording method data. This step is to filter out data that meets both the log length requirements and the regular rule constraints to ensure the efficiency and accuracy of subsequent processing. Make a length judgment on each log record. This usually involves comparing whether the number of bytes or characters of the log record is within a preset range. The preset range can be set according to actual needs, such as excluding log records that are too long or too short because they may not contain valuable information or do not meet specific log specifications. Obtain the log length judgment result, that is, which log records meet the preset length range. Make a regular rule judgment on the log records that pass the length judgment. This step is to identify whether the log record contains data with a specific pattern, which may be sensitive information or content that requires special processing. Use a predefined regular expression to match the log record and obtain the regular rule judgment result, that is, which log records meet the preset range of the regular rule. Combine the log length judgment result and the regular rule judgment result, and only retain those method data that meet the preset range of both. These data are regarded as the data that have passed the preliminary judgment and will be used for subsequent desensitization processing or other analysis operations.
[0082] The technical effect of the above technical solution is: through the dual judgment of log length and regular rules, the log records that need to be processed can be screened out more accurately, avoiding the processing of irrelevant or invalid data, and improving the accuracy and efficiency of data processing. The preliminary judgment process reduces the amount of data that needs to be processed in the subsequent processing steps, thereby reducing the processing burden of the system and helping to improve the overall performance of the system. The preliminary judgment ensures that only log records that meet specific requirements are retained for subsequent processing. These log records usually contain more valuable information and help to improve the availability of log data. The preset range of log length and regular rules can be flexibly configured and expanded according to actual needs to adapt to different application scenarios and data protection requirements. This flexibility makes the entire preliminary judgment process more adaptable to changes and easy to maintain and update. Through preliminary judgment, some log records that may contain sensitive information but do not meet specific specifications can be excluded in advance, further improving the security of data. This helps to reduce the risk of leakage of sensitive information and protect user privacy and system security.
[0083] In one embodiment of the present invention, S3 includes:
[0084] Obtaining preset single-line log regular matching rule information, splitting the judgment data according to the preset single-line log regular matching information through a desensitization program, and obtaining multiple k or v fields;
[0085] Loop through each k field. When the k field is within the preset range of fields to be desensitized, desensitize the v value corresponding to k to obtain the desensitization result.
[0086] When k is not within the preset range of fields to be desensitized, the loop processing continues to obtain the final processed data.
[0087] The working principle of the above technical solution is as follows: the system or program needs to read the preset single-line log regular matching rules from the configuration file. These rules define how to identify key information in the log (i.e., k or v fields), which are implemented through regular expressions. Using the desensitization program, the data that has been preliminarily judged to be passed (i.e., log records that meet the log length and the preset range of the regular rules) are split according to the regular matching rule information obtained. The splitting process extracts the information in the log record to form a set of multiple k (key) or v (value) fields. The program will traverse all the k fields obtained by the split. The purpose of the traversal is to check whether each k field belongs to the preset field range that needs to be desensitized. When a k field is found to be within the preset range of fields that need to be desensitized, the program will perform desensitization on the v value corresponding to the k field. The specific methods of desensitization may include replacement, encryption, truncation, etc., depending on the desensitization strategy and business needs. After desensitization, the original v value is replaced with the desensitization result, while the k field that is not within the range of the field that needs to be desensitized and its corresponding v value remain unchanged. After the above steps, all fields that need to be desensitized have been desensitized, and the fields that do not need to be desensitized remain as they are. At this point, the program will output or store the final processed data.
[0088] The technical effect of the above technical solution is: by desensitizing sensitive fields, the risk of sensitive information leakage can be effectively reduced, and user privacy and system security can be protected. The process realizes automated processing, reduces the need for manual intervention, and improves processing efficiency and accuracy. At the same time, by splitting and identifying log data through regular matching rules, the fields that need to be desensitized can be quickly and accurately located. The preset range of fields to be desensitized and the desensitization strategy can be flexibly configured and expanded according to actual needs. When business needs change, only the regular matching rules and desensitization strategies in the configuration file need to be updated, without large-scale modification of the program. During the desensitization process, only the fields that need to be desensitized are modified, and other non-sensitive fields remain unchanged. This helps to maintain the integrity and consistency of the data and ensure that the desensitized data is still useful. Since the entire desensitization process is realized through configuration files and program automation, maintenance and management work becomes relatively simple. Administrators only need to pay attention to the update of configuration files and desensitization strategies, without in-depth understanding of the specific implementation details of the program.
[0089] In one embodiment of the present invention, the S4 includes:
[0090] Obtaining desensitization process data, and calculating a desensitization efficiency coefficient according to the desensitization process data;
[0091] The calculation formula of the desensitization efficiency coefficient is:
[0092]
[0093] Among them, T xl is the desensitization efficiency coefficient, R cg is the number of successfully desensitized logs, R zs is the total number of anonymized logs, M tm is the duration of desensitization treatment, M zm is the total processing time, Q t is the preset time weight value, Z js is the system resource saving rate, Z max is the historical maximum resource saving rate, Q z is the preset resource weight value;
[0094] Comparing the desensitization efficiency coefficient with a preset efficiency coefficient threshold to obtain an efficiency comparison result;
[0095] When the desensitization efficiency coefficient is greater than the preset efficiency coefficient threshold, the desensitization accuracy coefficient is calculated;
[0096] The calculation formula of the desensitization accuracy coefficient is:
[0097]
[0098] Among them, D tm is the desensitization accuracy coefficient, Z xx To correctly desensitize sensitive information data, zx is the total sensitive information data, Wbv is the reduction ratio of false alarm rate, W max is the maximum false alarm rate reduction ratio, Q w is the preset false alarm weight, L bv is the underreporting rate, Z jc is the total detection rate, Q lb is the preset underreporting weight;
[0099] Compare the desensitization accuracy coefficient with a preset accuracy threshold to obtain an accuracy comparison result;
[0100] Determine whether to update the desensitization process based on the accuracy comparison result.
[0101] The working principle of the above technical solution is: the system collects desensitization process data, including the number of desensitization successful logs (R cg ), total number of desensitized logs (R zs ), desensitization treatment duration (M tm ) and total processing time (M zm ) Calculate the desensitization efficiency coefficient (T) according to the desensitization efficiency coefficient calculation formula provided. xl ). At the same time, considering the preset time weight value (Q t ) and system resource saving rate (Z js ) and the historical maximum resource saving rate (Z max) and multiplied by the preset resource weight value (Q z ) to comprehensively evaluate the efficiency of the desensitization process. xl ) is compared with the preset efficiency coefficient threshold. If T xl If the value is greater than the preset threshold, it means that the desensitization process has reached the expected or better level in terms of efficiency. At this time, the desensitization accuracy coefficient (D tm The calculation of the desensitization accuracy coefficient takes into account the sensitive information data that is correctly desensitized (Z xx ), total sensitive information data (O zx ), false alarm rate reduction ratio (W bv ), maximum false alarm rate reduction ratio (W max ), false negative rate (L bv ), total detection rate (Z jc ) and the corresponding preset weights (Q w and Q lb ). The calculated desensitization accuracy coefficient (D tm ) is compared with the preset accuracy threshold. Based on the accuracy comparison result, the system determines whether the desensitization process needs to be updated. tm If it is higher than the preset threshold, it means that the desensitization process also performs well in terms of accuracy and may not need to be updated immediately; otherwise, it may be necessary to optimize the desensitization strategy, algorithm or parameters.
[0102] The technical effect of the above technical solution is: by comprehensively considering multiple dimensions such as desensitization success rate, processing speed, system resource utilization, false alarm rate, and missed alarm rate, a comprehensive evaluation of the desensitization process is achieved. Based on the evaluation results, the system can intelligently determine whether the desensitization process needs to be updated, providing strong support for optimizing decisions. Through regular evaluation and adjustment, desensitization strategies and algorithms are continuously optimized to improve desensitization efficiency and accuracy and reduce the risk of sensitive information leakage. Considering the system resource saving rate during the evaluation process helps to optimize resource allocation and improve resource utilization efficiency. Evaluation indicators and thresholds can be flexibly configured and expanded according to actual needs to adapt to different business scenarios and security requirements. Establish a cycle of continuous improvement to ensure that the desensitization process always remains efficient and accurate through continuous evaluation, optimization, and updating.
[0103] In one embodiment of the present invention, the desensitization system comprises:
[0104] The rewriting module is used to rewrite the Java framework log module method through the desensitization program, add desensitization logic to the log content to the rewritten method, and obtain additional data information;
[0105] A preliminary judgment module is used to obtain log record information through a desensitization program, perform preliminary judgment on the log record information, obtain preliminary judgment information, and obtain judgment pass data according to the preliminary judgment information;
[0106] The desensitization parsing module is used to parse the judgment information according to the preset single-line log regular matching through the desensitization program, and then perform a cyclic judgment on the k value to obtain the cyclic judgment information, perform desensitization processing according to the cyclic judgment result, and obtain the final processing result;
[0107] The performance calculation module is used to calculate the desensitization efficiency coefficient, judge the desensitization efficiency, and then calculate the desensitization accuracy coefficient, judge the desensitization accuracy, and update the desensitization process data in real time according to the judgment results;
[0108] S5. After all the cycle judgments are desensitized, the desensitization completion result is obtained, and the log record information after or without desensitization is output.
[0109] The working principle of the above technical solution is as follows: obtain the original log record information. Use the desensitization program to make a preliminary judgment on these log record information to distinguish which information needs to be desensitized (i.e. sensitive information) and which information can remain unchanged (i.e. non-sensitive information). After the preliminary judgment, a set of judgment-passing data is obtained, which contains the log record information that needs to be further processed (i.e. desensitized). The desensitization program uses the preset single-line log regular matching rules to parse the data that has passed the judgment. These regular matching rules are used to identify specific formats or contents in the log, such as personal identity information, account information and other sensitive data. The program enters a loop judgment process and performs a loop judgment on the identified sensitive information with a k value (which may represent a certain loop or iteration condition, such as the type or quantity of sensitive information). Ensure that all sensitive information is correctly identified and processed. In the loop judgment process, the sensitive information is desensitized according to the judgment results, such as replacing the real data with placeholders, hash values or fuzzification, etc., to protect privacy and security. At the same time or after the desensitization process, the system will calculate the desensitization efficiency coefficient and the desensitization accuracy coefficient. Used to evaluate the speed and accuracy of the desensitization process. The desensitization accuracy coefficient may be evaluated by comparing the data differences before and after desensitization and whether the necessary non-sensitive information is retained. Based on the evaluation results, the system may update the desensitization process data in real time to optimize the subsequent processing efficiency and accuracy. When all cycle judgments are completed and all sensitive information has been desensitized, the system obtains the final desensitization completion result. The system will output the log record information after desensitization, or directly output the original record for some information that does not need to be desensitized. This can protect sensitive information from being leaked while maintaining the integrity and readability of the log.
[0110] The technical effects of the above technical solution are: through desensitization processing, sensitive information in the log is effectively protected from illegal acquisition and use, reducing the risk of data leakage. While protecting privacy, the validity and readability of log records are maintained, which is helpful for subsequent log analysis and troubleshooting. By calculating the desensitization efficiency coefficient, the system can continuously optimize the processing flow and improve the speed of desensitization processing. By calculating the desensitization accuracy coefficient, the system can ensure the accuracy of desensitization processing and avoid accidental deletion or omission of sensitive information. : The system supports real-time updating of desensitization process data, and can quickly adjust the processing strategy according to the latest evaluation results, thereby improving the flexibility and adaptability of the system.
[0111] In one embodiment of the present invention, the rewriting module includes:
[0112] Obtain the log record information output by the application during operation, rewrite the Java framework log module method data through the desensitization program, and obtain the rewritten method data;
[0113] Add desensitization rule information to log record information through rewritten method data to obtain added data information;
[0114] The added data information is preprocessed to obtain the preprocessed added data information.
[0115] The working principle of the above technical solution is as follows: the system or framework will continuously generate and output log information during operation. These log information contains various types of data such as the running status of the application, user behavior, system anomalies, etc. In order to achieve the desensitization of log information, it is necessary to rewrite the method responsible for logging in the Java framework. This usually involves modifying or extending the API call of the logging framework (such as Log4j, SLF4J, etc.). New logging methods are created through inheritance or decoration mode, etc. These methods will first desensitize the log information before calling the original logging method internally. In the rewritten method data, desensitization rule information for the log information is added. These rules are based on regular expressions, keyword matching or other custom logic to identify and mark sensitive data that needs to be desensitized. Desensitization rules can be flexibly configured to adapt to different data protection requirements and application scenarios. Log records containing desensitization rule information are preprocessed. The preprocessing step may include: identifying and extracting the sensitive data part in the log information. Applying the corresponding desensitization rules to replace the sensitive data with a desensitized form (such as placeholders, hash values, etc.). Ensure that non-sensitive data remains unchanged to maintain the integrity and readability of the log. The preprocessed log information will no longer contain the original sensitive data, but retain enough information for subsequent analysis and troubleshooting.
[0116] The technical effect of the above technical solution is: by desensitizing the log record information, the leakage of sensitive data (such as user personal information, system passwords, etc.) is effectively prevented, and the security of data protection is enhanced. Although the sensitive data is desensitized, the preprocessing step ensures the integrity and readability of non-sensitive data, so that the desensitized log still has high availability, which is convenient for subsequent analysis and troubleshooting. Desensitization rules can be flexibly configured and expanded according to actual needs to adapt to different data protection needs and application scenarios. This makes the entire desensitization process more flexible and controllable. By rewriting and expanding at the log framework level, desensitization of log record information is achieved without modifying the business code. This reduces interference with business logic and reduces maintenance costs. Desensitization processing, as part of the system security strategy, helps to improve the security of the entire system. By reducing the risk of exposure of sensitive data, the possibility of the system being attacked maliciously and data leaks is reduced.
[0117] In one embodiment of the present invention, the preliminary determination module includes:
[0118] Performing a preliminary judgment on the rewritten method data; the preliminary judgment includes judging the log length and judging the regular rule;
[0119] Get the log length judgment result and regular rule judgment result;
[0120] Acquire method data that meets a preset range of log length according to the log length determination result;
[0121] Then, according to the regular rule judgment result, method data that meets the preset range of the regular rule is obtained;
[0122] Then, the judgment passing data after the preliminary judgment is obtained.
[0123] The working principle of the above technical solution is as follows: make a preliminary judgment on the rewritten log recording method data. This step is to filter out data that meets both the log length requirements and the regular rule constraints to ensure the efficiency and accuracy of subsequent processing. Make a length judgment on each log record. This usually involves comparing whether the number of bytes or characters of the log record is within a preset range. The preset range can be set according to actual needs, such as excluding log records that are too long or too short because they may not contain valuable information or do not meet specific log specifications. Obtain the log length judgment result, that is, which log records meet the preset length range. Make a regular rule judgment on the log records that pass the length judgment. This step is to identify whether the log record contains data with a specific pattern, which may be sensitive information or content that requires special processing. Use a predefined regular expression to match the log record and obtain the regular rule judgment result, that is, which log records meet the preset range of the regular rule. Combine the log length judgment result and the regular rule judgment result, and only retain those method data that meet the preset range of both. These data are regarded as the data that have passed the preliminary judgment and will be used for subsequent desensitization processing or other analysis operations.
[0124] The technical effect of the above technical solution is: through the dual judgment of log length and regular rules, the log records that need to be processed can be screened out more accurately, avoiding the processing of irrelevant or invalid data, and improving the accuracy and efficiency of data processing. The preliminary judgment process reduces the amount of data that needs to be processed in the subsequent processing steps, thereby reducing the processing burden of the system and helping to improve the overall performance of the system. The preliminary judgment ensures that only log records that meet specific requirements are retained for subsequent processing. These log records usually contain more valuable information and help to improve the availability of log data. The preset range of log length and regular rules can be flexibly configured and expanded according to actual needs to adapt to different application scenarios and data protection requirements. This flexibility makes the entire preliminary judgment process more adaptable to changes and easy to maintain and update. Through preliminary judgment, some log records that may contain sensitive information but do not meet specific specifications can be excluded in advance, further improving the security of data. This helps to reduce the risk of leakage of sensitive information and protect user privacy and system security.
[0125] In one embodiment of the present invention, the desensitization parsing module includes:
[0126] Obtaining preset single-line log regular matching rule information, splitting the judgment data according to the preset single-line log regular matching information through a desensitization program, and obtaining multiple k or v fields;
[0127] Loop through each k field. When the k field is within the preset range of fields to be desensitized, desensitize the v value corresponding to k to obtain the desensitization result.
[0128] When k is not within the preset range of fields to be desensitized, the loop processing continues to obtain the final processed data.
[0129] The working principle of the above technical solution is as follows: the system or program needs to read the preset single-line log regular matching rules from the configuration file. These rules define how to identify key information in the log (i.e., k or v fields), which are implemented through regular expressions. Using the desensitization program, the data that has been preliminarily judged to be passed (i.e., log records that meet the log length and the preset range of the regular rules) are split according to the regular matching rule information obtained. The splitting process extracts the information in the log record to form a set of multiple k (key) or v (value) fields. The program will traverse all the k fields obtained by the split. The purpose of the traversal is to check whether each k field belongs to the preset field range that needs to be desensitized. When a k field is found to be within the preset range of fields that need to be desensitized, the program will perform desensitization on the v value corresponding to the k field. The specific methods of desensitization may include replacement, encryption, truncation, etc., depending on the desensitization strategy and business needs. After desensitization, the original v value is replaced with the desensitization result, while the k field that is not within the range of the field that needs to be desensitized and its corresponding v value remain unchanged. After the above steps, all fields that need to be desensitized have been desensitized, and the fields that do not need to be desensitized remain as they are. At this point, the program will output or store the final processed data.
[0130] The technical effect of the above technical solution is: by desensitizing sensitive fields, the risk of sensitive information leakage can be effectively reduced, and user privacy and system security can be protected. The process realizes automated processing, reduces the need for manual intervention, and improves processing efficiency and accuracy. At the same time, by splitting and identifying log data through regular matching rules, the fields that need to be desensitized can be quickly and accurately located. The preset range of fields to be desensitized and the desensitization strategy can be flexibly configured and expanded according to actual needs. When business needs change, only the regular matching rules and desensitization strategies in the configuration file need to be updated, without large-scale modification of the program. During the desensitization process, only the fields that need to be desensitized are modified, and other non-sensitive fields remain unchanged. This helps to maintain the integrity and consistency of the data and ensure that the desensitized data is still useful. Since the entire desensitization process is realized through configuration files and program automation, maintenance and management work becomes relatively simple. Administrators only need to pay attention to the update of configuration files and desensitization strategies, without in-depth understanding of the specific implementation details of the program.
[0131] In one embodiment of the present invention, the performance calculation module includes:
[0132] Obtaining desensitization process data, and calculating a desensitization efficiency coefficient according to the desensitization process data;
[0133] The calculation formula of the desensitization efficiency coefficient is:
[0134]
[0135] Among them, T xl is the desensitization efficiency coefficient, R cg is the number of successfully desensitized logs, R zs is the total number of anonymized logs, M tm is the duration of desensitization treatment, M zm is the total processing time, Q t is the preset time weight value, Z js is the system resource saving rate, Z max is the historical maximum resource saving rate, Q z is the preset resource weight value;
[0136] Comparing the desensitization efficiency coefficient with a preset efficiency coefficient threshold to obtain an efficiency comparison result;
[0137] When the desensitization efficiency coefficient is greater than the preset efficiency coefficient threshold, the desensitization accuracy coefficient is calculated;
[0138] The calculation formula of the desensitization accuracy coefficient is:
[0139]
[0140] Among them, D tm is the desensitization accuracy coefficient, Z xx To correctly desensitize sensitive information data, zx is the total sensitive information data, Wbv is the reduction ratio of false alarm rate, W max is the maximum false alarm rate reduction ratio, Q w is the preset false alarm weight, L bv is the underreporting rate, Z jc is the total detection rate, Q lb is the preset underreporting weight;
[0141] Compare the desensitization accuracy coefficient with a preset accuracy threshold to obtain an accuracy comparison result;
[0142] Determine whether to update the desensitization process based on the accuracy comparison result.
[0143] The working principle of the above technical solution is: the system collects desensitization process data, including the number of desensitization successful logs (R cg ), total number of desensitized logs (R zs ), desensitization treatment duration (M tm ) and total processing time (M zm ) Calculate the desensitization efficiency coefficient (T) according to the desensitization efficiency coefficient calculation formula provided. xl). At the same time, considering the preset time weight value (Q t ) and system resource saving rate (Z js ) and the historical maximum resource saving rate (Z max ) and multiplied by the preset resource weight value (Q z ) to comprehensively evaluate the efficiency of the desensitization process. xl ) is compared with the preset efficiency coefficient threshold. If T xl If the value is greater than the preset threshold, it means that the desensitization process has reached the expected or better level in terms of efficiency. At this time, the desensitization accuracy coefficient (D tm The calculation of the desensitization accuracy coefficient takes into account the sensitive information data that is correctly desensitized (Z xx ), total sensitive information data (O zx ), false alarm rate reduction ratio (W bv ), maximum false alarm rate reduction ratio (W max ), false negative rate (L bv ), total detection rate (Z jc ) and the corresponding preset weights (Q w and Q lb ). The calculated desensitization accuracy coefficient (D tm ) is compared with the preset accuracy threshold. Based on the accuracy comparison result, the system determines whether the desensitization process needs to be updated. tm If it is higher than the preset threshold, it means that the desensitization process also performs well in terms of accuracy and may not need to be updated immediately; otherwise, it may be necessary to optimize the desensitization strategy, algorithm or parameters.
[0144] The technical effect of the above technical solution is: by comprehensively considering multiple dimensions such as desensitization success rate, processing speed, system resource utilization, false alarm rate, and missed alarm rate, a comprehensive evaluation of the desensitization process is achieved. Based on the evaluation results, the system can intelligently determine whether the desensitization process needs to be updated, providing strong support for optimizing decisions. Through regular evaluation and adjustment, desensitization strategies and algorithms are continuously optimized to improve desensitization efficiency and accuracy and reduce the risk of sensitive information leakage. Considering the system resource saving rate during the evaluation process helps to optimize resource allocation and improve resource utilization efficiency. Evaluation indicators and thresholds can be flexibly configured and expanded according to actual needs to adapt to different business scenarios and security requirements. Establish a cycle of continuous improvement to ensure that the desensitization process always remains efficient and accurate through continuous evaluation, optimization, and updating.
[0145] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A non-intrusive Java type application log desensitization method, characterized in that: The method comprises: S1. Rewrite the Java framework log module method through the desensitization program, add desensitization logic to the log content to the rewritten method, and obtain additional data information; S2. Obtain log record information through a desensitization program, make a preliminary judgment on the log record information to obtain preliminary judgment information, and obtain judgment pass data according to the preliminary judgment information; S3, parsing the judgment information according to the preset single-line log regular matching through the desensitization program, and then performing a cyclic judgment on the k value to obtain the cyclic judgment information, performing desensitization processing according to the cyclic judgment result, and obtaining the final processing result; S4. Calculate the desensitization efficiency coefficient, judge the desensitization efficiency, and then calculate the desensitization accuracy coefficient, judge the desensitization accuracy, and update the desensitization process data in real time according to the judgment result; S5. After all the cycle judgments are desensitized, the desensitization completion result is obtained, and the log record information after or without desensitization is output.
2. According to claim 1, a non-intrusive Java type application log desensitization method is characterized in that: The S1 includes: Obtain the log record information output by the application during operation, rewrite the Java framework log module method data through the desensitization program, and obtain the rewritten method data; Add desensitization rule information to log record information through rewritten method data to obtain added data information; The added data information is preprocessed to obtain the preprocessed added data information.
3. According to claim 1, a non-intrusive Java type application log desensitization method is characterized in that: The S2 includes: Performing a preliminary judgment on the rewritten method data; the preliminary judgment includes judging the log length and judging the regular rule; Get the log length judgment result and regular rule judgment result; Acquire method data that meets a preset range of log length according to the log length determination result; Then, according to the regular rule judgment result, method data that meets the preset range of the regular rule is obtained; Then, the judgment passing data after the preliminary judgment is obtained.
4. According to claim 1, a non-intrusive Java type application log desensitization method is characterized in that: The S3 includes: Obtaining preset single-line log regular matching rule information, splitting the judgment data according to the preset single-line log regular matching information through a desensitization program, and obtaining multiple k or v fields; Loop through each k field. When the k field is within the preset range of fields to be desensitized, desensitize the v value corresponding to k to obtain the desensitization result. When k is not within the preset range of fields to be desensitized, the loop processing continues to obtain the final processed data.
5. According to claim 1, a non-intrusive Java type application log desensitization method is characterized in that: The S4 includes: Obtaining desensitization process data, and calculating a desensitization efficiency coefficient according to the desensitization process data; Comparing the desensitization efficiency coefficient with a preset efficiency coefficient threshold to obtain an efficiency comparison result; When the desensitization efficiency coefficient is greater than the preset efficiency coefficient threshold, the desensitization accuracy coefficient is calculated; Compare the desensitization accuracy coefficient with a preset accuracy threshold to obtain an accuracy comparison result; Determine whether to update the desensitization process based on the accuracy comparison result.
6. A desensitization system for implementing the non-intrusive Java type application log desensitization method of claim 1, characterized in that: The desensitization system comprises: The rewriting module is used to rewrite the Java framework log module method through the desensitization program, add desensitization logic to the log content to the rewritten method, and obtain additional data information; A preliminary judgment module is used to obtain log record information through a desensitization program, perform preliminary judgment on the log record information, obtain preliminary judgment information, and obtain judgment pass data according to the preliminary judgment information; The desensitization parsing module is used to parse the judgment information according to the preset single-line log regular matching through the desensitization program, and then perform a cyclic judgment on the k value to obtain the cyclic judgment information, perform desensitization processing according to the cyclic judgment result, and obtain the final processing result; The performance calculation module is used to calculate the desensitization efficiency coefficient, judge the desensitization efficiency, and then calculate the desensitization accuracy coefficient, judge the desensitization accuracy, and update the desensitization process data in real time according to the judgment results; S5. After all the cycle judgments are desensitized, the desensitization completion result is obtained, and the log record information after or without desensitization is output.
7. According to claim 6, a desensitization system for a non-intrusive Java type application log desensitization method, characterized in that: The rewrite module includes: Obtain the log record information output by the application during operation, rewrite the Java framework log module method data through the desensitization program, and obtain the rewritten method data; Add desensitization rule information to log record information through rewritten method data to obtain added data information; The added data information is preprocessed to obtain the preprocessed added data information.
8. According to claim 6, a desensitization system for a non-intrusive Java type application log desensitization method is characterized in that: The preliminary judgment module includes: Performing a preliminary judgment on the rewritten method data; the preliminary judgment includes judging the log length and judging the regular rule; Get the log length judgment result and regular rule judgment result; Acquire method data that meets a preset range of log length according to the log length determination result; Then, according to the regular rule judgment result, method data that meets the preset range of the regular rule is obtained; Then, the judgment passing data after the preliminary judgment is obtained.
9. According to claim 6, a desensitization system for a non-intrusive Java type application log desensitization method, characterized in that: The desensitization parsing module includes: Obtaining preset single-line log regular matching rule information, splitting the judgment data according to the preset single-line log regular matching information through a desensitization program, and obtaining multiple k or v fields; Loop through each k field. When the k field is within the preset range of fields to be desensitized, desensitize the v value corresponding to k to obtain the desensitization result. When k is not within the preset range of fields to be desensitized, the loop processing continues to obtain the final processed data.
10. According to claim 6, a desensitization system for a non-intrusive Java type application log desensitization method, characterized in that: The performance calculation module includes: Obtaining desensitization process data, and calculating a desensitization efficiency coefficient according to the desensitization process data; Comparing the desensitization efficiency coefficient with a preset efficiency coefficient threshold to obtain an efficiency comparison result; When the desensitization efficiency coefficient is greater than the preset efficiency coefficient threshold, the desensitization accuracy coefficient is calculated; Compare the desensitization accuracy coefficient with a preset accuracy threshold to obtain an accuracy comparison result; Determine whether to update the desensitization process based on the accuracy comparison result.
Citation Information
Patent Citations
General data desensitization method, general data desensitization component, general data desensitization system, computer equipment and storage medium
CN113343293A
Big data comparison test method and device, electronic equipment and storage medium
CN115203017A
Log desensitization method and device based on logback log component and computer equipment
CN115391825A
Log desensitization method and device, electronic equipment and storage medium
CN116244740A
Underground pipeline data desensitization method and device, electronic equipment and storage medium
CN117077191A