CN110188075A - Log method for cleaning and device - Google Patents

Log method for cleaning and device Download PDF

Info

Publication number
CN110188075A
CN110188075A CN201910438638.6A CN201910438638A CN110188075A CN 110188075 A CN110188075 A CN 110188075A CN 201910438638 A CN201910438638 A CN 201910438638A CN 110188075 A CN110188075 A CN 110188075A
Authority
CN
China
Prior art keywords
log
cleaning
cleared
target journaling
parameter
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
CN201910438638.6A
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.)
Wireless Life (beijing) Information Technology Co Ltd
Original Assignee
Wireless Life (beijing) Information Technology Co 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 Wireless Life (beijing) Information Technology Co Ltd filed Critical Wireless Life (beijing) Information Technology Co Ltd
Priority to CN201910438638.6A priority Critical patent/CN110188075A/en
Publication of CN110188075A publication Critical patent/CN110188075A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Abstract

The present invention relates to log method for cleaning and devices.This method comprises: obtaining log clears up parameter;Parameter is cleared up according to the log, determines the target journaling for needing to clear up;The target journaling is cleared up automatically.The cleaning efficiency that target journaling can be improved according to the technical solution of the present invention, avoids user from clearing up log manually, also avoids needing to send warning message before clearing up log and interfering user.

Description

Log method for cleaning and device
Technical field
The present invention relates to journaling techniques field more particularly to log method for cleaning and device.
Background technique
Currently, working as system when something goes wrong, log can be usually generated, to record to abnormal conditions.But the relevant technologies In, journal file has extremely strong timeliness, and expired log does not often have availability.Thus, it is necessary to log is carried out clear Reason.
And when clearing up log, current commonplace way are as follows: log is deleted manually, alternatively, increasing disk file Monitoring, in this way, alarm can be triggered when disk is made or approached and made.
But it is bothersome laborious to delete log manually, and if having accessed monitoring system, time of fire alarming possibly be present at midnight or Person's morning, time have very big uncertainty, can cause big inconvenience and difficulty to developer.
Summary of the invention
The embodiment of the invention provides log method for cleaning and devices.The technical solution is as follows:
According to a first aspect of the embodiments of the present invention, a kind of log method for cleaning is provided, comprising:
It obtains log and clears up parameter;
Parameter is cleared up according to the log, determines the target journaling for needing to clear up;
The target journaling is cleared up automatically.
In one embodiment, the log cleaning parameter includes log storage address and log mark;
It is described that parameter is cleared up according to the log, determine the target journaling for needing to clear up, comprising:
According to the log storage address, log storage catalogue is determined;
It is the target journaling that the log to match with log mark is inquired from the log storage catalogue.
In one embodiment, parameter is cleared up in the log further include: the triggered time is cleared up in log cleaning cycle and log;
It is described that the target journaling is cleared up automatically, comprising:
The triggered time is cleared up according to the log cleaning cycle and the log, the target journaling is cleared up.
In one embodiment, the log cleaning parameter includes log storage address and max log memory space;
It is described that parameter is cleared up according to the log, determine the target journaling for needing to clear up, comprising:
According to the log storage address, log storage catalogue is determined;
It, will be shared in the log storage catalogue when the log storage catalogue reaches the max log memory space The log that memory space is greater than pre-set space is determined as the target journaling.
In one embodiment, the method also includes:
After by target journaling cleaning, the cleaning of the target journaling is recorded and shown.
According to a second aspect of the embodiments of the present invention, a kind of log cleaning plant is provided, comprising:
Module is obtained, for obtaining log cleaning parameter;
Determining module determines the target journaling for needing to clear up for clearing up parameter according to the log;
Cleaning modul, for being cleared up automatically the target journaling.
In one embodiment, the log cleaning parameter includes log storage address and log mark;
The determining module includes:
First determines submodule, for determining log storage catalogue according to the log storage address;
Submodule is inquired, is institute for inquiring the log to match with log mark from the log storage catalogue State target journaling.
In one embodiment, parameter is cleared up in the log further include: the triggered time is cleared up in log cleaning cycle and log;
The cleaning modul includes:
Submodule is cleared up, for clearing up the triggered time according to the log cleaning cycle and the log, to the target Log is cleared up.
In one embodiment, the log cleaning parameter includes log storage address and max log memory space;
The determining module includes:
Second determines submodule, for determining log storage catalogue according to the log storage address;
Third determines submodule, for when the log storage catalogue reaches the max log memory space, by institute It states the log that shared memory space is greater than pre-set space in log storage catalogue and is determined as the target journaling.
In one embodiment, described device further include:
Processing module, for after by target journaling cleaning, the cleaning of the target journaling to be recorded And it shows.
The technical solution that the embodiment of the present invention provides can include the following benefits:
Parameter is cleared up by obtaining preconfigured log, the target journaling for needing to clear up can be automatically determined, then to this Target journaling is cleared up automatically, to improve the cleaning efficiency of target journaling, is avoided user from clearing up log manually, is also avoided It needs to send warning message and interfere user before cleaning log.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not It can the limitation present invention.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows and meets implementation of the invention Example, and be used to explain the principle of the present invention together with specification.
Fig. 1 is a kind of flow chart of log method for cleaning shown according to an exemplary embodiment.
Fig. 2A is the flow chart of another log method for cleaning shown according to an exemplary embodiment.
Fig. 2 B is the flow chart of another log method for cleaning shown according to an exemplary embodiment.
Fig. 3 is a kind of block diagram of log cleaning plant shown according to an exemplary embodiment.
Fig. 4 is the block diagram of another log cleaning plant shown according to an exemplary embodiment.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all embodiments consistented with the present invention.On the contrary, they be only with it is such as appended The example of device and method being described in detail in claims, some aspects of the invention are consistent.
In order to solve the above-mentioned technical problem, the embodiment of the invention provides a kind of log method for cleaning, this method can be used for In log liquidation procedures, system or device, and the corresponding executing subject of this method can be terminal or server, as shown in Figure 1, The method comprising the steps of S101 to step S103:
In step s101, it obtains log and clears up parameter;
In step s 102, parameter is cleared up according to log, determines the target journaling for needing to clear up;
In step s 103, target journaling is cleared up automatically.
Parameter is cleared up by obtaining preconfigured log, the target journaling for needing to clear up can be automatically determined, then to this Target journaling is cleared up automatically, to improve the cleaning efficiency of target journaling, is avoided user from clearing up log manually, is also avoided It needs to send warning message and interfere user before cleaning log.
As shown in Fig. 2, in one embodiment, log cleaning parameter includes log storage address and log mark;Log Storage address is used to indicate the operation system that log is stored and aims at the catalogue stored in stored operation system day.
Log mark can be the unique identifications such as title, the number of log.Or
Log identifies storage date or the various blog search conditions such as date search condition that can also be log, log Abbreviation, suffix of name etc..
Step S102 in above-mentioned Fig. 1 clears up parameter according to log, determine the target journaling for needing to clear up, including step Rapid S201 and step S202:
In step s 201, according to log storage address, log storage catalogue is determined;
In step S202, it is target journaling that the log to match with log mark is inquired from log storage catalogue.
According to the log storage address, it may be determined that log storage catalogue, by what is inquired automatically in log storage catalogue The log to match with log mark is determined as target journaling (log for needing to clear up), to improve the day for needing to clear up The inquiry accuracy and search efficiency of will.
With the log that matches of log mark i.e.: log identical with the mark of log mark, or with the log mark The similar log of the mark of knowledge, or the log is identified to the log identified as part of it.Such as: when log is identified as When Au_*, it is the log for identifying prefix or suffix that the log to match with log mark, which can be with Au,.
As shown in Figure 2 A, in one embodiment, parameter is cleared up in log further include: log cleaning cycle and log cleaning touching Send out the time;
Log cleaning cycle is for indicating how long clear up a log.Log clears up which time the triggered time needs in Point begins a clean up log.
Step S103 in above-mentioned Fig. 1, i.e., clear up target journaling automatically, including step S203:
In step S203, the triggered time is cleared up according to log cleaning cycle and log, target journaling is cleared up.
It can determine according to the log cleaning triggered time and need to begin a clean up target journaling at which time point at, and according to day Will cleaning cycle can determine that the cleaning frequency of log determines and need every how long clearing up a log, to improve the clear of log Manage efficiency.
In one embodiment, log cleaning parameter includes log storage address and max log memory space;
Parameter is cleared up according to log, determines the target journaling for needing to clear up, comprising:
According to log storage address, log storage catalogue is determined;
When log storage catalogue reaches max log memory space, memory space shared in log storage catalogue is greater than The log of pre-set space is determined as target journaling.
When the occupied space of the log stored in log storage catalogue has reached the maximum log memory space, explanation The log storage catalogue, which has been filled with, can not be further continued for storage log, thus, it can be empty by storage shared in log storage catalogue Between be greater than pre-set space log as target journaling, to clean up the biggish log of occupied space automatically, avoid to the day The corresponding memory space of will storage catalogue is excessively occupied.
In one embodiment, method further include:
After clearing up target journaling, the cleaning of target journaling is recorded and shown.
After clearing up target journaling, the cleaning of target journaling can be recorded and be automatically recorded and carry out cleaning record It has been shown that, to prompt user, such as: it is recordable at what point in time, what place delete target journaling, Huo Zheke Record which user deletes target journaling and the name of the target journaling etc..
Below in conjunction with Fig. 2 B technical solution that present invention be described in more detail:
In step S204, parameter is cleared up in setting log.
In step S205, obtains log and clear up parameter.
In step S206, according to log clear up parameter, determine need clear up aim at which operation system day which In logfile directory.
In step S207, the log for needing to clear up is inquired, the log then cleared up needs is cleared up.
In step S208, record log cleaning record.
Finally, it should be clear that: those skilled in the art can according to actual needs carry out above-mentioned multiple embodiments certainly By combining.
Corresponding above-mentioned log method for cleaning provided in an embodiment of the present invention, the embodiment of the present invention also provide a kind of log cleaning Device, as shown in figure 3, the device includes:
Module 301 is obtained, is configured as obtaining log cleaning parameter;
Determining module 302 is configured as clearing up parameter according to log, determines the target journaling for needing to clear up;
Cleaning modul 303 is configured as clearing up target journaling automatically.
As shown in figure 4, in one embodiment, log cleaning parameter includes log storage address and log mark;
Determining module 302 may include:
First determines submodule 3021, is configured as determining log storage catalogue according to log storage address;
Submodule 3022 is inquired, is configured as inquiring the log to match with log mark from log storage catalogue being mesh Mark log.
As shown in figure 4, in one embodiment, parameter is cleared up in log further include: log cleaning cycle and log cleaning touching Send out the time;
Cleaning modul 303 may include:
Submodule 3031 is cleared up, is configured as according to log cleaning cycle and log cleaning triggered time, to target journaling It is cleared up.
In one embodiment, log cleaning parameter includes log storage address and max log memory space;
Determining module includes:
Second determines submodule, is configured as determining log storage catalogue according to log storage address;
Third determines submodule, is configured as depositing log when log storage catalogue reaches max log memory space The log that shared memory space is greater than pre-set space in storage catalogue is determined as target journaling.
In one embodiment, device further include:
Processing module is configured as after clearing up target journaling, and the cleaning of target journaling is recorded and shown Show.
Those skilled in the art will readily occur to of the invention its after considering specification and the invention invented here of practice Its embodiment.This application is intended to cover any variations, uses, or adaptations of the invention, these modifications, purposes or The common knowledge in the art that person's adaptive change follows general principle of the invention and do not invent including the present invention Or conventional techniques.The description and examples are only to be considered as illustrative, and true scope and spirit of the invention are by following Claim is pointed out.
It should be understood that the present invention is not limited to the precise structure already described above and shown in the accompanying drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present invention is limited only by the attached claims.

Claims (10)

1. a kind of log method for cleaning characterized by comprising
It obtains log and clears up parameter;
Parameter is cleared up according to the log, determines the target journaling for needing to clear up;
The target journaling is cleared up automatically.
2. the method according to claim 1, wherein
The log cleaning parameter includes log storage address and log mark;
It is described that parameter is cleared up according to the log, determine the target journaling for needing to clear up, comprising:
According to the log storage address, log storage catalogue is determined;
It is the target journaling that the log to match with log mark is inquired from the log storage catalogue.
3. the method according to claim 1, wherein
Parameter is cleared up in the log further include: the triggered time is cleared up in log cleaning cycle and log;
It is described that the target journaling is cleared up automatically, comprising:
The triggered time is cleared up according to the log cleaning cycle and the log, the target journaling is cleared up.
4. the method according to claim 1, wherein
The log cleaning parameter includes log storage address and max log memory space;
It is described that parameter is cleared up according to the log, determine the target journaling for needing to clear up, comprising:
According to the log storage address, log storage catalogue is determined;
When the log storage catalogue reaches the max log memory space, by shared storage in the log storage catalogue The log that space is greater than pre-set space is determined as the target journaling.
5. method according to claim 1 to 4, which is characterized in that the method also includes:
After by target journaling cleaning, the cleaning of the target journaling is recorded and shown.
6. a kind of log cleaning plant characterized by comprising
Module is obtained, for obtaining log cleaning parameter;
Determining module determines the target journaling for needing to clear up for clearing up parameter according to the log;
Cleaning modul, for being cleared up automatically the target journaling.
7. device according to claim 6, which is characterized in that
The log cleaning parameter includes log storage address and log mark;
The determining module includes:
First determines submodule, for determining log storage catalogue according to the log storage address;
Submodule is inquired, is the mesh for inquiring the log to match with log mark from the log storage catalogue Mark log.
8. device according to claim 6, which is characterized in that
Parameter is cleared up in the log further include: the triggered time is cleared up in log cleaning cycle and log;
The cleaning modul includes:
Submodule is cleared up, for clearing up the triggered time according to the log cleaning cycle and the log, to the target journaling It is cleared up.
9. device according to claim 6, which is characterized in that
The log cleaning parameter includes log storage address and max log memory space;
The determining module includes:
Second determines submodule, for determining log storage catalogue according to the log storage address;
Third determines submodule, for when the log storage catalogue reaches the max log memory space, by the day The log that shared memory space is greater than pre-set space in will storage catalogue is determined as the target journaling.
10. device according to any one of claims 6 to 9, which is characterized in that described device further include:
Processing module, for after by target journaling cleaning, the cleaning of the target journaling being recorded and being shown Show.
CN201910438638.6A 2019-05-24 2019-05-24 Log method for cleaning and device Pending CN110188075A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910438638.6A CN110188075A (en) 2019-05-24 2019-05-24 Log method for cleaning and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910438638.6A CN110188075A (en) 2019-05-24 2019-05-24 Log method for cleaning and device

Publications (1)

Publication Number Publication Date
CN110188075A true CN110188075A (en) 2019-08-30

Family

ID=67717699

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910438638.6A Pending CN110188075A (en) 2019-05-24 2019-05-24 Log method for cleaning and device

Country Status (1)

Country Link
CN (1) CN110188075A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110780815A (en) * 2019-10-11 2020-02-11 杭州迪普科技股份有限公司 Log deleting method and device
CN112035066A (en) * 2020-09-02 2020-12-04 中国银行股份有限公司 Method and device for calculating log retention time

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6611852B1 (en) * 2000-09-29 2003-08-26 Emc Corporation System and method for cleaning a log structure
CN104704475A (en) * 2012-10-04 2015-06-10 阿尔卡特朗讯 Data logs management in a multi-client architecture
CN106557281A (en) * 2016-10-28 2017-04-05 武汉斗鱼网络科技有限公司 A kind of automatic processing method and system of server log
CN107357686A (en) * 2017-07-20 2017-11-17 郑州云海信息技术有限公司 A kind of daily record delet method and device
CN109271355A (en) * 2018-08-27 2019-01-25 杭州迪普科技股份有限公司 A kind of method and device of cleaning journal file caching
CN110780815A (en) * 2019-10-11 2020-02-11 杭州迪普科技股份有限公司 Log deleting method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6611852B1 (en) * 2000-09-29 2003-08-26 Emc Corporation System and method for cleaning a log structure
CN104704475A (en) * 2012-10-04 2015-06-10 阿尔卡特朗讯 Data logs management in a multi-client architecture
CN104704475B (en) * 2012-10-04 2018-04-27 阿尔卡特朗讯 Data logging management in multi-client framework
CN106557281A (en) * 2016-10-28 2017-04-05 武汉斗鱼网络科技有限公司 A kind of automatic processing method and system of server log
CN107357686A (en) * 2017-07-20 2017-11-17 郑州云海信息技术有限公司 A kind of daily record delet method and device
CN109271355A (en) * 2018-08-27 2019-01-25 杭州迪普科技股份有限公司 A kind of method and device of cleaning journal file caching
CN110780815A (en) * 2019-10-11 2020-02-11 杭州迪普科技股份有限公司 Log deleting method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110780815A (en) * 2019-10-11 2020-02-11 杭州迪普科技股份有限公司 Log deleting method and device
CN112035066A (en) * 2020-09-02 2020-12-04 中国银行股份有限公司 Method and device for calculating log retention time

Similar Documents

Publication Publication Date Title
KR101540910B1 (en) Identifying and correlating electronic mail messages
CN110188075A (en) Log method for cleaning and device
CN107656695B (en) Data storage and deletion method and device and distributed storage system
CN105512320B (en) User ranking obtaining method and device and server
CN103631603A (en) Software cleaning method and system
JPWO2015140927A1 (en) Data transfer monitoring system, data transfer monitoring method, and base system
CN110971571A (en) Website domain name verification method and related device
CN106383668B (en) Information storage method, storage management equipment and client
CN105893471B (en) Data processing method and electronic equipment
CN112839076B (en) Data storage method, data reading method, gateway, electronic equipment and storage medium
CN109743378B (en) Information pushing system, information pushing method and electronic equipment
CN110795395A (en) File deployment system and file deployment method
CN111026621A (en) Monitoring alarm method, device, equipment and medium for Elasticissearch cluster
CN104461505A (en) Terminal
CN108427737B (en) Data cleaning method, equipment and computer readable medium
JP2008519361A (en) How to enforce application specific management policies on content addressed storage devices
KR100696191B1 (en) System and method for aggregating and managing context in ubiquitous environment
CN104021053A (en) Method for restoration and backup of application programs, mobile terminal and network server
CN110727555A (en) Service interface management method, device, medium and computer equipment
CN110780815A (en) Log deleting method and device
CN109639843A (en) Data transmission method and device
CN104572943A (en) Installation-free program cleaning method and device
CN107688951B (en) Information pushing method and device
KR101219529B1 (en) Method and system for providing ivent information
CN110333968B (en) Data management method and device applied to database and computer equipment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190830