Log storage method and device
By storing log data in the cloud and local way, the inefficient query efficiency and disk overflow caused by excessive log files are solved, and efficient log query and bug location are achieved.
Patent Information
- Application Number
- CN202311551017.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-05-20
AI Technical Summary
In the prior art, excessive log files lead to low query efficiency, low bug positioning speed and repair efficiency, and large amounts of disk storage resources are occupied, resulting in disk overflow problems.
By obtaining the log data generated during the system runtime, sending it to the console console for cloud storage, and according to the preset log file storage size, the log data is stored in real time in the form of a log file to the local service, using the active duration of the bug as the retention time of the log file.
It improves log query efficiency, improves bug positioning speed and repair efficiency, avoids a large amount of disk storage resources, and prevents disk overflow.
Smart Images

Figure CN120020693A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and particularly to a method and device for storing logs. Background Art
[0002] This section aims to provide background or context for the embodiments of the present invention. The description herein is not admitted to be prior art merely by virtue of being included in this section.
[0003] Logs are important tools for online operation and maintenance and analysis of a system. By viewing logs, the track of user requests can be analyzed to help operation and maintenance personnel quickly locate the cause of BUGs. A large number of logs are generated by the system every day. Therefore, how to save a large amount of log data and query logs so that operation and maintenance personnel can quickly complete BUG location has become an urgent problem to be solved currently.
[0004] In the prior art, the logs generated during system operation are usually saved in the form of files through the log4j logging component (a logging component tool in the Java language), and all the log data of the system is included in the log file; through system commands or file retrieval tools, all the log data of user requests can be searched. The comprehensiveness of the data can help operation and maintenance personnel more easily locate BUGs and analyze the reasons. However, due to the large size of the log file, it is not convenient for operation and maintenance personnel to read, and the log query efficiency is low, resulting in low BUG location speed and repair efficiency. With the daily increase of log files, a large amount of disk storage resources are occupied, causing the problem of disk overflow. Summary of the Invention
[0005] Embodiments of the present invention provide a method for storing logs to improve log query efficiency, improve BUG location speed and repair efficiency, and at the same time, avoid occupying a large amount of disk storage resources and causing the problem of disk overflow. The method includes:
[0006] Obtain log data generated during system operation;
[0007] Send the log data to the console of the system so that the cloud log service can obtain the log data from the console and perform cloud storage on the log data;
[0008] According to a preset storage size of the log file, store the log data in the form of a log file in the local service in real time, and use the active duration of the BUG as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined according to the operation and maintenance requirements of the system business and the historical BUG data of the system.
[0009] An embodiment of the present invention provides a log storage device, which is used to improve the log query efficiency, improve the BUG location speed and repair efficiency. At the same time, it avoids occupying a large amount of disk storage resources and causing disk overflow problems. The device includes:
[0010] An acquisition module, configured to acquire log data generated during system operation;
[0011] A cloud storage module, configured to send the log data to the console of the system, so that the cloud log service can obtain the log data from the console and perform cloud storage on the log data;
[0012] A local storage module, configured to store the log data in the form of log files in real time to the local service according to a preset log file storage size, and use the active duration of the BUG as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined according to the operation and maintenance requirements of the system business and the historical BUG data of the system.
[0013] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the above-mentioned log storage method is implemented.
[0014] An embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned log storage method is implemented.
[0015] An embodiment of the present invention also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above-mentioned log storage method is implemented.
[0016] In an embodiment of the present invention, log data generated during system operation is obtained; the log data is sent to the console of the system, so that the cloud log service can obtain the log data from the console and perform cloud storage on the log data; according to a preset storage size of the log file, the log data is stored in the local service in real time in the form of a log file, and the active duration of the BUG is used as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined according to the operation and maintenance requirements of the system business and the historical BUG data of the system. Compared with the existing log storage scheme, the log file of the local service is controlled within the preset storage size of the log file, avoiding the generation of ultra-large log files; the active duration of the BUG is used as the retention duration of the log file in the local service, avoiding a large amount of disk storage resources being occupied and causing disk overflow problems; at the same time, through the console, all log data is stored in the cloud log service. In this way, by combining the cloud log service and the local service of the system to store logs, the log query efficiency can be improved, and thus the BUG location speed and repair efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. In the drawings:
[0018] Figure 1 It is a schematic flowchart of the log storage method provided in the embodiment of the present invention;
[0019] Figure 2 It is a schematic flowchart of the log query method provided in the embodiment of the present invention;
[0020] Figure 3 It is a schematic flowchart of the log storage method of the enterprise system provided in the embodiment of the present invention;
[0021] Figure 4 It is a schematic flowchart of the log viewing method of the enterprise system provided in the embodiment of the present invention;
[0022] Figure 5 It is a schematic diagram of the log storage device provided in the embodiment of the present invention;
[0023] Figure 6 It is a schematic diagram of the computer device provided in the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer and more understandable, the following further describes the embodiments of the present invention in detail with reference to the accompanying drawings. Herein, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but do not limit the present invention.
[0025] In the description of this specification, the terms "comprising", "including", "having", "containing", etc. are all open-ended terms, meaning including but not limited to. The description with reference to terms such as "one embodiment", "one specific embodiment", "some embodiments", "for example", etc. means that the specific features, structures, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this application. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. The order of steps involved in each embodiment is used to schematically illustrate the implementation of this application, and the order of steps is not limited and can be adjusted appropriately as needed.
[0026] It has been found through research that in the prior art, the log4j logging component (a logging component tool in the Java language) is usually used to save the logs generated during system operation in the form of files, and all the log data of the system is included in the log files; through system commands or file retrieval tools, all the log data requested by users can be searched. The comprehensiveness of the data can help operation and maintenance personnel more easily locate BUGs and analyze the reasons. However, due to the large size of the log files, it is not convenient for operation and maintenance personnel to read, and the log query efficiency is low, resulting in a low speed of BUG location and repair efficiency. With the daily increase of log files, a large amount of disk storage resources are occupied, causing the problem of disk overflow.
[0027] In addition, some enterprises use a log management system to collect and manage log data. A mature log management system has capabilities such as elastic addition of storage resources, regular cleaning of expired log data, flexible full-text retrieval, and log auditing, which can well meet the usage requirements of system operation and maintenance and management personnel. However, since the log management system will regularly clean expired log data, the retrieved log data is all partial and not comprehensive enough, increasing the difficulty for operation and maintenance personnel to quickly locate BUGs.
[0028] In summary, in the prior art, using the log4j logging component has problems such as large log files, inconvenient for operation and maintenance personnel to read, low log query efficiency, resulting in low BUG location speed and repair efficiency, with a large amount of disk storage resources occupied with the daily increase of log files, causing the problem of disk overflow; using the log management system has the problem that the retrieved log data is all partial and not comprehensive enough, increasing the difficulty for operation and maintenance personnel to quickly locate BUGs.
[0029] Therefore, the embodiments of the present invention provide a log storage solution, which combines the use of cloud log services and local services to store logs, so as to improve the log query efficiency, increase the BUG location speed and repair efficiency. At the same time, it avoids occupying a large amount of disk storage resources and causing disk overflow problems.
[0030] In the technical solution of this application, the acquisition, storage, use, processing, etc. of data all comply with the relevant regulations of laws and regulations.
[0031] As Figure 1 shown, it is a flowchart of a log storage method provided by an embodiment of the present invention. The method may include the following steps:
[0032] Step 101, obtain log data generated during system operation;
[0033] Step 102, send the log data to the console of the system, so that the cloud log service can obtain the log data from the console and perform cloud storage on the log data;
[0034] Step 103, according to the preset log file storage size, store the log data in the local service in the form of log files in real time, and use the active duration of the BUG as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined according to the operation and maintenance requirements of the system business and the historical BUG data of the system.
[0035] In the embodiments of the present invention, obtain log data generated during system operation; send the log data to the console of the system, so that the cloud log service can obtain the log data from the console and perform cloud storage on the log data; according to the preset log file storage size, store the log data in the local service in the form of log files in real time, and use the active duration of the BUG as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined according to the operation and maintenance requirements of the system business and the historical BUG data of the system. Compared with the existing log storage solutions, controlling the log files in the local service within the preset log file storage size avoids the generation of super-large log files; using the active duration of the BUG as the retention duration of the log file in the local service avoids occupying a large amount of disk storage resources and causing disk overflow problems; at the same time, through the console, all log data is stored in the cloud log service. In this way, by combining the cloud log service and the local service of the system to store logs, the log query efficiency can be improved, and thus the BUG location speed and repair efficiency can be increased.
[0036] Next, a detailed description will be given of Figure 1 the log storage method shown.
[0037] In the above step 101, when the user initiates a request to the function, the log data generated during the system operation is obtained.
[0038] In the above step 102, the log data can be sent to the system console, and the cloud log service will automatically obtain the log data from the console and store the log data in the cloud.
[0039] It should be noted that the cloud log service can periodically obtain log data from the console and store all log data in the cloud.
[0040] In the above step 103, the log data can be stored in the local service in real time in the form of log files according to the preset log file storage size, and the active duration of the BUG is used as the retention duration of the log file in the local service.
[0041] During specific implementation, log files can be generated based on log data, and log data can be stored in real time in the form of files. Specifically, the size of a single log file is controlled within the preset log file storage size, and the retention period of the log file in the local service can be set to the active period of the BUG.
[0042] It should be noted that the active duration of a bug can refer to the maximum waiting time for the system business to pay attention to the bug, that is, the longest time the system business can tolerate the existence of the bug. The active duration of the bug can be determined based on the operation and maintenance requirements of the system business and the historical bug data of the system.
[0043] In one embodiment, before the above step 103, the active duration of the BUG can be determined as follows:
[0044] Determine the BUG processing time according to the system business operation and maintenance requirements;
[0045] Analyze the historical bug data of the system to determine the latest bug discovery time, the most likely bug discovery time, and the earliest bug discovery time;
[0046] Determine the active duration of the bug based on the bug handling time, the latest bug discovery time, the most likely bug discovery time, and the earliest bug discovery time.
[0047] In specific implementation, the processing duration of a BUG can refer to the time required to resolve the BUG, which can be specified by the operation and maintenance requirements of the system; the latest discovery duration of the BUG, the most likely discovery duration of the BUG, and the earliest discovery duration of the BUG can be obtained by analyzing the historical BUG data of the system. For example, the latest discovery duration of the BUG and the earliest discovery duration of the BUG can be found from the historical data, and the time when the BUG is discovered in the historical data can be analyzed (such as calculating the average value, etc.) to obtain the most likely discovery duration of the BUG. Among them, the units of the latest closing time of the BUG, the latest discovery duration of the BUG, the most likely discovery duration of the BUG, and the earliest discovery duration of the BUG can be days, and if it is less than 1 day, it is calculated as 1 day.
[0048] In one embodiment, according to the processing duration of the BUG, the latest discovery duration of the BUG, the most likely discovery duration of the BUG, and the earliest discovery duration of the BUG, the active duration of the BUG is determined, which may specifically include:
[0049] The active duration of the BUG is determined by the following formula:
[0050] N = E + ceil((Dx + 4 × Dp + Dn) / 6)
[0051] where N is the active duration of the BUG; E is the processing duration of the BUG; Dx is the latest discovery duration of the BUG; Dp is the most likely discovery duration of the BUG; Dn is the earliest discovery duration of the BUG; ceil is the ceiling function.
[0052] In this way, by flexibly setting the retention duration of the local location file according to the active period of the BUG, it can meet the need to help locate and analyze the BUG through the log files stored in the local service when resolving most of the business BUGs, reduce the difficulty of BUG analysis, and speed up the progress of BUG resolution.
[0053] In one embodiment, it may further include:
[0054] Set the log maintenance time of the local service;
[0055] When the log maintenance time is reached, multiple log files stored in the local service are deleted according to the retention duration of the log files in the local service.
[0056] In specific implementation, the log maintenance time of the local service can be set. For example, maintenance is performed at 0:00 every day, and the log files that exceed the retention duration are deleted.
[0057] In this way, it can avoid occupying a large amount of disk storage resources and causing the problem of disk overflow.
[0058] In an embodiment of the present invention, after storing the log data in the cloud log service and the local service through the above steps 101-103, when it is necessary to query the logs, as Figure 2 shown, it may specifically include:
[0059] Step 201, receiving a log viewing request, where the log viewing request includes time range information for viewing the logs;
[0060] Step 202, when the time range information for viewing the logs is greater than the active duration of the BUG, obtaining a log file from the cloud log service according to the time range information for viewing the logs;
[0061] Step 203, when the time range information for viewing the logs is less than or equal to the active duration of the BUG, obtaining a log file from the local service according to the time range information for viewing the logs.
[0062] In specific implementation, the time range information for viewing the logs can be determined according to the occurrence time of the BUG reported by the service, and a log viewing request is sent to the system. If the time range information for viewing the logs is greater than the active duration of the BUG, it means that the relevant log files in the local service have been deleted. At this time, it is necessary to obtain the relevant log files from the cloud log service; if the time range information for viewing the logs is not greater than the active duration of the BUG, it means that the relevant log files in the local service still exist, and the relevant log files can be directly obtained from the local service.
[0063] In this way, the BUGs in the active period can be located and analyzed through the local service, and the BUGs in the non-active period can be located and analyzed through the cloud log service. By combining the cloud log service and the local service of the system, the BUG location speed and repair efficiency are improved.
[0064] To more clearly understand the above log storage method, a specific example is described below.
[0065] Figure 3 It is a schematic flowchart of the log storage method for the enterprise system provided by the embodiment of the present invention. As Figure 3 shown, for the gateway and business systems in the enterprise cluster, two strategies can be uniformly configured for the logs:
[0066] ① Print the logs to the console, and the cloud log service can automatically collect the log data from the console and centrally save it in the cloud log service.
[0067] ② Generate log files locally and store log data in real time in the form of files. The size of a single log file is limited to 100M, and log files are retained for a maximum of N days. Among them, N days is the active duration of the BUG, which is determined based on the operation and maintenance requirements of the system business and the historical BUG data of the system.
[0068] The number of days for log file retention and the size limit of a single file are managed uniformly using the configuration management of the cloud log service to meet the needs of flexible modification.
[0069] When an enterprise user initiates a request to the system, the cluster gateway will output the generated log data to the console. The cloud log service collects the log data printed by the cluster gateway console and saves the log data. The cluster gateway generates a log file based on the log data and determines whether the size of the log file exceeds 100M. If so, a new log file is created and the remaining log data is saved in the latest log file. It is necessary to ensure that the size of each log file does not exceed 100M.
[0070] Then, the cluster gateway calls the business system to perform business processing, and the business system also generates log data. Similarly, the business system outputs the generated log data to the console. The cloud log service collects the log data printed by the business system's console and saves the log data. The business system generates a log file based on the log data locally, and determines whether the size of the log file exceeds 100M. If it exceeds, a new log file is created and the remaining log data is saved in the latest log file. It is necessary to ensure that the size of each log file does not exceed 100M. At the end of the business processing, the business system returns the processing results to the cluster gateway, which sends the response information to the user.
[0071] The cluster gateway and business system can check whether the log file is expired at 0:00 every day and delete the log files older than N days.
[0072] Figure 4 is a flow chart of the log viewing method of the enterprise system provided by the embodiment of the present invention. Figure 4 As shown in the figure, the operation and maintenance personnel can determine the time range for viewing logs based on the occurrence time of the BUG reported by the business, that is, to view the logs of the previous M days.
[0073] ① If the log is generated within N days (the active duration of the BUG), that is, M is not greater than N, then the local service has a log file. The operation and maintenance personnel can use commands to view the log data of the previous M days in the local service to analyze and fix the BUG.
[0074] ②If the log was generated more than N days ago, that is, M is greater than N, you can only log in to the cloud log service to query the log data of the previous M days to perform bug analysis and repair.
[0075] The number of days N for retaining the above logs is flexibly adjusted according to the system business operation and maintenance requirements. The calculation formula is as follows:
[0076] N = E + ceil((Dx + 4×Dp + Dn) / 6)
[0077] For example: The operation and maintenance requirement of the enterprise for the system is that the maximum closing time of BUG is 48 hours (2 days). For the system business BUG, from its generation to its discovery by the business, the latest discovery duration Dx is 7 days, the earliest discovery duration Dn is 1 day, and the most likely discovery duration Dp is 3 days. Then the number of days N for retaining the log file is 6 days:
[0078] N = 2 + ceil((7 + 4×3 + 1) / 6) = 6.
[0079] Based on the above log storage method, flexibly setting the number of days for saving the log file of the local service according to the active duration of the BUG can meet the requirement of quickly obtaining the log file of the local service to help locate the BUG and analyze the cause when solving most of the business BUGs, reduce the difficulty of BUG analysis, and speed up the progress of BUG resolution; the log file of the local service supports being cut according to the size upper limit, successfully controlling the size of a single log file within the range acceptable to the memory load (100M), preventing the generation of ultra-large log files, and enabling users to conveniently traverse and search the logs; in addition, the local service only retains the log files for N days, avoiding the risk of occupying a large amount of disk storage resources and causing disk overflow.
[0080] In the embodiments of the present invention, a log storage device is further provided, as described in the following embodiments. Since the principle of the device for solving problems is similar to that of the log storage method, the implementation of the device can refer to the implementation of the log storage method, and the repeated parts will not be described again.
[0081] Figure 5 The following is a schematic diagram of a log storage device provided in the embodiments of the present invention. The device may include:
[0082] An acquisition module 501, configured to acquire log data generated during system operation;
[0083] A cloud storage module 502, configured to send the log data to the console of the system, so that the cloud log service can acquire the log data from the console and perform cloud storage on the log data;
[0084] The local storage module 503 is used to store the log data in real time in the form of log files to the local service according to the preset log file storage size, and use the active duration of the BUG as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined according to the operation and maintenance requirements of the system service and the historical BUG data of the system.
[0085] In one embodiment, it may further include a BUG active duration setting module, which is used before the local storage module stores the log data in the form of log files to the local service according to the active duration of the BUG and the preset log file storage size:
[0086] Determine the active duration of the BUG in the following manner:
[0087] Determine the processing duration of the BUG according to the operation and maintenance requirements of the system service;
[0088] Analyze the historical BUG data of the system to determine the latest discovery duration of the BUG, the most likely discovery duration of the BUG, and the earliest discovery duration of the BUG;
[0089] Determine the active duration of the BUG according to the processing duration of the BUG, the latest discovery duration of the BUG, the most likely discovery duration of the BUG, and the earliest discovery duration of the BUG.
[0090] In one embodiment, the BUG active duration setting module may also be used for:
[0091] Determine the active duration of the BUG through the following formula:
[0092] N = E + ceil((Dx + 4 × Dp + Dn) / 6)
[0093] Wherein, N is the active duration of the BUG; E is the processing duration of the BUG; Dx is the latest discovery duration of the BUG; Dp is the most likely discovery duration of the BUG; Dn is the earliest discovery duration of the BUG; ceil is the ceiling function.
[0094] In one embodiment, it may further include a maintenance module, which is used for:
[0095] Set the log maintenance time of the local service;
[0096] When the log maintenance time is reached, delete multiple log files stored in the local service according to the retention duration of the log file in the local service.
[0097] In one embodiment, it may further include a viewing module, which is used for:
[0098] Receive a log viewing request, where the log viewing request includes time range information for viewing the log;
[0099] When the time range information for viewing the log is greater than the active duration of the BUG, obtain the log file from the cloud log service according to the time range information for viewing the log;
[0100] When the time range information for viewing the log is less than or equal to the active duration of the BUG, obtain the log file from the local service according to the time range information for viewing the log.
[0101] An embodiment of the present invention further provides a computer device, Figure 6 which is a schematic diagram of the computer device in the embodiment of the present invention. The computer device 600 includes a memory 610, a processor 620, and a computer program 630 stored on the memory 610 and executable on the processor 620. When the processor 620 executes the computer program 630, the above-mentioned log storage method is implemented.
[0102] An embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned log storage method is implemented.
[0103] An embodiment of the present invention further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the above-mentioned log storage method is implemented.
[0104] In an embodiment of the present invention, log data generated during system operation is obtained; the log data is sent to the console of the system, so that the cloud log service obtains the log data from the console and performs cloud storage on the log data; according to a preset log file storage size, the log data is stored in real time in the local service in the form of a log file, and the active duration of the BUG is used as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined according to the operation and maintenance requirements of the system business and the historical BUG data of the system. Compared with the existing log storage scheme, the log file in the local service is controlled within the preset log file storage size, avoiding the generation of ultra-large log files; the active duration of the BUG is used as the retention duration of the log file in the local service, avoiding a large amount of disk storage resources being occupied and causing disk overflow problems; at the same time, through the console, all log data is stored in the cloud log service. In this way, by combining the cloud log service and the local service of the system to store logs, the log query efficiency can be improved, and thus the BUG location speed and repair efficiency can be improved.
[0105] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.
[0106] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0107] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0108] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0109] The specific embodiments described above further elaborate on the objectives, technical solutions, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A log storage method, characterized in that: include: Get the log data generated when the system is running; Send the log data to the system's console so that the cloud log service can obtain the log data from the console and store the log data in the cloud. According to the preset log file storage size, the log data is stored in the form of log files in real time to the local service, and the active duration of the BUG is used as the retention duration of the log file in the local service; wherein, the active duration of the BUG is determined based on the operation and maintenance requirements of the system business and the historical BUG data of the system.
2. The method according to claim 1, characterized in that Based on the active duration of the BUG and the preset log file storage size, before the log data is stored in the form of a log file to the local service, it also includes: Determine the active duration of a bug as follows: Determine the time required to handle the bug based on the system's operational and maintenance requirements; Analyze the system's historical bug data to determine the latest time a bug was discovered, the most likely time a bug was discovered, and the earliest time a bug was discovered; Determine the active duration of the bug based on the bug handling time, the latest bug discovery time, the most likely bug discovery time and the earliest bug discovery time.
3. The method according to claim 2, characterized in that Determine the active duration of the bug based on the bug handling time, the latest bug discovery time, the most likely bug discovery time, and the earliest bug discovery time, including: The active duration of the BUG is determined by the following formula: N=E+ceil((Dx+4×Dp+Dn) / 6) Where N is the active duration of the bug; E is the processing duration of the bug; Dx is the latest discovery duration of the bug; Dp is the most likely discovery duration of the bug; Dn is the earliest discovery duration of the bug; and ceil is the rounding up function.
4. The method according to claim 1, characterized in that Also includes: Set the log maintenance time for local services; When the log maintenance time is reached, multiple log files stored in the local service are deleted according to the retention time of the log files in the local service.
5. The method according to claim 1, characterized in that Also includes: receiving a log viewing request, wherein the log viewing request includes time range information for viewing the log; If the time range of the log is greater than the active duration of the bug, the log file is obtained from the cloud log service according to the time range of the log. When the time range information for viewing the log is less than or equal to the active duration of the BUG, the log file is obtained from the local service according to the time range information for viewing the log.
6. A log storage device, characterized in that: include: The acquisition module is used to obtain the log data generated when the system is running; The cloud storage module is used to send log data to the system's console so that the cloud log service can obtain log data from the console and store the log data in the cloud. The local storage module is used to store the log data in the form of log files in real time to the local service according to the preset log file storage size, and use the active duration of the BUG as the retention duration of the log file in the local service; wherein the active duration of the BUG is determined based on the operation and maintenance requirements of the system business and the historical BUG data of the system.
7. The device according to claim 6, characterized in that It also includes a BUG active duration setting module, which is used to store the log data in the form of log files before the local storage module stores the log data in the local service according to the active duration of the BUG and the preset log file storage size: Determine the active duration of a bug as follows: Determine the time required to handle the bug based on the system's operational and maintenance requirements; Analyze the system's historical bug data to determine the latest time a bug was discovered, the most likely time a bug was discovered, and the earliest time a bug was discovered; Determine the active duration of the bug based on the bug handling time, the latest bug discovery time, the most likely bug discovery time and the earliest bug discovery time.
8. The device according to claim 7, characterized in that The BUG active duration setting module is also used for: The active duration of the BUG is determined by the following formula: N=E+ceil((Dx+4×Dp+Dn) / 6) Where N is the active duration of the bug; E is the processing duration of the bug; Dx is the latest discovery duration of the bug; Dp is the most likely discovery duration of the bug; Dn is the earliest discovery duration of the bug; and ceil is the rounding up function.
9. The device according to claim 6, characterized in that Also includes maintenance modules for: Set the log maintenance time for local services; When the log maintenance time is reached, multiple log files stored in the local service are deleted according to the retention time of the log files in the local service.
10. The device according to claim 6, characterized in that Also includes viewing modules for: receiving a log viewing request, wherein the log viewing request includes time range information for viewing the log; If the time range of the log is greater than the active duration of the bug, the log file is obtained from the cloud log service according to the time range of the log. When the time range information for viewing the log is less than or equal to the active duration of the BUG, the log file is obtained from the local service according to the time range information for viewing the log.
11. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.