Log desensitization method and device based on chain of responsibility and storage medium

By introducing the responsibility chain structure and desensitization components into the log framework, sensitive data in the logs are processed step by step, which solves the problem of insufficient reliability of log desensitization, achieves accurate identification and processing of various sensitive data, and improves log quality. Reliability and personalized effects of desensitization.

CN118709227APending Publication Date: 2024-09-27CHINA MERCHANTS BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410837915.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

Existing log frameworks such as Apache Log4j2 are difficult to accurately identify and process a variety of sensitive data during the log desensitization process, resulting in insufficient reliability of desensitization results.

Method used

Adopt the log desensitization method based on the responsibility chain, obtain the log event object through the log desensitization interface, and desensitize the data to be desensitized step by step through the desensitization responsibility chain formed by the log desensitization component, using regular expressions and placeholders Strategies such as character substitution to ensure accurate identification and processing of sensitive data.

Benefits of technology

It improves the reliability of log desensitization, avoids desensitization of irrelevant data and omission of sensitive data, and achieves more accurate identification of sensitive information and personalized desensitization effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709227A
    Figure CN118709227A
Patent Text Reader

Abstract

The invention discloses a log desensitization method and device based on a chain of responsibility and a storage medium, and belongs to the technical field of log desensitization. The method comprises the steps that to-be-desensitized data obtained by a log recorder is packaged, and a log event object is generated; transmitting the log event object to a log desensitization component through a log desensitization interface, and desensitizing the log event object step by step through a desensitization responsibility chain formed by the log desensitization component; and according to a desensitization result, generating log data and outputting the log data. According to the method, the log desensitization interface is defined in the log framework, the desensitization responsibility chain is formed through the corresponding log desensitization components, the logs are desensitized through the desensitization responsibility chain, and each log desensitization component only processes one piece of sensitive information, so that the accuracy of identifying the sensitive information in the to-be-desensitized log data is improved, and the sensitivity of the to-be-desensitized log data is improved. And the reliability of log desensitization is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of log desensitization, and in particular to a log desensitization method, device and storage medium based on chain of responsibility. Background Art

[0002] Logs usually contain sensitive data such as system information or user personal information. Therefore, during the log output process, the logs need to be desensitized to prevent the leakage of sensitive data.

[0003] In related logging frameworks such as Apache Log4j2 (an open source logging framework based on object-oriented programming), although it provides rich logging and formatting functions, it does not directly support log desensitization. Therefore, after the logging framework outputs the log file, the developer needs to use a special desensitization plug-in to desensitize the log file.

[0004] However, in the log desensitization process, logs usually contain multiple sensitive data. Different types of sensitive data usually require different strategies for desensitization. Desensitization plug-ins usually need to use complex algorithms that include multiple desensitization strategies to simultaneously identify multiple sensitive data in log files. In this case, different desensitization strategies may affect each other, making it difficult to accurately identify all sensitive data in the log. This leads to insufficient reliability of log desensitization results.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The main purpose of this application is to provide a log desensitization method, device and storage medium based on the chain of responsibility, aiming to solve the technical problem of insufficient reliability of log desensitization in related log frameworks.

[0007] To achieve the above objectives, the present application provides a log desensitization method based on chain of responsibility, the method comprising the following steps:

[0008] Encapsulate the data to be desensitized obtained by the logger and generate a log event object;

[0009] The log event object is transmitted to the log desensitization component through the log desensitization interface, and the log event object is desensitized step by step through the desensitization responsibility chain formed by the log desensitization component;

[0010] Based on the desensitization results, log data is generated and output.

[0011] In one embodiment, the steps of transmitting the log event object to the log desensitization component through the log desensitization interface, and desensitizing the log event object step by step through the desensitization responsibility chain formed by the log desensitization component include:

[0012] Determine at least one of the log desensitizing components corresponding to the log desensitizing interface, and the desensitizing responsibility chain formed by the log desensitizing components;

[0013] Input the log event object into the log desensitization component corresponding to the first-level node of the desensitization responsibility chain;

[0014] Based on the desensitization order of the log desensitization components in the desensitization responsibility chain and the log desensitization components corresponding to the first-level nodes, the data to be desensitized is desensitized level by level.

[0015] In one embodiment, the step of desensitizing the log data to be desensitized level by level based on the desensitization order of the log desensitization components in the desensitization responsibility chain and the log desensitization components corresponding to the first-level nodes includes:

[0016] According to the desensitization order, determine the corresponding log desensitization component;

[0017] Inputting the information to be processed into the log desensitizing component, and desensitizing the data to be processed by the log desensitizing component;

[0018] The processing result of the log desensitization component is obtained, and the processing result is transmitted as the data to be processed to the log desensitization component of the next level node in the desensitization responsibility chain.

[0019] In one embodiment, the step of inputting the information to be processed into the log desensitizing component and desensitizing the data to be processed by the log desensitizing component includes:

[0020] Determine the desensitization range in the data to be processed by using the regular expression in the log desensitization component, and match the data to be processed based on the desensitization range;

[0021] Determining sensitive data in the data to be processed according to the matching result;

[0022] The sensitive data is replaced by a placeholder, and the processing result is generated and output.

[0023] In one embodiment, the step of generating and outputting log data according to the desensitization result includes:

[0024] The desensitization result is input into a format parser, and the format parser performs data formatting on the desensitization result based on a data formatting rule preset in a layout configuration file to generate the log data;

[0025] The log data is output.

[0026] In one embodiment, before the step of transmitting the log event object to the log desensitization component through the log desensitization interface and desensitizing the log event object step by step through the desensitization responsibility chain formed by the log desensitization component, the step further includes:

[0027] After receiving the target desensitizing component, obtain the metadata of the target desensitizing component and the configuration data of the current responsibility chain;

[0028] Determine, according to the metadata and the current responsibility chain, the insertion position of the target desensitizing component in the current responsibility chain;

[0029] A reference relationship of the target desensitizing component is added to the adjacent desensitizing component at the insertion position to form the desensitizing responsibility chain.

[0030] In one embodiment, the step of encapsulating the data to be desensitized obtained by the logger to generate a log event object includes:

[0031] Obtain the data to be desensitized recorded by the target program through a log recorder;

[0032] Obtain relevant information of the data to be desensitized, encapsulate the data to be desensitized according to the relevant information, and generate the log event object.

[0033] In one embodiment, the step of obtaining relevant information of the data to be desensitized, encapsulating the data to be desensitized according to the relevant information, and generating the log event object includes:

[0034] Create an event object;

[0035] Obtain relevant information of the data to be desensitized, and assign a value to the event object according to the relevant information;

[0036] According to the log generation time, metadata is added to the event pair object to generate a log event object.

[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a log desensitization device based on the chain of responsibility, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the log desensitization method based on the chain of responsibility as described above.

[0038] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the log desensitization method based on the chain of responsibility as described above are implemented.

[0039] One or more technical solutions proposed in this application have at least the following technical effects:

[0040] This application can desensitize the log during the output process of the log by defining the log desensitization interface in the log framework, obtaining the corresponding log desensitization component, and through the desensitization responsibility chain formed by the log desensitization component. Among them, each log desensitization component only processes one sensitive information, and different strategies can be adopted between different log desensitization components to achieve step-by-step desensitization of the log, ensuring that the accuracy of identifying sensitive information in the desensitized log data is improved, avoiding the situation of desensitizing irrelevant data or omitting sensitive data, thereby improving the reliability of log desensitization. In addition, this application can dynamically adjust the log desensitization component and the desensitization responsibility chain according to the desensitization effect of the log, improve the desensitization effect of the log, and dynamically configure the log desensitization range, for some special business scenarios, to achieve personalized desensitization. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0043] Figure 1 This is a flow chart of the first embodiment of the log desensitization method based on the chain of responsibility of this application;

[0044] Figure 2 This is a log output process diagram involved in the first embodiment of the log desensitization method based on the chain of responsibility of this application;

[0045] Figure 3 This is a flow chart of the second embodiment of the log desensitization method based on the chain of responsibility of this application;

[0046] Figure 4 This is a schematic diagram of the log desensitization process involved in the log desensitization method based on the chain of responsibility of this application;

[0047] Figure 5It is a structural diagram of a log desensitizing device based on the responsibility chain in the hardware operating environment involved in the embodiment of the present application.

[0048] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0049] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0051] The main solution of the embodiment of the present application is: obtain the log to be desensitized generated in the log framework, and determine at least one corresponding log desensitizing component according to the log desensitizing interface; desensitize the log to be desensitized step by step through the desensitization responsibility chain formed by the log desensitizing component; generate a desensitized log according to the desensitization result, and write the desensitized log into the log recorder.

[0052] In log frameworks that do not directly support log desensitization, such as Apache Log4j2, developers usually use special desensitization components or write corresponding log desensitization programs in the log framework to desensitize log data. However, since log data usually contains multiple types of sensitive data, different types of sensitive data usually require different strategies for desensitization. It is usually difficult to accurately identify all sensitive data in log data through programs written in the log framework or special desensitization components, and there may be omissions or false detections of sensitive data. Therefore, the reliability of log desensitization is insufficient.

[0053] This application can desensitize the log during the log output process by defining a log desensitization interface in the log framework, obtaining the corresponding log desensitization component, and forming a desensitization responsibility chain through the log desensitization component. Each log desensitization component only processes one sensitive information, and different log desensitization components can adopt different strategies to achieve step-by-step desensitization of the log, ensuring that the accuracy of identifying sensitive information in the desensitized log data is improved, avoiding the desensitization of irrelevant data or the omission of sensitive data, thereby improving the reliability of log desensitization.

[0054] In order to better understand the above technical solution, exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0055] It should be noted that the execution subject of this embodiment can be a log system, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device that can achieve the above functions, a log desensitization device based on the chain of responsibility, etc. This embodiment does not specifically limit this. The following takes the log system as an example to illustrate this embodiment and the following embodiments.

[0056] During the output process of bank logs, sensitive data such as user identity information and user account information, which may cause serious losses in the event of data leakage, are usually involved. However, since the types of sensitive data in bank logs are relatively complex, when the relevant log desensitization technology is applied to bank logs, some sensitive information may be difficult to accurately desensitize, or the desensitized data may still be recoverable through other means. In order to improve the security of sensitive data, the embodiment of the present application provides a log desensitization method based on the chain of responsibility, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the log desensitization method based on the chain of responsibility of this application.

[0057] In this embodiment, the log desensitization method based on the chain of responsibility includes steps S10 to S30:

[0058] Step S10: Encapsulate the data to be desensitized obtained by the logger and generate a log event object;

[0059] In this embodiment, the log event object is an object that describes what happened in the application or system. It usually contains detailed information related to the event for subsequent analysis, auditing or troubleshooting. The desensitized data is the log data that has not been desensitized. After the application or system records it by itself, it is transmitted to the logger by the application or system, or actively obtained by the logger.

[0060] Specifically, the logger can monitor the behavior of the target program and obtain the behavior data of the target program after detecting the action of the target program, or obtain the behavior data of the target program according to the log information after receiving the log information sent by the target program. After obtaining the behavior data of the target program and obtaining the relevant log data processing process such as the reliability string of the behavior data, the data to be desensitized is obtained.

[0061] As an optional implementation, after obtaining the log data that has not been desensitized, the log system will encapsulate the desensitized data according to a preset configuration and generate a log event object.

[0062] For example, Figure 2 As shown, Figure 2 It is a log output process flow diagram involved in this embodiment. Taking the Log4j2 log framework as an example, the flow chart describes the entire process of Log4j2 log from log request to final log entry formatting and output. Among them, when the log recorder (Logger) obtains the log data to be desensitized, it will transfer the log data (log) to the ReliabilityStrategy class, and perform reliability processing such as log merging and data synchronization on the log data through the preset reliability strategy. After the log system performs reliability processing, it will further process the log based on the preset configuration file through the log configuration module (LogConfig).

[0063] Further, the log configuration module includes a log event factory (LogEventFactory). Among them, the log event factory is a factory class responsible for creating log instances, which is used to create and manage components of log events, and can provide standardized and simplified processing procedures for log records. The log system can encapsulate the desensitized data through the log event factory. During the encapsulation process of the desensitized data, the log event factory will create an event object, obtain relevant information in the desensitized data, and assign values ​​to the event object according to the relevant data. The log event factory can encapsulate and generate a log event object (LogEvent) based on the information contained in the acquired desensitized data, after adding metadata such as log generation time and log level to the event object. Among them, relevant information includes but is not limited to information such as log source, log process, and log content.

[0064] It should be noted that the log output process usually involves three stages: the application outputs the data to be desensitized, the log data is output, or the log is displayed. Among them, desensitizing the data when the application outputs it requires all applications that generate logs to perform relevant configurations for log desensitization, which has a high development cost, and in large projects, the desensitization effect of the log is poor. Desensitizing the log data to be displayed each time the log is displayed, which puts a high load on the system and affects the response time of the log display and the log desensitization effect. Therefore, the present application generates log data after desensitizing the data to be desensitized during the log output process, and saves the log data to the target medium.

[0065] As another optional implementation, the log system can also desensitize the data to be desensitized through the desensitization responsibility chain before encapsulating the data into log event objects. After desensitization, it can be encapsulated into log time objects according to the desensitization results, and output to the target medium after formatting.

[0066] Step S20: The log event object is transmitted to the log desensitization component through the log desensitization interface, and the log event object is desensitized step by step through the desensitization responsibility chain formed by the log desensitization component;

[0067] In this embodiment, based on the interfaces between the various log desensitization components, a chain-like data structure can be connected to form a responsibility chain model, and the sensitive data of the log event object can be desensitized step by step. Among them, each log desensitization component focuses on processing one sensitive data, which can more accurately identify the corresponding type of sensitive data in the log event object.

[0068] Specifically, when performing log desensitization, the log system can determine at least one corresponding log desensitization component and the desensitization responsibility chain composed of or in which the log desensitization component is located according to the log desensitization interface in the log event factory. The log system will input the log event object into the log desensitization component corresponding to the first-level node of the desensitization responsibility chain, and desensitize the log event object step by step based on the desensitization order of the log desensitization component in the desensitization responsibility chain and the log desensitization component corresponding to the first-level node. The log desensitization component is configured with a component interface of the next-level log desensitization component based on the desensitization order of the desensitization responsibility chain. After completing the processing of the data to be processed, or when it is determined that the data to be processed cannot be processed, the processing result of the data can be used as the data to be processed and transmitted to the next-level log desensitization component. Among them, the data to be processed is the intermediate data of the log event object in the desensitization process of the desensitization responsibility chain, which is used to express the input data received by each log desensitization component.

[0069] For example, Figure 2As shown. The output controller (AppenderControl) is responsible for controlling the log output module (Appender) to output log data, and can transmit information and instructions through the callAppender method. Log data can be output to different media such as files, databases, consoles, etc. The log data all comes from the log event object (LogEvent) created in the log event factory (LogEventFactory). Therefore, by configuring the log event project, log information desensitization can be completed in the log event object, and global desensitization of the log can be achieved. Among them, the interface definition of the log event factory is as follows:

[0070] public interface LogEventFactory extends LocationAwareLogEventFactory{

[0071] LogEvent createEvent(String loggerName,Marker marker,String fqcn,Level level,Message data,List Property>properties,Throwable t);}

[0072] Optionally, the log system can also schedule the log desensitization component according to the desensitization order of the responsibility chain. After determining the current log desensitization component according to the desensitization order, the information to be processed is input into the log desensitization component, the data to be processed is desensitized by the log desensitization component, and the processing result of the log desensitization component is obtained, and the processing result is transmitted as the data to be processed to the log desensitization component of the next node in the desensitization responsibility chain.

[0073] In one embodiment, since the log desensitization component adopts different desensitization strategies to desensitize different types of desensitized data, the log desensitization component is based on different regular rules and includes corresponding regular expressions. The log system can determine the desensitization range in the data to be processed through the regular expression in the log desensitization component, and match the log event object within the desensitization range with the regular expression. Based on the matching results of the log event object within the desensitization range and the regular expression, the log system can determine the target data in the data to be processed that needs to be desensitized.

[0074] For example, taking the working scenario of the banking system as an example, the user's name, bank card number, ID number, email address, etc. need to be desensitized during the log desensitization process. When desensitizing the name, the log desensitization component can use (\b[A-Za-z]+\s[A-Za-z]+\b) as a regular expression to match names composed of two words or pinyin in the form of "First Last". The email address can be identified by ([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}), and the bank card number can be identified based on 16 digits using (\d{16}) to determine the corresponding target data.

[0075] Furthermore, the log system can replace the target data with a placeholder according to the preset configuration of different log desensitization components, or encrypt the target data by an encryption method such as a hash algorithm, thereby generating and outputting the processing result. The log desensitization component can obtain the log level of the log event object and whether sensitive data needs to be restored based on the metadata contained in different log event objects, and adopt corresponding desensitization methods such as placeholder replacement or encryption, or perform desensitization according to its own pre-configured desensitization method. Among them, the log level is generated by the application according to the corresponding data to be desensitized, and the metadata is generated by the log event factory and encapsulated in the log event object.

[0076] Step S30: Generate and output log data based on the desensitization results.

[0077] In this embodiment, after the log is desensitized, that is, after receiving the processing result of the log desensitization component at the last level of the desensitization responsibility chain, the log system can generate log data after further processing the desensitization result and save it to the target medium. The target medium can be a different storage medium such as a file, a database, a console, etc., for saving the desensitized log data and providing query and display.

[0078] In one embodiment, if Figure 2 As shown, the log file can obtain the preset data formatting rules in the log layout module, and through the format parser, based on the data formatting rules, the desensitization result is formatted to generate log data.

[0079] Exemplarily, after the desensitized log data is output through the log output module (Appender), the format parser (Layout) will format the log data through the getLayout class. The log layout module can use commas, semicolons, etc. as separators to distinguish different log levels or categories, and format the fields in the log data according to preset formatting rules. For example, the date and time can be formatted into a common date and time format, such as "yyyy-MM-dd HH:mm:ss". In addition, for special characters or escape characters in the log data, appropriate escape processing is required to ensure the readability of the log.

[0080] After formatting is completed, the log system can determine the target medium for log data output according to the settings in the layout configuration file, and finally output the formatted log data to the specified target medium. Users can query the log data in the target medium through log query platforms such as bank query systems to facilitate log viewing and analysis.

[0081] The embodiment of the present application can desensitize the log during the log output process by defining a log desensitization interface within the log framework, obtaining the corresponding log desensitization component, and forming a desensitization responsibility chain through the log desensitization component. Each log desensitization component only processes one sensitive information, and different log desensitization components can adopt different strategies to achieve step-by-step desensitization of the log, ensuring that the accuracy of identifying sensitive information in the log data to be desensitized is improved, avoiding the situation of desensitizing irrelevant data or omitting sensitive data, thereby improving the reliability of log desensitization.

[0082] Based on the same inventive concept, the present application also provides a second embodiment, referring to Figure 3 , Figure 3 This is a flow chart of the second embodiment of the log desensitization method based on the chain of responsibility of this application.

[0083] In this embodiment, before obtaining the data to be desensitized as described in step S10 and encapsulating the data to be desensitized and generating a log event object, steps S11 to S13 are also included:

[0084] Step S11: after receiving the target desensitizing component, obtaining metadata of the target desensitizing component and configuration data of the current responsibility chain;

[0085] Step S12: Determine the insertion position of the target desensitizing component in the current responsibility chain according to the metadata and the current responsibility chain;

[0086] Step S13: adding a reference relationship of the target desensitizing component to the adjacent desensitizing components at the insertion position to form the desensitizing responsibility chain.

[0087] In this embodiment, the desensitized responsibility chain in the log system can be adjusted according to the desensitization effect of the log data. After receiving the target desensitized component that needs to be added to the desensitized responsibility chain, the log system can determine the insertion position of the target desensitized component in the current responsibility chain based on the metadata in the log desensitized component and the current desensitized responsibility chain, that is, the current responsibility chain, and determine the log desensitized components adjacent to the insertion position.

[0088] In specific implementation, after determining the adjacent log desensitizing components, the log system will modify the interface data in the adjacent desensitizing components according to the metadata of the target desensitizing components, thereby adding a reference relationship of the target desensitizing components in the adjacent desensitizing components to form a desensitizing responsibility chain.

[0089] Optionally, when some log desensitizing components need to be removed in the desensitizing responsibility chain, the log system can also determine the adjacent desensitizing components of the target log desensitizing components to be removed, modify the interface data in the adjacent desensitizing components, and add a reference relationship between the two adjacent desensitizing components.

[0090] In the embodiment of the present application, the desensitized responsibility chain can add and delete log desensitization components, thereby improving the reliability of the desensitization of the desensitized responsibility chain. At the same time, the desensitized responsibility chain only needs to modify the configuration file, and the log system can automatically update the desensitization rules.

[0091] Since the system introduced in the second embodiment of the present application is a system used to implement the method of the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the first embodiment of the present application belong to the scope of protection of this application.

[0092] For example, to help understand the implementation process of the log desensitization method based on the responsibility chain obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 4 , Figure 4 A log desensitization process diagram of a log desensitization method based on a chain of responsibility is provided, specifically:

[0093] When the log system obtains the data to be desensitized output by the application, it can determine whether desensitization is required based on the data to be desensitized. When desensitization is not required, the data to be desensitized can be directly output to the target medium as log data. When desensitization is required, the data to be desensitized can be encapsulated as a log event object, the desensitization action can be performed through the responsibility chain, and the log data can be output according to the desensitization result.

[0094] After outputting the log data, the log system will monitor whether there is a newly configured log desensitization component. When the newly configured log desensitization component exists, the log system can obtain the log desensitization component and update it to the responsibility chain. Among them, by dynamically configuring the log desensitization range of the log desensitization component, personalized desensitization rules can be implemented for certain special business scenarios.

[0095] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the log desensitization method based on the responsibility chain of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0096] The present application provides a log desensitization device based on responsibility chain, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the log desensitization method based on responsibility chain in the above-mentioned embodiment 1.

[0097] Reference below Figure 5 , which shows a schematic diagram of the structure of a log desensitization device based on the responsibility chain suitable for implementing the embodiment of the present application. The log desensitization device based on the responsibility chain in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The log desensitization device based on the responsibility chain shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0098] like Figure 5As shown, the log desensitization device based on the chain of responsibility may include a processing device 1001 (such as a core processor, a graphics processor, etc.), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM: Read Only Memory) 1002 or the program loaded from the storage device 1003 to the random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the log desensitization device based on the chain of responsibility are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other via a bus 1005. The input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the log desensitization device based on the chain of responsibility to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a log desensitization device based on the chain of responsibility with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.

[0099] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0100] The log desensitization device based on responsibility chain provided by the present application adopts the log desensitization method based on responsibility chain in the above-mentioned embodiment, which can solve the technical problem that it is difficult to accurately identify all sensitive data in the log when a single desensitization plug-in is used to desensitize all desensitized data, resulting in insufficient reliability of the log desensitization result. Compared with the prior art, the beneficial effects of the log desensitization device based on responsibility chain provided by the present application are the same as the beneficial effects of the log desensitization method based on responsibility chain provided by the above-mentioned embodiment, and the other technical features of the log desensitization device based on responsibility chain are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0101] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0102] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0103] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the log desensitization method based on the chain of responsibility in the above-mentioned embodiment.

[0104] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0105] The above-mentioned computer-readable storage medium may be included in the log desensitization device based on the chain of responsibility; or it may exist independently without being assembled into the log desensitization device based on the chain of responsibility.

[0106] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the log desensitization device based on the chain of responsibility, the log desensitization device based on the chain of responsibility: encapsulates the data to be desensitized obtained by the log recorder and generates a log event object; transmits the log event object to the log desensitization component through the log desensitization interface, and desensitizes the log event object step by step through the desensitization responsibility chain formed by the log desensitization component; generates log data and outputs it according to the desensitization result.

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

[0108] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0109] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0110] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned log desensitization method based on the chain of responsibility, which can solve the technical problem that it is difficult to accurately identify all sensitive data in the log when a single desensitization plug-in is used to desensitize all desensitized data, resulting in insufficient reliability of the log desensitization results. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the log desensitization method based on the chain of responsibility provided by the above-mentioned embodiment, which will not be repeated here.

[0111] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A log desensitization method based on responsibility chain, characterized in that: The method comprises the following steps: Encapsulate the data to be desensitized obtained by the logger and generate a log event object; The log event object is transmitted to the log desensitization component through the log desensitization interface, and the log event object is desensitized step by step through the desensitization responsibility chain formed by the log desensitization component; Based on the desensitization results, log data is generated and output.

2. The method according to claim 1, characterized in that The steps of transmitting the log event object to the log desensitization component through the log desensitization interface, and desensitizing the log event object step by step through the desensitization responsibility chain formed by the log desensitization component include: Determine at least one of the log desensitizing components corresponding to the log desensitizing interface, and the desensitizing responsibility chain formed by the log desensitizing components; Input the log event object into the log desensitization component corresponding to the first-level node of the desensitization responsibility chain; Based on the desensitization order of the log desensitization components in the desensitization responsibility chain and the log desensitization components corresponding to the first-level nodes, the data to be desensitized is desensitized level by level.

3. The method according to claim 2, characterized in that The step of desensitizing the log data to be desensitized level by level based on the desensitization order of the log desensitization components in the desensitization responsibility chain and the log desensitization components corresponding to the first-level nodes includes: According to the desensitization order, determine the corresponding log desensitization component; Inputting the information to be processed into the log desensitizing component, and desensitizing the data to be processed by the log desensitizing component; The processing result of the log desensitization component is obtained, and the processing result is transmitted as the data to be processed to the log desensitization component of the next level node in the desensitization responsibility chain.

4. The method according to claim 3, characterized in that The step of inputting the information to be processed into the log desensitization component and desensitizing the data to be processed by the log desensitization component includes: Determine the desensitization range in the data to be processed by using the regular expression in the log desensitization component, and match the data to be processed based on the desensitization range; Determining sensitive data in the data to be processed according to the matching result; The sensitive data is replaced by a placeholder, and the processing result is generated and output.

5. The method according to claim 1, characterized in that The step of generating and outputting log data according to the desensitization result includes: The desensitization result is input into a format parser, and the format parser performs data formatting on the desensitization result based on a data formatting rule preset in a layout configuration file to generate the log data; The log data is output.

6. The method according to claim 1, characterized in that Before the step of transmitting the log event object to the log desensitization component through the log desensitization interface and desensitizing the log event object step by step through the desensitization responsibility chain formed by the log desensitization component, the method further includes: After receiving the target desensitizing component, obtain the metadata of the target desensitizing component and the configuration data of the current responsibility chain; Determine, according to the metadata and the current responsibility chain, the insertion position of the target desensitizing component in the current responsibility chain; A reference relationship of the target desensitizing component is added to the adjacent desensitizing component at the insertion position to form the desensitizing responsibility chain.

7. The method according to claim 1, characterized in that The step of encapsulating the data to be desensitized obtained by the log recorder and generating a log event object comprises: Obtain the data to be desensitized recorded by the target program through a log recorder; Obtain relevant information of the data to be desensitized, encapsulate the data to be desensitized according to the relevant information, and generate the log event object.

8. The method according to claim 7, characterized in that The steps of obtaining relevant information of the data to be desensitized, encapsulating the data to be desensitized according to the relevant information, and generating the log event object include: Create an event object; Obtain relevant information of the data to be desensitized, and assign a value to the event object according to the relevant information; According to the log generation time, metadata is added to the event pair object to generate a log event object.

9. A log desensitization device based on chain of responsibility, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the log desensitization method based on the chain of responsibility as described in any one of claims 1 to 8.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the log desensitization method based on the responsibility chain as described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Log desensitization method and device, computer equipment and computer readable storage medium

    CN111310224A

  • Log desensitization method and device, electronic equipment and storage medium

    CN115081016A