Application log backup method based on code slicing and pipeline compression
By pre-defined backup code templates on the client and server side, and dynamically generating backup codes based on backup detection results, the maintenance difficulties and inefficiency of traditional log backup methods in multi-application systems and server environments are solved, and efficient and unified log backup is achieved.
Patent Information
- Application Number
- CN202411604987.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-03-07
AI Technical Summary
Traditional log backup methods have problems such as maintenance difficulties, inefficiency, inconsistent log backup templates, and tight local compression resources in multi-application systems and server environments.
Using the application log backup method based on code slicing and pipeline compression, the client and server predefined and stored common and specific backup code templates, dynamically adjusting the backup code through backup detection and code generation mechanisms to achieve automation and unification of log backup tasks.
It realizes centralized configuration management, dynamic adjustment of backup parameters, unified backup code and easy expansion, improves backup efficiency and reduces resource consumption.
Smart Images

Figure CN119576643A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of application log backup, and in particular to an application log backup method based on code slicing and pipeline compression. Background Art
[0002] The development of the Internet has brought about tremendous changes in the entire financial system, especially the banking industry. The diversification and convenience of information systems have enabled customers to conduct business in a real-time and simple manner. At present, most businesses are conducted through the Internet. With the development of business, there are more and more backend application systems, and the amount of transaction logs generated is increasing. Fast and efficient backup of transaction logs generated by application systems has become an important part of business system operation and maintenance.
[0003] The traditional log backup method has the following pain points when the number of application systems and servers is large:
[0004] Difficult maintenance: Due to the differences in log paths, log file names, and backup storage locations of business system log backups, these necessary parameters need to be configured separately for each business system;
[0005] Inefficiency: If you need to modify the backup parameters of the business log, such as the log path, name, and storage location, you need to readjust the backup script and push it to the target server one by one.
[0006] Inconsistent log backup templates: Each business system needs to set log backup parameters in a separate log backup script, resulting in inconsistency in log backup template scripts;
[0007] Local log compression resources are tight: Local compression of log files leads to serious consumption of local machine computing resources, affecting normal business requests. Summary of the invention
[0008] The purpose of the present invention is to provide an application log backup method based on code slicing and pipeline compression in view of the deficiencies in the prior art.
[0009] To achieve the above object, the present invention provides an application log backup method based on code slicing and pipeline compression, comprising:
[0010] Predefine and store a general code template on the client, and predefine and store a backup code template corresponding to the application service type on the server;
[0011] When the client executes a log backup task, it sends a backup request message to the server;
[0012] After receiving the backup request information sent by the client, the server performs a backup check on the client according to the backup request information to determine whether the client is backing up for the first time;
[0013] If the client is backing up for the first time, detecting the application service type of the client according to the backup request information, and generating a new backup code according to the backup code template corresponding to the application service type of the client and the backup request information;
[0014] If the client is not backing up for the first time, determining whether the client has a new function according to the backup request information, and if the client has a new function, regenerating a backup code;
[0015] The newly generated or regenerated backup code is saved on the server side, and then the newly generated or regenerated backup code is returned to the client side; if the client side has no new functions, the original backup code is directly returned to the client side;
[0016] The client generates a complete log backup code according to the stored general code template and the backup code sent by the server, and then performs a backup action according to the complete log backup code.
[0017] Furthermore, the backup detection method is as follows:
[0018] The server IP address, host name and system abbreviation information are extracted from the backup request information, and it is determined whether the server IP address, host name and system abbreviation information exist on the server side. If so, it is determined that it is not the first backup, otherwise, it is determined to be the first backup.
[0019] Furthermore, the method of detecting the application service type of the client is as follows:
[0020] A host name and a service directory are extracted from the backup request information, and an application service type is detected according to the host name and the service directory.
[0021] Furthermore, the application service types include JBOSS, TOMCAT and Nginx.
[0022] Furthermore, the method for determining whether the client has a new function is as follows:
[0023] The server generates a backup code based on the backup request information sent by the client and the backup code template corresponding to the application service type of the client, and compares the information table of the currently generated backup code with the information table of the backup code currently saved by the server. If there is a difference between the information table of the currently generated backup code and the information table of the backup code currently saved by the server, it is judged that the client has a new function, otherwise it is judged that there is no new function.
[0024] Furthermore, the method of performing the backup action according to this complete log backup code is as follows:
[0025] Check whether there are new log backup files locally according to the log file modification time. If there are no new log backup files, the backup task ends. If there are new log backup files, the new log backup files are transmitted through the network pipeline to transmit the new log backup files to the remote log storage server and complete compression at the end of the transmission pipeline.
[0026] Furthermore, the log backup task is triggered and executed by the client on a regular basis.
[0027] Beneficial effects: 1. Centralized management: It can realize centralized management of configuration, facilitate unified maintenance and update, and reduce management costs and errors caused by decentralized configuration;
[0028] 2. Dynamic configuration: The configuration information stored in the system can be adjusted dynamically without modifying the code. The log backup parameters can be changed in real time by updating the configuration information, which improves the flexibility and response speed of the system.
[0029] 3. Backup code unification: According to different application types, obtain the configuration information of the server, automatically assemble and integrate the backup code, reduce duplicate code, and improve code reusability and maintainability;
[0030] 4. Easy to expand: When you need to add a new backup function, you only need to add a new backup function in the configuration center to automatically obtain the new log backup function;
[0031] 5. Improve backup efficiency: There is no need to compress log files on the server. Compress them while transmitting, reducing the time and efficiency issues in the overall log backup process. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a schematic diagram of a processing flow of a server in an embodiment of the present invention;
[0033] Figure 2 It is a schematic diagram of the processing flow of the client according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments. The embodiments are implemented based on the technical solution of the present invention. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0035] like Figure 1 and Figure 2As shown, an embodiment of the present invention provides an application log backup method based on code slicing and pipeline compression, including:
[0036] The client predefines and stores a general code template, and the server predefines and stores a backup code template corresponding to the application service type. Specifically, the general code template contains general methods, functions and other codes, which will not be affected by the differences in the client's application service types. The backup code template stored on the server contains customized and differentiated methods, functions and other codes, and the backup code templates corresponding to different client service types are different.
[0037] When the client executes the log backup task, it sends a backup request message to the server. The log backup task can be triggered by the client at a scheduled time. The backup request message generally includes the server IP address, host name, system abbreviation information, service directory and information used to replace variables in the backup code template.
[0038] After receiving the backup request information sent by the client, the server performs a backup check on the client according to the backup request information to determine whether the client is backing up for the first time. Specifically, the backup check method is as follows:
[0039] The server IP address, host name and system abbreviation information are extracted from the backup request information, and it is determined whether the server IP address, host name and system abbreviation information exist on the server side. If so, it is determined that it is not the first backup, otherwise, it is determined that it is the first backup.
[0040] If the client is backing up for the first time, the client's application service type is detected according to the backup request information, and a new backup code is generated according to the backup code template corresponding to the client's application service type and the backup request information, that is, the variable content in the backup code template is replaced according to the backup request information. Specifically, the method of detecting the client's application service type is as follows:
[0041] The host name and service directory are extracted from the backup request information, and the application service type is detected according to the host name and service directory. The application service type is specifically JBOSS, TOMCAT and Nginx.
[0042] If the client is not backing up for the first time, it is determined whether the client has a new function according to the backup request information. If the client has a new function, a backup code is regenerated. Specifically, the method for determining whether the client has a new function is as follows:
[0043] The server generates a backup code according to the backup request information sent by the client and the backup code template corresponding to the application service type of the client, and compares the information table of the currently generated backup code with the information table of the backup code currently saved by the server. If there is a difference between the information table of the currently generated backup code and the information table of the backup code currently saved by the server, it is judged that the client has a new function, otherwise it is judged that there is no new function. It should be noted that the content in the above backup code template should meet the requirements of the client's new function so that the corresponding backup code can be generated when the client adds a new function.
[0044] The newly generated or regenerated backup code is saved on the server side, and then the newly generated or regenerated backup code is returned to the client side; if the client side has no new functions, there is no need to update the backup code, and the original backup code is directly returned to the client side.
[0045] After receiving the backup code sent by the server, the client generates a complete log backup code based on the general code template stored in it and the backup code sent by the server, and then executes the backup action according to the complete log backup code. Specifically, a placeholder is defined in advance in the general backup template. After receiving the backup code returned by the server, the backup code is replaced with the placeholder to obtain the complete log backup code. The above-mentioned complete log backup code is the code required for the client to implement application log backup. Its function is the same as that of the prior art, and is used for the client to implement functions including log file search, triggering data sending, etc. The specific method of executing the backup action according to the complete log backup code is as follows:
[0046] Check whether there are new log backup files locally based on the modification time of the log files. If there are no new log backup files, the backup task ends. If there are new log backup files, the new log backup files are transmitted through the network pipeline to transmit the new log backup files to the remote log storage server and complete compression at the end of the transmission pipeline. Since the logs are compressed before being saved to the disk on the remote log storage server, the system resources of the business server can be saved and the business stability can be guaranteed.
[0047] The above is only a preferred embodiment of the present invention. It should be noted that for ordinary technicians in this technical field, other parts not specifically described belong to the prior art or common knowledge. Several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention.
Claims
1. An application log backup method based on code slicing and pipeline compression, characterized in that: include: Predefine and store a general code template on the client, and predefine and store a backup code template corresponding to the application service type on the server; When the client executes a log backup task, it sends a backup request message to the server; After receiving the backup request information sent by the client, the server performs a backup check on the client according to the backup request information to determine whether the client is backing up for the first time; If the client is backing up for the first time, detecting the application service type of the client according to the backup request information, and generating a new backup code according to the backup code template corresponding to the application service type of the client and the backup request information; If the client is not backing up for the first time, determining whether the client has a new function according to the backup request information, and if the client has a new function, regenerating a backup code; The newly generated or regenerated backup code is saved on the server side, and then the newly generated or regenerated backup code is returned to the client side; If the client has no new functions, the original backup code is directly returned to the client; The client generates a complete log backup code according to the stored general code template and the backup code sent by the server, and then performs a backup action according to the complete log backup code.
2. The method for backing up application logs based on code slicing and pipeline compression according to claim 1, characterized in that: The backup detection method is as follows: The server IP address, host name and system abbreviation information are extracted from the backup request information, and it is determined whether the server IP address, host name and system abbreviation information exist on the server side. If so, it is determined that it is not the first backup, otherwise, it is determined to be the first backup.
3. The application log backup method based on code slicing and pipeline compression according to claim 1 is characterized in that: The method of detecting the application service type of the client is specifically as follows: A host name and a service directory are extracted from the backup request information, and an application service type is detected according to the host name and the service directory.
4. The method for backing up application logs based on code slicing and pipeline compression according to claim 1 or 3, characterized in that: The application service types include JBOSS, TOMCAT and Nginx.
5. The method for backing up application logs based on code slicing and pipeline compression according to claim 1, characterized in that: The method for determining whether the client has new features is as follows: The server generates a backup code based on the backup request information sent by the client and the backup code template corresponding to the application service type of the client, and compares the information table of the currently generated backup code with the information table of the backup code currently saved by the server. If there is a difference between the information table of the currently generated backup code and the information table of the backup code currently saved by the server, it is judged that the client has a new function, otherwise it is judged that there is no new function.
6. The method for backing up application logs based on code slicing and pipeline compression according to claim 1, characterized in that: The specific method of performing the backup action according to this complete log backup code is as follows: Check whether there are new log backup files locally according to the log file modification time. If there are no new log backup files, the backup task ends. If there are new log backup files, the new log backup files are transmitted through the network pipeline to transmit the new log backup files to the remote log storage server and complete compression at the end of the transmission pipeline.
7. The method for backing up application logs based on code slicing and pipeline compression according to claim 1, characterized in that: The log backup task is triggered and executed by the client at a scheduled time.