CN112035066A - Method and device for calculating log retention time - Google Patents

Method and device for calculating log retention time Download PDF

Info

Publication number
CN112035066A
CN112035066A CN202010909833.5A CN202010909833A CN112035066A CN 112035066 A CN112035066 A CN 112035066A CN 202010909833 A CN202010909833 A CN 202010909833A CN 112035066 A CN112035066 A CN 112035066A
Authority
CN
China
Prior art keywords
log
retention time
calculating
recording
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010909833.5A
Other languages
Chinese (zh)
Inventor
崔冠宁
魏国龙
于文鹏
郄俭
何鑫
邹欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202010909833.5A priority Critical patent/CN112035066A/en
Publication of CN112035066A publication Critical patent/CN112035066A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • G06F3/0649Lifecycle management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method and a device for calculating log retention time, wherein the method comprises the following steps: obtaining storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods; calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively; determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value; and determining the larger value of the preset shortest retention time and the reference retention time as the log retention time. The method and the device can save or clear the log according to the log retention time, further adjust the strategy of storing or clearing the log, ensure that disk alarm cannot be caused when the log is increased too fast, reasonably utilize the storage resource of the disk when the log is increased too slowly, and provide better user experience.

Description

Method and device for calculating log retention time
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for calculating log retention time.
Background
The log is an event record named log generated by a log source (such as a network device, a system, a service program and the like) during the operation, is a collection of data generated by the log source during the operation, and each row of the log is recorded with description information of related operations such as date, time, user, action and the like. The log records the life cycle of the log source, and the state of the log source at a certain moment can be obtained by looking up and analyzing the log. The user can check the cause of the error occurrence through the log or look for traces left by the attacker when the attack is made.
The log storage is to temporarily allocate a corresponding disk storage space according to a log sent by a log source, so as to achieve the purpose of storing the log to a disk. Currently, the log retention time is an operation made by experience, and the log retention time is set according to the size of a disk space or according to service requirements. The storage resource is wasted if the log retention time is short, the log retention time is long, the log record volume is increased suddenly, and the disk alarm is easy to generate.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method and a device for calculating the log retention time, which can ensure that disk alarm cannot be caused when the record volume of the log is suddenly increased, and can reasonably utilize storage resources.
In order to solve the technical problems, the invention provides the following technical scheme:
in a first aspect, the present invention provides a method for calculating a log retention time, including:
acquiring storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods;
calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively;
determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
and determining the larger value of the preset shortest retention time and the reference retention time as the log retention time.
Further, after determining that the larger value of the preset shortest retention time and the reference retention time is the log retention time, the method further includes:
and storing the log on a storage disk according to the log retention time.
Further, after determining that the larger value of the preset shortest retention time and the reference retention time is the log retention time, the method further includes:
determining a cleaning period of the log according to the log retention time;
and cleaning the log stored on the storage disk according to the cleaning period of the log.
The calculating of the log acceleration reference value according to the log incremental data corresponding to the recording cycle of the log and the s recording cycles respectively comprises the following steps:
and calculating at least one log acceleration increasing reference value according to the recording period and the s log incremental data by adopting at least one of an average speed method, a nearest speed method, a farthest speed method, a nearest acceleration method and an average acceleration method.
Wherein, the determining the larger value of the preset shortest retention duration and the reference retention duration as the log retention duration includes:
and determining the maximum value of the shortest retention time and the reference retention time of at least one log as the log retention time.
Wherein the alarm ratio of the log is 5% or 10%.
In a second aspect, the present invention provides an apparatus for calculating a log retention time, including:
the acquisition unit is used for acquiring storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods;
the speed increasing unit is used for calculating a log speed increasing reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively;
the calculation unit is used for determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
and the comparison unit is used for determining the larger value of the preset shortest retention time and the reference retention time as the log retention time.
Further, the method also comprises the following steps:
and the storage unit is used for storing the log on the storage disk according to the log retention time.
Further, the method also comprises the following steps:
the processing unit is used for determining the cleaning period of the log according to the log retention time;
and the cleaning unit is used for cleaning the log stored on the storage disk according to the cleaning period of the log.
Wherein the speed increasing unit includes:
and the speed increasing subunit is used for adopting at least one of an average speed method, a nearest speed method, a farthest speed method, a nearest acceleration method and an average acceleration method, and calculating at least one log speed increasing reference value according to the recording period and the s log incremental data.
Wherein the comparing unit includes:
and the comparison subunit is used for determining that the maximum value in the shortest retention time and the reference retention time of at least one log is the log retention time.
In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the log retention time calculation method when executing the program.
In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for calculating a log retention time period.
According to the technical scheme, the log retention time is calculated by acquiring the storage space data of the storage disk, the recording period of the log, the alarm ratio of the log and log incremental data corresponding to s recording periods; calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively; determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value; the larger value of the preset shortest retention time and the reference retention time is determined as the log retention time, log storage or cleaning can be carried out according to the log retention time, so that the strategy of storing or cleaning the log can be adjusted, disk warning cannot be caused when the log is increased too fast, the storage resource of the disk can be reasonably utilized when the log is increased too slowly, and better user experience is provided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a first flowchart of a method for calculating a log retention time according to an embodiment of the present invention.
Fig. 2 is a second flowchart of the method for calculating the log retention time according to the embodiment of the present invention.
Fig. 3 is a third flow chart of the method for calculating the log retention time according to the embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a log retention time period calculation apparatus according to an embodiment of the present invention.
Fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides an embodiment of a method for calculating log retention time, which specifically comprises the following steps of:
s101: acquiring storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods;
s102: calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively;
it will be appreciated that the logging period is a unit of time span of statistical log increment size, typically one statistical period being one day.
In specific implementation, at least one of an average velocity method, a nearest velocity method, a farthest velocity method, a nearest acceleration method and an average acceleration method is adopted, and at least one log acceleration reference value is calculated according to the recording period and the s log incremental data, specifically as follows:
average velocity method:
Figure BDA0002662853910000041
wherein S is the log recording period, S is the number of recording periods, l1For the log incremental data, l, corresponding to the 1 st recording cycle in s recording cyclessAnd v is log incremental data corresponding to the s-th recording period in the s recording periods, and is a log speed increasing reference value.
The recent speed method:
Figure BDA0002662853910000051
where v is the log acceleration reference value, lsAnd the log incremental data corresponding to the S-th recording period in the S recording periods are respectively recorded, and S is the recording period of the log.
The farthest velocity method:
Figure BDA0002662853910000052
where v is the log acceleration reference value, l1And the incremental log data corresponding to the 1 st recording period in the S recording periods are obtained, and S is the recording period of the log.
The nearest acceleration method:
v=vs+vs-vs-1
wherein v is a log acceleration reference value, vsThe speed increase of the s-th recording cycle in the s recording cycles, the ratio of the log incremental data of the s-th recording cycle to the s-th recording cycle, vs-1The speed increase of the s-1 th recording cycle in the s recording cycles is the ratio of the log incremental data of the s-1 th recording cycle to the s-1 th recording cycle.
Average acceleration method:
Figure BDA0002662853910000053
wherein v is a log acceleration reference value, vsThe speed increase of the s-th recording cycle in the s recording cycles, the ratio of the log incremental data of the s-th recording cycle to the s-th recording cycle, vs-1The speed increase of the s-1 th recording cycle in the s recording cycles is the ratio of the log incremental data of the s-1 th recording cycle to the s-1 th recording cycle.
S103: determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
in this step, calculating the reference retention time according to the log acceleration reference value in step S102 specifically includes:
Figure BDA0002662853910000054
wherein, W is the storage space data of the storage disk, W is the alarm ratio of the log, the alarm ratio is set adaptively according to the user requirement, and the alarm ratio of the log in the embodiment is 5% or 10%.
S104: and determining the larger value of the preset shortest retention time and the reference retention time as the log retention time.
It should be noted that, if the reference retention time of the log is calculated in multiple ways in step S103, the maximum value in the shortest retention time and the reference retention time of at least one log in this step is the log retention time, which is specifically as follows:
in step S102, a mode is adopted to calculate the log acceleration reference value, and then the log acceleration reference value is calculated according to a formula
Figure BDA0002662853910000061
The method can obtain a reference retention time, and determine the larger value of the preset shortest retention time and the reference retention time as the log retention time.
Step S102, calculating the log acceleration reference value by adopting k modes, and then calculating the log acceleration reference value according to a formula
Figure BDA0002662853910000062
K reference retention durations (T1 to tk) can be obtained, the minimum value of the k reference retention durations is compared with the preset shortest retention duration T, and the larger value of the two is taken as the retention duration.
As can be seen from the above description, in the method for calculating the log retention time provided by this embodiment, the storage space data of the storage disk, the recording period of the log, the alarm ratio of the log, and the log incremental data corresponding to s recording periods are obtained; calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively; determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value; the larger value of the preset shortest retention time and the reference retention time is determined as the log retention time, log storage or cleaning can be carried out according to the log retention time, so that the strategy of storing or cleaning the log can be adjusted, disk warning cannot be caused when the log is increased too fast, the storage resource of the disk can be reasonably utilized when the log is increased too slowly, and better user experience is provided.
In an embodiment of the present invention, referring to fig. 2, after step S104 of the method for calculating the log retention time includes the following steps:
s105: and storing the log on a storage disk according to the log retention time.
In this embodiment, in the logging process, the log retention time records the incremental log size. When the log is increased too fast, the reserved time is shortened; if the log grows too slowly, the retention time is lengthened.
In an embodiment of the present invention, referring to fig. 3, after step S105 of the method for calculating the log retention time includes the following steps:
s106: determining a cleaning period of the log according to the log retention time;
it should be noted that the cleaning cycle of the log is the unit of interval time span for cleaning the log. In this embodiment, the log retention time period is the same as the cleaning cycle of the log.
S107: and cleaning the log stored on the storage disk according to the cleaning period of the log.
In this embodiment, the transaction system records the size of the incremental log according to the statistical period during the logging process. When cleaning the log, calculating the log increase speed, calculating the log retention time according to the increase speed, and if the log increases too fast, shortening the retention time; if the log grows too slowly, the retention time is lengthened.
From the above description, the embodiment of the invention can save or clear the log according to the log retention time, further adjust the strategy for storing or clearing the log, ensure that the disk alarm is not caused when the log is increased too fast, and reasonably utilize the storage resource of the disk when the log is increased too slow, thereby providing better user experience.
An embodiment of the present invention provides a specific implementation manner of a computing device capable of implementing log retention time of all contents in the method for computing log retention time, and referring to fig. 4, the computing device for log retention time specifically includes the following contents:
the acquisition unit 10 is configured to acquire storage space data of a storage disk, a log recording period, a log alarm ratio, and log incremental data corresponding to s recording periods;
the speed increasing unit 20 is configured to calculate a log speed increasing reference value according to log incremental data corresponding to a log recording period and s recording periods;
the calculation unit 30 is used for determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
and the comparing unit 40 is configured to determine that the larger value of the preset shortest retention time and the reference retention time is the log retention time.
Further, the method also comprises the following steps:
and the storage unit is used for storing the log on the storage disk according to the log retention time.
Further, the method also comprises the following steps:
the processing unit is used for determining the cleaning period of the log according to the log retention time;
and the cleaning unit is used for cleaning the log stored on the storage disk according to the cleaning period of the log.
Wherein the speed increasing unit 20 includes:
and the speed increasing subunit is used for adopting at least one of an average speed method, a nearest speed method, a farthest speed method, a nearest acceleration method and an average acceleration method, and calculating at least one log speed increasing reference value according to the recording period and the s log incremental data.
Wherein the comparing unit 40 includes:
and the comparison subunit is used for determining that the maximum value in the shortest retention time and the reference retention time of at least one log is the log retention time.
The embodiment of the apparatus for calculating a log retention time according to the present invention may be specifically configured to execute the processing procedure of the embodiment of the method for calculating a log retention time in the foregoing embodiment, and the functions of the apparatus are not described herein again, and reference may be made to the detailed description of the embodiment of the method.
As can be seen from the above description, the device for calculating log retention time according to the embodiment of the present invention obtains the storage space data of the storage disk, the recording period of the log, the alarm ratio of the log, and the log incremental data corresponding to s recording periods; calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively; determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value; the larger value of the preset shortest retention time and the reference retention time is determined as the log retention time, log storage or cleaning can be carried out according to the log retention time, so that the strategy of storing or cleaning the log can be adjusted, disk warning cannot be caused when the log is increased too fast, the storage resource of the disk can be reasonably utilized when the log is increased too slowly, and better user experience is provided.
The application provides an embodiment of an electronic device for implementing all or part of contents in the log retention time length method, where the electronic device specifically includes the following contents:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between related devices; the electronic device may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the electronic device may be implemented with reference to the embodiment of the method for implementing the log retention time length and the embodiment of the apparatus for implementing the log retention time length in the embodiment, and the contents thereof are incorporated herein, and repeated details are not repeated.
Fig. 5 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 5, the electronic device 9600 can include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this FIG. 5 is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In one embodiment, the log duration function may be integrated into the central processor 9100. The central processor 9100 may be configured to control as follows:
acquiring storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods;
calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively;
determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
and determining the larger value of the preset shortest retention time and the reference retention time as the log retention time.
As can be seen from the above description, in the electronic device provided in the embodiment of the present application, the storage space data of the storage disk, the recording period of the log, the alarm ratio of the log, and the log incremental data corresponding to s recording periods are obtained; calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively; determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value; the larger value of the preset shortest retention time and the reference retention time is determined as the log retention time, log storage or cleaning can be carried out according to the log retention time, so that the strategy of storing or cleaning the log can be adjusted, disk warning cannot be caused when the log is increased too fast, the storage resource of the disk can be reasonably utilized when the log is increased too slowly, and better user experience is provided.
In another embodiment, the log retention time device may be configured separately from the central processor 9100, for example, the log retention time device may be configured as a chip connected to the central processor 9100, and the log retention time function is implemented by the control of the central processor.
As shown in fig. 5, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 also does not necessarily include all of the components shown in fig. 5; further, the electronic device 9600 may further include components not shown in fig. 5, which may be referred to in the art.
As shown in fig. 5, a central processor 9100, sometimes referred to as a controller or operational control, can include a microprocessor or other processor device and/or logic device, which central processor 9100 receives input and controls the operation of the various components of the electronic device 9600.
The memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to realize information storage or processing, or the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. Power supply 9170 is used to provide power to electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 9140 can be a solid state memory, e.g., Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 9140 could also be some other type of device. Memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 being used for storing application programs and function programs or for executing a flow of operations of the electronic device 9600 by the central processor 9100.
The memory 9140 can also include a data store 9143, the data store 9143 being used to store data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, contact book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby implementing ordinary telecommunications functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100, thereby enabling recording locally through the microphone 9132 and enabling locally stored sounds to be played through the speaker 9131.
An embodiment of the present invention further provides a computer-readable storage medium capable of implementing all the steps in the method for calculating a log retention time period in the foregoing embodiment, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, implements all the steps in the method for calculating a log retention time period in the foregoing embodiment, for example, when the processor executes the computer program, the processor implements the following steps:
acquiring storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods;
calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively;
determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
and determining the larger value of the preset shortest retention time and the reference retention time as the log retention time.
As can be seen from the above description, in the computer-readable storage medium provided in the embodiment of the present invention, the log incremental data corresponding to the storage space data of the storage disk, the recording period of the log, the alarm ratio of the log, and s recording periods are obtained; calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively; determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value; the larger value of the preset shortest retention time and the reference retention time is determined as the log retention time, log storage or cleaning can be carried out according to the log retention time, so that the strategy of storing or cleaning the log can be adjusted, disk warning cannot be caused when the log is increased too fast, the storage resource of the disk can be reasonably utilized when the log is increased too slowly, and better user experience is provided.
Although the present invention provides method steps as described in the examples or flowcharts, more or fewer steps may be included based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual apparatus or client product executes, it may execute sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) according to the embodiments or methods shown in the figures.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, apparatus (system) or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment. In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. The present invention is not limited to any single aspect, nor is it limited to any single embodiment, nor is it limited to any combination and/or permutation of these aspects and/or embodiments. Moreover, each aspect and/or embodiment of the present invention may be utilized alone or in combination with one or more other aspects and/or embodiments thereof.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present invention, and they should be construed as being included in the following claims and description.

Claims (13)

1. A method for calculating log retention time is characterized by comprising the following steps:
acquiring storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods;
calculating a log acceleration reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively;
determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
and determining the larger value of the preset shortest retention time and the reference retention time as the log retention time.
2. The method according to claim 1, wherein after determining that the larger of the preset shortest retention time and the reference retention time is the log retention time, the method further comprises:
and storing the log on a storage disk according to the log retention time.
3. The method according to claim 1, wherein after determining that the larger of the preset shortest retention time and the reference retention time is the log retention time, the method further comprises:
determining a cleaning period of the log according to the log retention time;
and cleaning the log stored on the storage disk according to the cleaning period of the log.
4. The method for calculating the log retention time according to claim 1, wherein the calculating the log acceleration reference value according to the log incremental data corresponding to the recording period and s recording periods of the log comprises:
and calculating at least one log acceleration increasing reference value according to the recording period and the s log incremental data by adopting at least one of an average speed method, a nearest speed method, a farthest speed method, a nearest acceleration method and an average acceleration method.
5. The method according to claim 4, wherein the determining that the larger of the preset shortest retention time and the reference retention time is the log retention time comprises:
and determining the maximum value of the shortest retention time and the reference retention time of at least one log as the log retention time.
6. The method according to claim 1, wherein the alarm ratio of the log is 5% or 10%.
7. An apparatus for calculating log retention time, comprising:
the acquisition unit is used for acquiring storage space data of a storage disk, a log recording period, a log alarm ratio and log incremental data corresponding to s recording periods;
the speed increasing unit is used for calculating a log speed increasing reference value according to log incremental data corresponding to the recording period of the log and the s recording periods respectively;
the calculation unit is used for determining the reference retention time of the log based on the storage space data of the storage disk, the alarm ratio of the log and the log acceleration reference value;
and the comparison unit is used for determining the larger value of the preset shortest retention time and the reference retention time as the log retention time.
8. The apparatus for calculating log retention time according to claim 7, further comprising:
and the storage unit is used for storing the log on the storage disk according to the log retention time.
9. The apparatus for calculating log retention time according to claim 7, further comprising:
the processing unit is used for determining the cleaning period of the log according to the log retention time;
and the cleaning unit is used for cleaning the log stored on the storage disk according to the cleaning period of the log.
10. The apparatus for calculating a log retention time according to claim 7, wherein the speed increasing unit includes:
and the speed increasing subunit is used for adopting at least one of an average speed method, a nearest speed method, a farthest speed method, a nearest acceleration method and an average acceleration method, and calculating at least one log speed increasing reference value according to the recording period and the s log incremental data.
11. The apparatus for calculating log retention time according to claim 10, wherein the comparing unit includes:
and the comparison subunit is used for determining that the maximum value in the shortest retention time and the reference retention time of at least one log is the log retention time.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for calculating a log retention time according to any one of claims 1 to 6 when executing the program.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for calculating a log retention time period according to any one of claims 1 to 6.
CN202010909833.5A 2020-09-02 2020-09-02 Method and device for calculating log retention time Pending CN112035066A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010909833.5A CN112035066A (en) 2020-09-02 2020-09-02 Method and device for calculating log retention time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010909833.5A CN112035066A (en) 2020-09-02 2020-09-02 Method and device for calculating log retention time

Publications (1)

Publication Number Publication Date
CN112035066A true CN112035066A (en) 2020-12-04

Family

ID=73591184

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010909833.5A Pending CN112035066A (en) 2020-09-02 2020-09-02 Method and device for calculating log retention time

Country Status (1)

Country Link
CN (1) CN112035066A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113326004A (en) * 2021-06-10 2021-08-31 深圳市移卡科技有限公司 Efficient log centralization method and device in cloud computing environment
CN115543698A (en) * 2022-11-30 2022-12-30 云和恩墨(北京)信息技术有限公司 Data backup method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070130099A1 (en) * 2005-12-02 2007-06-07 International Business Machines Corporation Compression of servo control logging entries
US20170293433A1 (en) * 2016-04-12 2017-10-12 International Business Machines Corporation Adjustable tape storage capacity
CN107590283A (en) * 2017-09-29 2018-01-16 浙江大华技术股份有限公司 A kind of file recovery method, device, server and computer-readable recording medium
CN108153488A (en) * 2017-12-13 2018-06-12 北京小米移动软件有限公司 Data increase method and device certainly
CN110188075A (en) * 2019-05-24 2019-08-30 无线生活(北京)信息技术有限公司 Log method for cleaning and device
CN110908971A (en) * 2019-11-08 2020-03-24 苏州浪潮智能科技有限公司 System log management method, device, storage medium and equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070130099A1 (en) * 2005-12-02 2007-06-07 International Business Machines Corporation Compression of servo control logging entries
US20170293433A1 (en) * 2016-04-12 2017-10-12 International Business Machines Corporation Adjustable tape storage capacity
CN107590283A (en) * 2017-09-29 2018-01-16 浙江大华技术股份有限公司 A kind of file recovery method, device, server and computer-readable recording medium
CN108153488A (en) * 2017-12-13 2018-06-12 北京小米移动软件有限公司 Data increase method and device certainly
CN110188075A (en) * 2019-05-24 2019-08-30 无线生活(北京)信息技术有限公司 Log method for cleaning and device
CN110908971A (en) * 2019-11-08 2020-03-24 苏州浪潮智能科技有限公司 System log management method, device, storage medium and equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113326004A (en) * 2021-06-10 2021-08-31 深圳市移卡科技有限公司 Efficient log centralization method and device in cloud computing environment
CN113326004B (en) * 2021-06-10 2023-03-03 深圳市移卡科技有限公司 Efficient log centralization method and device in cloud computing environment
CN115543698A (en) * 2022-11-30 2022-12-30 云和恩墨(北京)信息技术有限公司 Data backup method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US20190302867A1 (en) Method and apparatus for reducing continuous-wakeup delay of bluetooth loudspeaker, and bluetooth loudspeaker
CN111782470B (en) Distributed container log data processing method and device
CN112035066A (en) Method and device for calculating log retention time
CN111245732A (en) Flow control method, device and equipment
CN111445331A (en) Transaction matching method and device
CN113467525A (en) Interface call flow control method and device
CN113190516A (en) Data synchronization monitoring method and device
JP2008516320A (en) Method and apparatus for determining the size of a memory frame
CN111930507A (en) Current limiting method and device
CN107292142B (en) Business operation processing method, business operation processing device and business terminal
CN111737297B (en) Method and device for processing link aggregation call information
CN111061518B (en) Data processing method, system, terminal equipment and storage medium based on drive node
CN111142790B (en) Control method and device for disk write request, electronic equipment and storage medium
CN111953847A (en) Client message risk reminding method, device and system
US10372436B2 (en) Systems and methods for maintaining operating consistency for multiple users during firmware updates
CN111951049A (en) Commodity similarity-based recommendation method and device
CN110716699A (en) Method and apparatus for writing data
CN112766698B (en) Application service pressure determining method and device
CN113342501B (en) System fault processing method and device
CN116089110B (en) Method for controlling process interaction and related device
CN112866130B (en) Message packet interval adjusting method and device
CN111736772B (en) Storage space data processing method and device of distributed file system
CN112887219B (en) Message packet interval adjusting method and device
CN109672704B (en) Message processing method and device and electronic equipment
CN111951100B (en) Account maintenance method and device based on group clients

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination