CN110309158A - Rolling abnormality judgment method, device and the readable medium of journal file - Google Patents

Rolling abnormality judgment method, device and the readable medium of journal file Download PDF

Info

Publication number
CN110309158A
CN110309158A CN201810331868.8A CN201810331868A CN110309158A CN 110309158 A CN110309158 A CN 110309158A CN 201810331868 A CN201810331868 A CN 201810331868A CN 110309158 A CN110309158 A CN 110309158A
Authority
CN
China
Prior art keywords
moment
journal file
establishment
grade
written
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.)
Granted
Application number
CN201810331868.8A
Other languages
Chinese (zh)
Other versions
CN110309158B (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810331868.8A priority Critical patent/CN110309158B/en
Publication of CN110309158A publication Critical patent/CN110309158A/en
Application granted granted Critical
Publication of CN110309158B publication Critical patent/CN110309158B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

This application discloses rolling abnormality judgment method, device and the readable mediums of a kind of journal file, are related to journal file process field.This method comprises: determining the establishment moment of i+1 journal file, i >=0;Determine the moment that is ultimately written of i-th of journal file, the establishment moment of i-th of journal file is before the establishment moment of i+1 journal file;When the establishment moment of i+1 journal file i-th journal file be ultimately written the moment before when, determine that the rolling of journal file is abnormal.By the last modification moment for obtaining the journal file first created, and the establishment moment of the journal file created afterwards, when the establishment moment is before the last modification moment, it then indicates after the journal file creation of rear creation, log content is also in the journal file that write-in first creates, namely indicate that two journal files exist while having the phenomenon that log content is written into, cause to roll exception, improve to the detection accuracy for rolling exception.

Description

Rolling abnormality judgment method, device and the readable medium of journal file
Technical field
The invention relates to journal file process field, in particular to the abnormal judgement side of the rolling of a kind of journal file Method, device and readable medium.
Background technique
Log content can be written in operating system in journal file (English: logfile), wherein log content is used In indicating that the data in application program or the operating system in the operating system are changed, log content is written to In journal file, the change occurred in application program or operating system can be recorded, and in order to avoid single log File is excessive, it will usually individual log file is divided into it is multiple, i.e., when the size of current log file reaches default size, will The log content not being written rolls write-in into next journal file.
And have the case where log content is written into simultaneously there can be no multiple journal files during rolling, so right The rolling process roll the judgement of correctness.In general, each journal file is corresponding with a last modification moment, The rolling correctness of journal file is judged by the last modification moment of journal file, this finally modifies the moment for referring to At the time of showing that the log content in the journal file is finally changed.For journal file is written in log content, this is most The modification moment is the last moment that log content is written into the journal file afterwards, as follows to the deterministic process for rolling correctness: Observer checks the last modification moment of logfile1 and logfile2, wherein logfile1 logfile2 it Before be created, when the last modification moment of logfile1 is before the last modification moment of logfile2, then it is assumed that roll just Really.
However, logfile1 and logfile2 exist while being written into the feelings of log content in a kind of possible situation Condition and generate that rolling is abnormal, but in last modification moment of two journal files for viewing of observer, logfile1 is most The modification moment remained unchanged before the last modification moment of logfile2 afterwards, so, two journal files due to being written log simultaneously Content and the rolling generated can not be observed extremely, cause the judgement to rolling process correctness inaccurate.
Summary of the invention
The embodiment of the present application provides rolling abnormality judgment method, device and the readable medium of a kind of journal file, can be with Solve two journal files due to and meanwhile log content is written and generates rolling can not be observed extremely, cause to rolling The problem of the judgement inaccuracy of the correctness of process.The technical solution is as follows:
On the one hand, a kind of rolling abnormality judgment method of journal file is provided, this method comprises:
Determine the establishment moment of i+1 journal file, at the time of establishment moment is that i+1 journal file is created, i ≥0;
Determine i-th of journal file is ultimately written the moment, is ultimately written and is ultimately written day constantly for i-th of journal file At the time of will content, the establishment moment of i-th of journal file is before the establishment moment of i+1 journal file;
When the establishment moment of i+1 journal file i-th journal file be ultimately written the moment before when, determine day The rolling of will file is abnormal, rolls exception and refers to i-th of journal file and i+1 journal file while having log content to be write The exception for entering and generating.
On the other hand, a kind of rolling abnormity judgement set of journal file is provided, which includes:
Determining module, for determining that the establishment moment of i+1 journal file, establishment moment are i+1 journal file At the time of being created, i >=0;
Determining module, be also used to determine i-th of journal file is ultimately written the moment, and be ultimately written is i-th day constantly At the time of will file is ultimately written log content, the establishment moment of i-th of journal file is in the creation of i+1 journal file Before quarter;
Abnormality detection module, for being ultimately written in i-th journal file of the establishment moment when i+1 journal file When before the moment, determines that the rolling of journal file is abnormal, roll exception and refer to i-th of journal file and i+1 journal file The exception for thering is log content to be written into simultaneously and generating.
On the other hand, a kind of server is provided, server includes processor and memory, is stored at least in memory One instruction, at least a Duan Chengxu, code set or instruction set, at least one instruction, at least a Duan Chengxu, code set or instruction set It is loaded by processor and is executed to realize such as journal file any in above-mentioned the application first aspect and its optional embodiment Rolling abnormality judgment method.
On the other hand, a kind of computer readable storage medium is provided, at least one instruction, extremely is stored in storage medium A few Duan Chengxu, code set or instruction set, at least one instruction, an at least Duan Chengxu, code set or instruction set are added by processor It carries and executes to realize that the rolling such as journal file any in above-mentioned the application first aspect and its optional embodiment is abnormal Judgment method.
On the other hand, a kind of computer program product is provided, when computer program product is run on computers, is made The computer execution such as rolling of journal file any in above-mentioned the application first aspect and its optional embodiment is obtained to sentence extremely Disconnected method.
Technical solution bring beneficial effect provided by the embodiments of the present application includes at least:
By obtaining the last modification moment of journal file first created, and the journal file created afterwards creation when It carves, when the establishment moment is before the last modification moment, then it represents that after the journal file created afterwards is created, log content Also in the journal file that first creates of write-in, namely indicate that two journal files exist while having what log content was written into show As causing to roll exception, improve to the detection accuracy for rolling exception.
Detailed description of the invention
In order to more clearly explain the technical solutions in the embodiments of the present application, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, the drawings in the following description are only some examples of the present application, for For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is that the journal file that one exemplary embodiment of the application provides rolls abnormal schematic diagram;
Fig. 2 is the flow chart of the rolling abnormality judgment method for the journal file that one exemplary embodiment of the application provides;
Fig. 3 is the process of the rolling abnormality judgment method for the journal file that another exemplary embodiment of the application provides Figure;
Fig. 4 is the process of the rolling abnormality judgment method for the journal file that another exemplary embodiment of the application provides Figure;
Fig. 5 is the process of the rolling abnormality judgment method for the journal file that another exemplary embodiment of the application provides Figure;
Fig. 6 is the process of the rolling abnormality judgment method for the journal file that another exemplary embodiment of the application provides Figure;
Fig. 7 is the structural frames of the rolling abnormity judgement set for the journal file that another exemplary embodiment of the application provides Figure;
Fig. 8 is the structural block diagram for the server that one exemplary embodiment of the application provides.
Specific embodiment
To keep the purposes, technical schemes and advantages of the application clearer, below in conjunction with attached drawing to the application embodiment party Formula is described in further detail.
Firstly, being explained for noun involved in the embodiment of the present application.
Accesstime (access moment): i.e. atime, at the time of for indicating that the data in file are finally accessed.This Apply in embodiment, which is used to determine the establishment moment of journal file, wherein the atime includes second grade atime, milli Second grade atime and nanosecond atime, this second grade atime are used to determine the second grade establishment moment of journal file, Millisecond Atime is used to determine the Millisecond establishment moment of journal file, and nanosecond atime is used to determine the nanosecond wound of journal file Build the moment.Wherein, second grade establishment moment is the establishment moment with the second for minimum measurement unit, and Millisecond establishment moment is with millisecond For the establishment moment of minimum measurement unit, nanosecond establishment moment is the establishment moment with nanosecond for minimum measurement unit.
Modifiedtime (modification moment): i.e. mtime is changed when file is written with the change of file content.This Apply in embodiment, what which was determined for journal file is ultimately written the moment, wherein the mtime includes second grade Mtime, Millisecond mtime and nanosecond mtime, this second grade mtime are used to determine grade write-in moment second of journal file, milli Second grade mtime is used to determine the Millisecond write-in moment of journal file, and nanosecond mtime is used to determine the nanosecond of journal file The moment is written.Wherein, the second grade write-in moment is the write-in moment with the second for minimum measurement unit, and the Millisecond write-in moment is with milli Second is the write-in moment of minimum measurement unit, and the nanosecond write-in moment is the write-in moment with nanosecond for minimum measurement unit.
Changetime (variation moment): i.e. ctime, write-in file, change file owners, change file permission or Person is changed when changing the linking relationship of file.In the embodiment of the present application, which can be used for determining journal file It is ultimately written the moment, wherein the ctime includes second grade ctime, Millisecond ctime and nanosecond ctime, this second grade Ctime is used to determine grade write-in moment second of journal file, and Millisecond ctime is used to determine the Millisecond write-in of journal file Moment, nanosecond ctime are used to determine the nanosecond write-in moment of journal file.Wherein, it is most that the second grade write-in moment, which is with the second, The write-in moment of small measurement unit, Millisecond write-in moment are the write-in moment with millisecond for minimum measurement unit, and nanosecond is write The write-in moment for the minimum measurement unit that enters that be with nanosecond constantly be.
Establishment moment: at the time of the establishment moment refers to that journal file is created.After being created, the journal file is initial It for an empty journal file, i.e., does not include log content in the journal file.
It is ultimately written the moment: being ultimately written and refer to constantly log content is persistently written after journal file is created, work as log At the time of content terminates write-in in the journal file.Optionally, each journal file includes the write-in upper limit, is limited the use of in the write-in In the size for controlling each journal file, such as: the write-in upper limit of each journal file is 2GB, then when log content is in log text In part write-in is when reaching 2GB, and at the time of end is written in journal file, the as journal file is ultimately written the moment.
Secondly, to the invention relates to journal file rolling process be illustrated, with writing for each journal file Enter for the upper limit is 2GB and is illustrated.
Firstly, creation logfile, and log content is written in logfile, it, will when writing full 2GB in the logfile The logfile is renamed as logfile1 and is saved;Logfile is created again, and is write in the newly created logfile Enter log content, when writing full 2GB in logfile, former logfile1 is renamed as logfile2, full logfile will be write It is renamed as logfile1 and is saved, and creates logfile again, and so on.
In a possible situation, it is different that rolling can be generated when two journal files have log content to be written into simultaneously Often, referring to FIG. 1, at the first moment to being written into log content A between the second moment, in logfile1, and it is newly created Log content B is written into logfile, after the second moment, new creation is written in log content A and log content B simultaneously Logfile in.Then between the first moment and the second moment, logfile and logfile1 have log content to be write simultaneously Enter, so can generate, rolling is abnormal, and the rolling abnormal last modification moment for only passing through journal file can not be detected.
Wherein, synchronization cannot have two journal files has log content to be written into and (generate and roll exception) simultaneously The reason of mainly have following two points:
First, journal file, which rolls system requirements, cannot have two journal files while have log content to be written into;
Second, when being written into log content simultaneously there are two journal file, to the other systems for relying on the journal file Running can have an impact.Schematically, the monitoring system quantity that statistical system is requested from journal file, and monitoring system exists When statistics, the quantity that only statistical system is requested from the journal file for be currently written into log content, when simultaneously, there are two log texts When log content is written in part, the system request being written in the journal file that first the creates system statistics that can not be monitored are arrived, and cause to supervise The quantity inaccuracy for the system request that control system statistics are arrived namely the statistical result inaccuracy of the monitoring system.
It is worth noting that, i-th of journal file and i+1 journal file involved in the embodiment of the present application be according to What the sequence that journal file is created successively determined, i.e. first journal file being created is the 1st journal file, the Two journal files being created are the 2nd journal file, and n-th of journal file being created is n-th of journal file. Wherein, the naming order of journal file can be in sequence with the creation sequence of journal file, can also be with the creation of journal file Sequence is in inverted order.It is illustrated so that the creation of the naming order of journal file and journal file sequence is in inverted order as an example, it is assumed that altogether There are 5 journal files, first journal file being created is named as logfile5, second journal file name being created For logfile4, the journal file that third is created is named as logfile3, and the 4th journal file being created is named as Logfile2, the 5th journal file being created are named as logfile1, and nearest one is created and is currently written into log The journal file of appearance is logfile.After being created when nearest one and be currently written into the journal file of log content and write full, successively Logfile5 is renamed as logfile6, logfile4 is renamed as logfile5, and logfile3 is renamed as logfile4, Logfile2 is renamed as logfile3, and logfile1 is renamed as logfile2, and logfile is renamed as logfile1, and creates again Build logfile.
Fig. 2 is the flow chart of the rolling abnormality judgment method for the journal file that one exemplary embodiment of the application provides, As shown in Fig. 2, being illustrated by taking the application in the server of the rolling abnormality judgment method of the journal file as an example, the journal file Rolling abnormality judgment method include:
Step 201, the establishment moment of i+1 journal file, i >=0 are determined.
Optionally, at the time of which is that i+1 journal file is created.
Optionally, each journal file correspondence is stored with atime, mtime and ctime, the i+1 journal file Establishment moment can be obtained by directly reading the atime of the i+1 journal file of storage.
It optionally, does not include log content in the journal file, and the i+1 when which is created A journal file includes the write-in upper limit, that is, the i+1 can be written in the log content for being no more than write-in upper limit size by server A journal file.
Optionally, which can be the file for having created and having terminated write-in log content, i.e., this Log content in i+1 journal file has reached the write-in upper limit, and the i-th+2 journal files have been created;The i+1 Journal file is also possible to a nearest journal file being created, i.e. the i+1 journal file is currently written into log Hold, and the i-th+2 journal files are not created also.
Step 202, determine i-th of journal file is ultimately written the moment.
Optionally, this be ultimately written constantly for log content be ultimately written i-th of journal file at the time of, this is i-th The establishment moment of journal file is before the establishment moment of above-mentioned i+1 journal file.
Optionally, the moment that is ultimately written of i-th of journal file can be by directly reading i-th day of storage The ctime of will file is obtained, and can also be obtained by directly reading the mtime of i-th of journal file of storage.
Optionally, which creates before i+1 journal file, has created i-th of journal file Afterwards, i-th of journal file is written into log content, when the log content that i-th of journal file is written meets predetermined condition When, terminate that i-th of journal file is written log content into, then terminate to be written log content i-th of journal file when It carves, as i-th of journal file is ultimately written the moment.Wherein, above-mentioned predetermined condition includes at least one in following condition Kind:
First, the size that the log content of i-th of journal file is written reaches the write-in upper limit;
Second, the duration that i-th of journal file is written in log content reaches maximum time limit.
Step 203, when the establishment moment of i+1 journal file i-th journal file be ultimately written the moment before When, determine that the rolling of journal file is abnormal.
The rolling refers to i-th of journal file and i+1 journal file extremely while having log content to be written into and producing Raw exception.Optionally, the log content that i-th of journal file and i+1 journal file are written simultaneously can be difference , it is also possible to identical.Such as, in synchronization, log content A is written i-th journal file, and log content B is written into the I+1 journal file.
Optionally, the establishment moment to the i+1 journal file of acquisition and i-th journal file are ultimately written the moment Be compared, when the establishment moment of i+1 journal file i-th journal file be ultimately written the moment before when, then say It is bright after i+1 journal file is created, still have log content that i-th of journal file is written, namely illustrate i+1 day Will file and i-th of journal file in establishment moment and are ultimately written in the period between the moment, while having log content quilt Write-in.
In conclusion the rolling abnormality judgment method of journal file provided in this embodiment, by obtaining the day first created The last modification moment of will file, and the establishment moment of journal file created afterwards, when the establishment moment is in the last modification When before the moment, then it represents that after the journal file created afterwards is created, log content also in the journal file that first creates of write-in, Namely indicate that two journal files exist while having the phenomenon that log content is written into, cause to roll exception, improve to rolling Move abnormal detection accuracy.
In an alternative embodiment, above-mentioned i+1 journal file is a nearest journal file being created, needle The i+1 journal file and i-th of journal file are carried out rolling abnormal judgement, i.e., during creating journal file, To abnormal progress real-time judge is rolled, Fig. 3 is that the rolling for the journal file that another exemplary embodiment of the application provides is abnormal Judgment method, as shown in figure 3, the judgment method includes:
Step 301, the document creation moment is monitored.
Optionally, this document establishment moment is at the time of being currently written into the journal file of log content to be created.
Optionally, the mode for monitoring the document creation moment includes such as any one under type:
First, a document creation moment is obtained every preset time;Such as: when the document creation of acquisition in one second It carves.
Second, persistently detect the document creation moment.
Step 302, when monitoring that the document creation moment changes, by the corresponding day at document creation moment after variation Will file is determined as i+1 journal file.
Optionally, server determines that the journal file for being currently written into log content is according to the document creation moment monitored It is no to be rolled.
Schematically, current file content is currently written into logfile, and the establishment moment of the logfile is 3:21, then supervises The document creation moment measured is 3:21, at the end of logfile write-in, this document is renamed as logfile1 and is protected It deposits, and newly creates logfile, the establishment moment of newly created logfile is 3:23, at this point, the document creation moment monitored For 3:23, then it is assumed that the journal file for being currently written into log content is rolled, then by the newly created log text after rolling Part is determined as i+1 journal file.The example above and the embodiment of the present application are combined, then can using logfile1 as I-th of journal file, using newly created logfile as i+1 journal file.
Optionally, which is the journal file of nearest one creation.
Wherein, whether the document creation moment, which changes, to be determined at least one of in the following way:
First, the above-mentioned document creation moment includes first second grade establishment moment, which is to be with the second At the time of minimum measurement unit.When monitoring that first second grade establishment moment become the second establishment moment from the first establishment moment When, the corresponding journal file of the second establishment moment is determined as i+1 journal file, wherein the first establishment moment and second Establishment moment be all with the second for minimum measurement unit at the time of.In conjunction with the example above, which is first second grade establishment moment, It may be considered 3 points 21 seconds.
Second, this document establishment moment includes first second grade establishment moment and the first nanosecond establishment moment, this is first second Grade establishment moment be with the second for minimum measurement unit at the time of, which is single for minimum metering with nanosecond At the time of position.When monitoring that grade establishment moment did not changed in first second, whether the first nanosecond establishment moment of monitoring occurs Variation, when monitoring that the first nanosecond establishment moment becomes four establishment moments from third establishment moment, when by the 4th creation It carves corresponding journal file and is determined as i+1 journal file, wherein third establishment moment and the 4th establishment moment are all to receive At the time of second is minimum measurement unit.Schematically, it monitors that first second grade establishment moment is 3:21 and does not change, then supervises First second grade establishment moment is surveyed, when monitoring first second grade establishment moment from 3 points of 21 seconds 5 nanoseconds, 3 points is changed to and 55 receives for 21 seconds When the second, then it is assumed that the journal file is rolled, and is i+1 log by 3 points of 21 seconds 55 nanoseconds corresponding journal file File.
It is worth noting that, the nanosecond in the above-mentioned second way, can also be replaced with millisecond.
Step 303, the establishment moment of i+1 journal file, i >=0 are determined.
Optionally, at the time of which is that i+1 journal file is created.
Optionally it is determined that the mode of the establishment moment of i+1 journal file includes such as at least one of under type:
First, each journal file correspondence is stored with atime, mtime and ctime, the wound of the i+1 journal file Building the moment can be obtained by directly reading the atime of the i+1 journal file of storage;
Schematically, the storage format of atime, mtime and ctime of journal file are as shown in following table one:
Table one
Journal file atime mtime ctime
logfile 3:21 3:22 3:22
logfile1 3:20 3:21 3:21
logfile2 3:19 3:20 3:20
Optionally, above-mentioned table one is only to illustrate, and in actual operation, for second grade atime, Millisecond atime and is received Second grade atime, second grade mtime, Millisecond mtime and nanosecond mtime, second grade ctime, Millisecond ctime and nanosecond Grade ctime can be stored respectively.
Second, the document creation moment after the variation monitored in above-mentioned steps 302 is the wound of i+1 journal file The moment is built, the document creation moment after directly reading the variation of above-mentioned monitoring.
The i+1 journal file is a nearest journal file being created, i.e. the i+1 journal file is being write Enter log content, and the i-th+2 journal files are not created also.
Step 304, determine i-th of journal file is ultimately written the moment.
Optionally, this be ultimately written constantly for i-th of journal file be ultimately written log content at the time of, this is i-th day The establishment moment of will file is before the establishment moment of above-mentioned i+1 journal file.
Optionally, the moment that is ultimately written of i-th of journal file can be by directly reading i-th day of storage The ctime of will file is obtained, and can also be obtained by directly reading the mtime of i-th of journal file of storage.
Optionally, which creates before i+1 journal file, has created i-th of journal file Afterwards, i-th of journal file is written into log content, when the log content that i-th of journal file is written meets predetermined condition When, terminate that i-th of journal file is written log content into, then terminate to be written log content i-th of journal file when It carves, as i-th of journal file is ultimately written the moment.Wherein, above-mentioned predetermined condition includes at least one in following condition Kind:
First, the size that the log content of i-th of journal file is written reaches the write-in upper limit;
Second, the duration that i-th of journal file is written in log content reaches maximum time limit.
Step 305, when the establishment moment of i+1 journal file i-th journal file be ultimately written the moment before When, determine that the rolling of journal file is abnormal.
The rolling refers to i-th of journal file and i+1 journal file extremely while having log content to be written into and producing Raw exception.
Optionally, the establishment moment to the i+1 journal file of acquisition and i-th journal file are ultimately written the moment Be compared, when the establishment moment of i+1 journal file i-th journal file be ultimately written the moment before when, then say It is bright after i+1 journal file is created, still have log content that i-th of journal file is written, namely illustrate i+1 day Will file and i-th of journal file in establishment moment and are ultimately written in the period between the moment, while having log content quilt Write-in.
In conclusion the rolling abnormality judgment method of journal file provided in this embodiment, by obtaining the day first created The last modification moment of will file, and the establishment moment of journal file created afterwards, when the establishment moment is in the last modification When before the moment, then it represents that after the journal file created afterwards is created, log content also in the journal file that first creates of write-in, Namely indicate that two journal files exist while having the phenomenon that log content is written into, cause to roll exception, improve to rolling Move abnormal detection accuracy.
The rolling abnormality judgment method of journal file provided in this embodiment, by whether becoming to the document creation moment Change, so that it is determined that whether journal file rolls, when rolling, then explanation has journal file to be created, then new to this Whether the journal file that the journal file built is created with upper one, which occurs rolling exception, is detected, i.e., day provided in this embodiment The rolling abnormality judgment method of will file can in real time detect the rolling of journal file extremely, improve abnormal to rolling Timeliness.
In an alternative embodiment, in the relatively establishment moment of i+1 journal file and i-th journal file When being ultimately written the moment, two moment can be compared by three kinds of second grade, Millisecond and nanosecond grades, to avoid Due to accuracy it is low caused by roll and abnormal can not be detected.Fig. 4 is that another exemplary embodiment of the application provides Journal file rolling abnormality judgment method, as shown in figure 4, the judgment method includes:
Step 401, the document creation moment is monitored.
Optionally, this document establishment moment is at the time of being currently written into the journal file of log content to be created.
Optionally, the mode for monitoring the document creation moment includes such as any one under type:
First, a document creation moment is obtained every preset time;Such as: every one second, when obtaining a document creation It carves.
Second, persistently detect the document creation moment.
Step 402, when monitoring that the document creation moment changes, by the corresponding day at document creation moment after variation Will file is determined as i+1 journal file.
Optionally, server determines that the journal file for being currently written into log content is according to the document creation moment monitored It is no to be rolled.
Optionally, which is the journal file of nearest one creation.
Wherein, whether the document creation moment, which changes, to carry out at least one of in the following way:
First, the above-mentioned document creation moment includes first second grade establishment moment, which is to be with the second At the time of minimum measurement unit.When monitoring that first second grade establishment moment become the second establishment moment from the first establishment moment When, the corresponding journal file of the second establishment moment is determined as i+1 journal file, wherein the first establishment moment and second Establishment moment be all with the second for minimum measurement unit at the time of.
Second, this document establishment moment includes first second grade establishment moment and the first nanosecond establishment moment, this is first second Grade establishment moment be with the second for minimum measurement unit at the time of, which is single for minimum metering with nanosecond At the time of position.When monitoring that grade establishment moment did not changed in first second, whether the first nanosecond establishment moment of monitoring occurs Variation, when monitoring that the first nanosecond establishment moment becomes four establishment moments from third establishment moment, when by the 4th creation It carves corresponding journal file and is determined as i+1 journal file, wherein third establishment moment and the 4th establishment moment are all to receive At the time of second is minimum measurement unit.
It is worth noting that, the nanosecond in the above-mentioned second way, can also be replaced with millisecond.
Step 403, the establishment moment of i+1 journal file, i >=0 are determined.
Optionally, at the time of which is that i+1 journal file is created.
Optionally it is determined that the mode of the establishment moment of i+1 journal file includes such as at least one of under type:
First, each journal file correspondence is stored with atime, mtime and ctime, the wound of the i+1 journal file Building the moment can be obtained by directly reading the atime of the i+1 journal file of storage;
Second, the document creation moment after the variation monitored in above-mentioned steps 302 is the wound of i+1 journal file The moment is built, the document creation moment after directly reading the variation of above-mentioned monitoring.
The i+1 journal file is a nearest journal file being created, i.e. the i+1 journal file is being write Enter log content, and the i-th+2 journal files are not created also.
Step 404, determine i-th of journal file is ultimately written the moment.
Optionally, this be ultimately written constantly for i-th of journal file be ultimately written log content at the time of, this is i-th day The establishment moment of will file is before the establishment moment of above-mentioned i+1 journal file.
Optionally, the moment that is ultimately written of i-th of journal file can be by directly reading i-th day of storage The ctime of will file is obtained, and can also be obtained by directly reading the mtime of i-th of journal file of storage.
Step 405, determine second second grade establishment moment whether before grade write-in moment second.
Step 406, when second second grade establishment moment is before grade write-in moment second, it is abnormal to determine that journal file rolls.
Optionally, the establishment moment of i+1 journal file includes second second grade establishment moment, i-th of journal file Be ultimately written constantly include the second grade write-in moment, second second grade establishment moment and the second grade write-in moment be all with the second be most subtotal At the time of measuring unit.
Optionally, when second second grade establishment moment be not before grade write-in moment second, it can determine that journal file rolls Normally, it can continue to judge Millisecond or nanosecond.
Schematically, second second grade establishment moment is 3:21, and grade write-in moment second is 3:22, then it is assumed that in 3:21 to 3:22 Between, i+1 journal file and i-th of journal file have log content write-in simultaneously, then it is assumed that journal file rolls abnormal.
Step 407, when second second grade establishment moment be not before grade write-in moment second, when determining the creation of the second Millisecond It carves whether before the moment is written in Millisecond.
Optionally, the establishment moment of i+1 journal file includes that second second grade establishment moment and the second Millisecond create At the moment, i-th of being ultimately written for journal file includes grade write-in moment second and Millisecond write-in moment, the second Millisecond wound constantly Found a capital the moment and the Millisecond write-in moment be with millisecond for minimum measurement unit at the time of.
Optionally, when the second Millisecond establishment moment is before the moment is written in Millisecond, it is abnormal to determine that file rolls.
Optionally, when the second Millisecond establishment moment is not before the moment is written in Millisecond, it can determine that file rolls Normally, it can continue to judge nanosecond.
Schematically, second second grade establishment moment is 3:21, and grade write-in moment second is 3:21, then continues to the second Millisecond Establishment moment and Millisecond write-in the moment detected, the second Millisecond establishment moment be 3 points 21 seconds 15 milliseconds, Millisecond is write Enter constantly for 3 points 21 seconds 40 milliseconds, it may be considered that 3 points 21 seconds 15 milliseconds to 3 points 21 seconds between 40 milliseconds, i+1 day Will file and i-th of journal file have log content write-in simultaneously, it is determined that file rolls abnormal.
Step 408, when second second grade establishment moment be not before grade write-in moment second, when determining the creation of the second nanosecond It carves whether before the moment is written in nanosecond.
Optionally, the establishment moment of i+1 journal file includes that second second grade establishment moment and the second nanosecond create At the moment, i-th of being ultimately written for journal file includes grade write-in moment second and nanosecond write-in moment, the second nanosecond wound constantly Found a capital the moment and the nanosecond write-in moment be with nanosecond for minimum measurement unit at the time of.
Optionally, when the second nanosecond establishment moment is before the moment is written in nanosecond, it is different to determine that journal file rolls Often.
Schematically, second second grade establishment moment is 3:21, and grade write-in moment second is 3:21, then continues to the second nanosecond Establishment moment and nanosecond write-in moment are detected, and the second nanosecond establishment moment is 3 points of 21 seconds 15 nanoseconds, and nanosecond is write Enter constantly for 3 points of 21 seconds 40 nanoseconds, it may be considered that in 3 points of 21 seconds 15 nanoseconds between 3 points of 21 seconds 40 nanoseconds, i+1 day Will file and i-th of journal file have log content write-in simultaneously, it is determined that file rolls abnormal.
Step 410, when the second Millisecond establishment moment is not before the moment is written in Millisecond, determine that file journalization rolls Normally, continue to detect;And/or when the second nanosecond establishment moment is not before the moment is written in nanosecond, determine log File rolls normally, continues to detect.
In conclusion the rolling abnormality judgment method of journal file provided in this embodiment, by obtaining the day first created The last modification moment of will file, and the establishment moment of journal file created afterwards, when the establishment moment is in the last modification When before the moment, then it represents that after the journal file created afterwards is created, log content also in the journal file that first creates of write-in, Namely indicate that two journal files exist while having the phenomenon that log content is written into, cause to roll exception, improve to rolling Move abnormal detection accuracy.
The rolling abnormality judgment method of journal file provided in this embodiment, by whether becoming to the document creation moment Change, so that it is determined that whether journal file rolls, when rolling, then explanation has journal file to be created, then new to this Whether the journal file that the journal file built is created with upper one, which occurs rolling exception, is detected, i.e., day provided in this embodiment The rolling abnormality judgment method of will file can in real time detect the rolling of journal file extremely, improve abnormal to rolling Timeliness.
The rolling abnormality judgment method of journal file provided in this embodiment passes through second grade, Millisecond and nanosecond three Kind rank, establishment moment and i-th of being ultimately written for journal file to i+1 journal file are compared constantly, more smart Really judge whether file rolls abnormal, and avoiding can not be detected due to rolling abnormal generate in lesser time precision Situation about coming.
In an alternative embodiment, judge whether journal file is rolled for above-mentioned, carry out overall description, ask With reference to Fig. 5.
Step 501, start.
Step 502, setting file rolls mark not roll.
This document rolls mark and is used to indicate whether journal file is rolled, i.e., whether creates new journal file For log content to be written.
Step 503, logfile seconds grade atime are obtained for the first time.Grade document creation moment second is obtained for the first time.
Step 504, logfile nanosecond atime is obtained for the first time.The nanosecond document creation moment is obtained for the first time.
Step 505, logfile seconds grade atime are obtained again.
Step 506, logfile nanosecond atime is obtained again.
Step 507, whether the second grade atime that judgement obtains for the first time and the second grade atime obtained again are identical.
Step 508, when the second grade atime obtained for the first time is identical as the second grade atime obtained again, judgement obtains for the first time The nanosecond atime and nanosecond atime that obtains again it is whether identical.
Step 509, it when the second grade atime and second for obtaining again grade atime that obtain for the first time be not identical, or obtains for the first time The nanosecond atime and nanosecond atime that obtains again it is not identical when, setting file rolls mark to roll.
Optionally, in conjunction with above-described embodiment, newly created journal file is above-mentioned i+1 log text after the rolling Part.
Step 510, logfile1 seconds grade ctime are obtained.
Optionally, in conjunction with above-described embodiment, i+1 journal file is the journal file of nearest one creation, then should Logfile1 is i-th of journal file, that is, determines that the second grade of i-th of journal file is ultimately written the moment.
Step 511, judge whether the second grade ctime of logfile1 is less than or equal to the second grade atime of logfile.
Step 512, when the second of logfile1 grade ctime is greater than the second grade atime of logfile, it is different to determine that file rolls Often.
Step 513, when logfile1 second grade ctime less than or equal to logfile second grade atime when, file roll at Function, and the second grade atime and nanosecond atime of logfile is obtained again.
It is worth noting that, in above-mentioned steps, when the nanosecond atime obtained for the first time in step 508 with again obtain It when nanosecond atime is identical, reaffirms that file is not rolled, and obtains second grade atime and the nanosecond of logfile again Grade atime.
It is worth noting that, above-mentioned ctime can also be replaced with mtime.
In an alternative embodiment, after rolling to journal file, judge roll whether abnormal progress entirety is said It is bright, please refer to Fig. 6.
Step 601, after journal file rolls, the second grade ctime of logfile1 is obtained.
Step 602, the Millisecond ctime of logfile1 is obtained.
Step 603, judge whether the second grade ctime of logfile1 is less than the second grade atime of logfile.
Step 604, when the second of logfile1 grade ctime is not less than the second grade atime of logfile, judge logfile1 Second grade ctime whether be equal to logfile second grade atime.
Step 605, when the second of logfile1 grade ctime is equal to the second grade atime of logfile, judge logfile1's Whether Millisecond ctime is less than or equal to the Millisecond atime of logfile.
Step 606, the milli of the second grade atime or logfile1 as the second grade ctime of logfile1 less than logfile When second grade ctime is less than or equal to the Millisecond atime of logfile, confirmation file rolls normal.
Step 607, when second grade atime or logfile1 of the second grade ctime of logfile1 not equal to logfile When Millisecond ctime is greater than the Millisecond atime of logfile, confirmation file rolls abnormal.
It is worth noting that, above-mentioned ctime can also be replaced with mtime.
It is worth noting that, above-mentioned Millisecond can also be replaced with nanosecond.
Fig. 7 is the structural frames of the rolling abnormity judgement set for the journal file that another exemplary embodiment of the application provides Figure, as shown in fig. 7, the judgment means comprise determining that module 71 and abnormality detection module 72;
Determining module 71, for determining that the establishment moment of i+1 journal file, establishment moment are i+1 log text At the time of part is created, i >=0;
Determining module 71, be also used to determine i-th of journal file is ultimately written the moment, and be ultimately written is i-th constantly At the time of journal file is ultimately written log content, the wound of the establishment moment of i-th of journal file in i+1 journal file It builds before the moment;
Abnormality detection module 72 is write for the establishment moment when i+1 journal file in i-th of the last of journal file It when entering before the moment, determines that the rolling of journal file is abnormal, rolls and abnormal refers to that i-th of journal file and i+1 log are literary Part has log content to be written into and the exception that generates simultaneously.
In an alternative embodiment, determining module 71, comprising:
Submodule is monitored, for monitoring the document creation moment, the document creation moment is the log for being currently written into log content At the time of file is created;
Submodule is determined, for when monitoring that the document creation moment changes, by the document creation moment after variation Corresponding journal file is determined as i+1 journal file.
In an alternative embodiment, the document creation moment includes first second grade establishment moment, when grade creates within first second Quarter be with the second for minimum measurement unit at the time of;
It determines submodule, is also used to when monitoring that first second grade establishment moment becomes the second creation from the first establishment moment When quarter, the corresponding journal file of the second establishment moment is determined as i+1 journal file, wherein the first establishment moment and Two establishment moments be all with the second for minimum measurement unit at the time of.
In an alternative embodiment, the document creation moment includes that first second grade establishment moment and the first nanosecond create Moment, first second grade establishment moment be with the second for minimum measurement unit at the time of, the first nanosecond establishment moment is to be with nanosecond At the time of minimum measurement unit;
It determines submodule, is also used to when monitoring that grade establishment moment did not changed in first second, monitor the first nanosecond Whether establishment moment changes;When monitoring that the first nanosecond establishment moment becomes the 4th establishment moment from third establishment moment When, the corresponding journal file of the 4th establishment moment is determined as i+1 journal file, wherein third establishment moment and the 4th Establishment moment be all with nanosecond for minimum measurement unit at the time of.
In an alternative embodiment, the establishment moment of i+1 journal file includes second second grade establishment moment, the Being ultimately written for i journal file includes grade write-in moment second constantly, and second second grade establishment moment and grade write-in moment second be all At the time of with the second being minimum measurement unit;
Abnormality detection module 72 is also used to determine log when second second grade establishment moment is before grade write-in moment second File rolls abnormal.
In an alternative embodiment, the establishment moment of i+1 journal file include second second grade establishment moment and Second Millisecond establishment moment, i-th of being ultimately written for journal file includes when moment and Millisecond write-in is written the second grade constantly Carve, the second Millisecond establishment moment and Millisecond write-in moment be all with millisecond for minimum measurement unit at the time of;
Abnormality detection module 72 is also used to determine the when second second grade establishment moment be not before grade write-in moment second Whether two Millisecond establishment moments are before the moment is written in Millisecond;When the moment is written in Millisecond in the second Millisecond establishment moment When before, it is abnormal to determine that journal file rolls.
In an alternative embodiment, the establishment moment of i+1 journal file include second second grade establishment moment and Second nanosecond establishment moment, i-th of being ultimately written for journal file includes when moment and nanosecond write-in is written the second grade constantly Carve, the second nanosecond establishment moment and nanosecond write-in moment be all with nanosecond for minimum measurement unit at the time of;
Abnormality detection module 72 is also used to determine the when second second grade establishment moment be not before grade write-in moment second Whether two nanosecond establishment moments are before the moment is written in nanosecond;When the moment is written in nanosecond in the second nanosecond establishment moment When before, it is abnormal to determine that journal file rolls.
In conclusion the rolling abnormity judgement set of journal file provided in this embodiment, by obtaining the day first created The last modification moment of will file, and the establishment moment of journal file created afterwards, when the establishment moment is in the last modification When before the moment, then it represents that after the journal file created afterwards is created, log content also in the journal file that first creates of write-in, Namely indicate that two journal files exist while having the phenomenon that log content is written into, cause to roll exception, improve to rolling Move abnormal detection accuracy.
The rolling abnormity judgement set of journal file provided in this embodiment, by whether becoming to the document creation moment Change, so that it is determined that whether journal file rolls, when rolling, then explanation has journal file to be created, then new to this Whether the journal file that the journal file built is created with upper one, which occurs rolling exception, is detected, i.e., day provided in this embodiment The rolling abnormity judgement set of will file can in real time detect the rolling of journal file extremely, improve abnormal to rolling Timeliness.
The rolling abnormity judgement set of journal file provided in this embodiment passes through second grade, Millisecond and nanosecond three Kind rank, establishment moment and i-th of being ultimately written for journal file to i+1 journal file are compared constantly, more smart Really judge whether file rolls abnormal, and avoiding can not be detected due to rolling abnormal generate in lesser time precision Situation about coming.
Present invention also provides a kind of server, which includes processor and memory, be stored in memory to A few instruction, at least one instruction are loaded by processor and are executed literary with the log for realizing that above-mentioned each embodiment of the method provides The rolling abnormality judgment method of part.It should be noted that the server can be server provided by following Fig. 8.
Referring to FIG. 8, the structural schematic diagram of the server provided it illustrates one exemplary embodiment of the application.Specifically For: the server 800 includes central processing unit (CPU) 801 including random access memory (RAM) 802 and read-only deposits The system storage 804 of reservoir (ROM) 803, and the system bus of connection system storage 804 and central processing unit 801 805.The server 800 further includes the basic input/output that information is transmitted between each device helped in computer (I/O system) 806, and massive store for storage program area 813, application program 814 and other program modules 815 are set Standby 807.
The basic input/output 806 includes display 808 for showing information and inputs letter for user The input equipment 809 of such as mouse, keyboard etc of breath.Wherein the display 808 and input equipment 809 are all by being connected to The input and output controller 810 of system bus 805 is connected to central processing unit 801.The basic input/output 806 Can also include input and output controller 810 with for receive and handle from keyboard, mouse or electronic touch pen etc. it is multiple its The input of his equipment.Similarly, input and output controller 810 also provides output to display screen, printer or other kinds of defeated Equipment out.
The mass-memory unit 807 is by being connected to the bulk memory controller (not shown) of system bus 805 It is connected to central processing unit 801.The mass-memory unit 807 and its associated computer-readable medium are server 800 provide non-volatile memories.That is, the mass-memory unit 807 may include such as hard disk or CD-ROI The computer-readable medium (not shown) of driver etc.
Without loss of generality, the computer-readable medium may include computer storage media and communication media.Computer Storage medium includes information such as computer readable instructions, data structure, program module or other data for storage The volatile and non-volatile of any method or technique realization, removable and irremovable medium.Computer storage medium includes RAM, ROM, EPROM, EEPROM, flash memory or other solid-state storages its technologies, CD-ROM, DVD or other optical storages, tape Box, tape, disk storage or other magnetic storage devices.Certainly, skilled person will appreciate that the computer storage medium It is not limited to above-mentioned several.Above-mentioned system storage 804 and mass-memory unit 807 may be collectively referred to as memory.
Memory is stored with one or more programs, and one or more programs are configured to by one or more central processings Unit 801 executes, and one or more programs include the instruction of the rolling abnormality judgment method for realizing above-mentioned journal file, in The rolling that Central Processing Unit 801 executes the journal file that the one or more program realizes that above-mentioned each embodiment of the method provides is different Normal judgment method.
According to various embodiments of the present invention, the server 800 can also be arrived by network connections such as internets Remote computer operation on network.Namely server 800 can be by the network interface that is connected on the system bus 805 Unit 811 is connected to network 812, in other words, Network Interface Unit 811 also can be used be connected to other kinds of network or Remote computer system (not shown).
The memory further includes that one or more than one program, the one or more programs are stored in In memory, the one or more programs include the rolling for carrying out journal file provided in an embodiment of the present invention The step as performed by server in abnormality judgment method.
The embodiment of the present application also provides a kind of computer readable storage medium, and at least one finger is stored in the storage medium Enable, at least a Duan Chengxu, code set or instruction set, at least one instruction, an at least Duan Chengxu, the code set or Instruction set is loaded by the processor 810 and executed to be sentenced extremely with the rolling for realizing the journal file as described in Fig. 1 to Fig. 6 is any Disconnected method.
Present invention also provides a kind of computer program products to make when computer program product is run on computers Obtain the rolling abnormality judgment method that computer executes the journal file that above-mentioned each embodiment of the method provides.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely the preferred embodiments of the application, not to limit the application, it is all in spirit herein and Within principle, any modification, equivalent replacement, improvement and so on be should be included within the scope of protection of this application.

Claims (15)

1. a kind of rolling abnormality judgment method of journal file, which is characterized in that the described method includes:
Determine the establishment moment of i+1 journal file, the establishment moment be the i+1 journal file be created when It carves, i >=0;
Determine the moment that is ultimately written of i-th of journal file, described be ultimately written finally is write for i-th of journal file constantly At the time of entering log content, the establishment moment of i-th of journal file the i+1 journal file establishment moment it Before;
When the establishment moment of the i+1 journal file i-th of journal file be ultimately written the moment before when, really The rolling of the fixed journal file is abnormal, and the rolling refers to i-th of journal file and i+1 log text extremely Part has log content to be written into and the exception that generates simultaneously.
2. the method according to claim 1, wherein the establishment moment of the determining i+1 journal file, goes back Include:
The document creation moment is monitored, the document creation moment is to be currently written into the journal file of the log content to be created Moment;
When monitoring that the document creation moment changes, by the document creation moment corresponding log text after variation Part is determined as the i+1 journal file.
3. according to the method described in claim 2, it is characterized in that, when the document creation moment includes grade creation in first second Carve, first second grade establishment moment be with the second for minimum measurement unit at the time of;
It is described when monitoring that the document creation moment changes, by the corresponding day at the document creation moment after variation Will file is determined as the i+1 journal file, comprising:
When monitoring that first second grade establishment moment becomes the second establishment moment from the first establishment moment, described second is created It builds moment corresponding journal file and is determined as the i+1 journal file, wherein first establishment moment and described second Establishment moment be all with the second for minimum measurement unit at the time of.
4. according to the method described in claim 2, it is characterized in that, the document creation moment includes first second grade establishment moment With the first nanosecond establishment moment, first second grade establishment moment be with the second for minimum measurement unit at the time of, described first Nanosecond establishment moment be with nanosecond for minimum measurement unit at the time of;
It is described when monitoring that the document creation moment changes, by the corresponding day at the document creation moment after variation Will file is determined as the i+1 journal file, comprising:
When monitoring that grade establishment moment did not changed in described first second, monitor whether the first nanosecond establishment moment is sent out Changing;
When monitoring that the first nanosecond establishment moment becomes four establishment moments from third establishment moment, by the described 4th The corresponding journal file of establishment moment is determined as the i+1 journal file, wherein the third establishment moment and described Four establishment moments be all with nanosecond for minimum measurement unit at the time of.
5. method according to any one of claims 1 to 4, which is characterized in that the establishment moment of the i+1 journal file Including second second grade establishment moment, being ultimately written for i-th of journal file included that the moment is written the second grade constantly, and described second Second grade establishment moment and the grade write-in moment second be all with the second for minimum measurement unit at the time of;
The establishment moment when the i+1 journal file i-th of journal file be ultimately written the moment before When, determine that the rolling of journal file is abnormal, comprising:
When second second grade establishment moment is before the second grade write-in moment, it is abnormal to determine that the journal file rolls.
6. method according to any one of claims 1 to 4, which is characterized in that the establishment moment of the i+1 journal file Including second second grade establishment moment and the second Millisecond establishment moment, being ultimately written for i-th of journal file includes constantly Second grade write-in moment and Millisecond are written the moment, the second Millisecond establishment moment and Millisecond write-in moment be all with At the time of millisecond is minimum measurement unit;
The establishment moment when the i+1 journal file i-th of journal file be ultimately written the moment before When, determine that the rolling of journal file is abnormal, comprising:
When second second grade establishment moment be not before the second grade write-in moment, when determining second Millisecond creation It carves whether before the moment is written in the Millisecond;
When the second Millisecond establishment moment is before the moment is written in the Millisecond, it is different to determine that the journal file rolls Often.
7. method according to any one of claims 1 to 4, which is characterized in that the establishment moment of the i+1 journal file Including second second grade establishment moment and the second nanosecond establishment moment, being ultimately written for i-th of journal file includes constantly Second grade write-in moment and nanosecond are written the moment, the second nanosecond establishment moment and nanosecond write-in moment be all with At the time of nanosecond is minimum measurement unit;
The establishment moment when the i+1 journal file i-th of journal file be ultimately written the moment before When, determine that the rolling of journal file is abnormal, comprising:
When second second grade establishment moment be not before the second grade write-in moment, when determining second nanosecond creation It carves whether before the moment is written in the nanosecond;
When the second nanosecond establishment moment is before the moment is written in the nanosecond, it is different to determine that the journal file rolls Often.
8. a kind of rolling abnormity judgement set of journal file, which is characterized in that described device includes:
Determining module, for determining that the establishment moment of i+1 journal file, the establishment moment are the i+1 log At the time of file is created, i >=0;
The determining module, be also used to determine i-th of journal file is ultimately written the moment, and described be ultimately written is described constantly At the time of i-th of journal file is ultimately written log content, the establishment moment of i-th of journal file is in the i+1 Before the establishment moment of journal file;
Abnormality detection module, for the establishment moment when the i+1 journal file in the last of i-th of journal file When being written before the moment, determine that the rolling of the journal file is abnormal, rollings refer to extremely i-th of journal file with The i+1 journal file has log content to be written into and the exception that generates simultaneously.
9. device according to claim 8, which is characterized in that the determining module, comprising:
Submodule is monitored, for monitoring the document creation moment, the document creation moment is to be currently written into the log content At the time of journal file is created;
Submodule is determined, for when monitoring that the document creation moment changes, by the document creation after variation Moment corresponding journal file is determined as the i+1 journal file.
10. device according to claim 9, which is characterized in that when the document creation moment includes grade creation in first second Carve, first second grade establishment moment be with the second for minimum measurement unit at the time of;
The determining submodule is also used to monitor that first second grade establishment moment becomes the second wound from the first establishment moment When building the moment, the corresponding journal file of second establishment moment is determined as the i+1 journal file, wherein described First establishment moment and second establishment moment be all with the second for minimum measurement unit at the time of.
11. device according to claim 9, which is characterized in that when the document creation moment includes grade creation in first second Carve and the first nanosecond establishment moment, first second grade establishment moment be with the second for minimum measurement unit at the time of, described the One nanosecond establishment moment be with nanosecond for minimum measurement unit at the time of;
The determining submodule is also used to when monitoring that grade establishment moment did not changed in described first second, monitors described the Whether one nanosecond establishment moment changes;When monitoring that the first nanosecond establishment moment becomes from third establishment moment When four establishment moments, the corresponding journal file of the 4th establishment moment is determined as the i+1 journal file, In, the third establishment moment and the 4th establishment moment be all with nanosecond for minimum measurement unit at the time of.
12. according to any device of claim 8 to 11, which is characterized in that when the creation of the i+1 journal file Carving includes second second grade establishment moment, and being ultimately written for i-th of journal file includes grade write-in moment second constantly, and described the Two seconds grade establishment moments and the grade write-in moment second be all with the second for minimum measurement unit at the time of;
The abnormality detection module is also used to when second second grade establishment moment is before the second grade write-in moment, really The fixed journal file rolls abnormal.
13. according to any device of claim 8 to 11, which is characterized in that when the creation of the i+1 journal file Carving includes second second grade establishment moment and the second Millisecond establishment moment, and being ultimately written for i-th of journal file is wrapped constantly Include the second grade write-in moment and Millisecond write-in the moment, the second Millisecond establishment moment and the Millisecond write-in moment be all At the time of with millisecond being minimum measurement unit;
The abnormality detection module is also used to when second second grade establishment moment be not before the second grade write-in moment, Determine the second Millisecond establishment moment whether before the moment is written in the Millisecond;When second Millisecond creation When being engraved in front of the Millisecond write-in moment, it is abnormal to determine that the journal file rolls.
14. a kind of server, which is characterized in that the server includes processor and memory, is stored in the memory At least one instruction, at least a Duan Chengxu, code set or instruction set, at least one instruction, an at least Duan Chengxu, institute Code set or instruction set is stated to be loaded by the processor and executed to realize the journal file as described in claim 1 to 7 is any Rolling abnormality judgment method.
15. a kind of computer readable storage medium, which is characterized in that be stored at least one instruction, extremely in the storage medium A few Duan Chengxu, code set or instruction set, at least one instruction, an at least Duan Chengxu, the code set or instruction Collection is loaded by the processor and executed to be judged extremely with the rolling for realizing the journal file as described in claim 1 to 7 is any Method.
CN201810331868.8A 2018-04-13 2018-04-13 Method and device for judging rolling abnormality of log file and readable medium Active CN110309158B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810331868.8A CN110309158B (en) 2018-04-13 2018-04-13 Method and device for judging rolling abnormality of log file and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810331868.8A CN110309158B (en) 2018-04-13 2018-04-13 Method and device for judging rolling abnormality of log file and readable medium

Publications (2)

Publication Number Publication Date
CN110309158A true CN110309158A (en) 2019-10-08
CN110309158B CN110309158B (en) 2023-08-01

Family

ID=68073887

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810331868.8A Active CN110309158B (en) 2018-04-13 2018-04-13 Method and device for judging rolling abnormality of log file and readable medium

Country Status (1)

Country Link
CN (1) CN110309158B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103188282A (en) * 2011-12-27 2013-07-03 腾讯科技(北京)有限公司 Method, system and equipment for file synchronization
CN103226340A (en) * 2013-04-16 2013-07-31 深圳市汇川控制技术有限公司 Programmable logic controller and realization method
CN103645983A (en) * 2013-12-17 2014-03-19 山东中创软件工程股份有限公司 Method and device for generating journal file in domestic environment
CN103838624A (en) * 2013-12-16 2014-06-04 浪潮电子信息产业股份有限公司 Log processing method based on Linux message queue
US20160321145A1 (en) * 2015-04-28 2016-11-03 International Business Machines Corporation Database recovery and index rebuilds
CN106250424A (en) * 2016-07-22 2016-12-21 杭州朗和科技有限公司 The searching method of a kind of daily record context, Apparatus and system
CN106569936A (en) * 2016-09-26 2017-04-19 深圳盒子支付信息技术有限公司 Method and system for acquiring scrolling log in real time
CN107180060A (en) * 2016-03-11 2017-09-19 北京京东尚科信息技术有限公司 The output intent and daily record output device of log information
CN107368362A (en) * 2017-06-29 2017-11-21 上海阅文信息技术有限公司 A kind of multithreading/multi-process for disk read-write data is without lock processing method and system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103188282A (en) * 2011-12-27 2013-07-03 腾讯科技(北京)有限公司 Method, system and equipment for file synchronization
CN103226340A (en) * 2013-04-16 2013-07-31 深圳市汇川控制技术有限公司 Programmable logic controller and realization method
CN103838624A (en) * 2013-12-16 2014-06-04 浪潮电子信息产业股份有限公司 Log processing method based on Linux message queue
CN103645983A (en) * 2013-12-17 2014-03-19 山东中创软件工程股份有限公司 Method and device for generating journal file in domestic environment
US20160321145A1 (en) * 2015-04-28 2016-11-03 International Business Machines Corporation Database recovery and index rebuilds
CN107180060A (en) * 2016-03-11 2017-09-19 北京京东尚科信息技术有限公司 The output intent and daily record output device of log information
CN106250424A (en) * 2016-07-22 2016-12-21 杭州朗和科技有限公司 The searching method of a kind of daily record context, Apparatus and system
CN106569936A (en) * 2016-09-26 2017-04-19 深圳盒子支付信息技术有限公司 Method and system for acquiring scrolling log in real time
CN107368362A (en) * 2017-06-29 2017-11-21 上海阅文信息技术有限公司 A kind of multithreading/multi-process for disk read-write data is without lock processing method and system

Also Published As

Publication number Publication date
CN110309158B (en) 2023-08-01

Similar Documents

Publication Publication Date Title
US9354776B1 (en) Applied client-side service integrations in distributed web systems
US9483259B1 (en) System and method for providing real-time execution of source code in a collaborative online software development environment
CN103154893B (en) Multi-core processor system, supervision control method and supervisory control program
US20140028729A1 (en) Scalable zoom calendars
DE102006062802B4 (en) Information processing system and method for controlling multiple hot plug operations
US20200209838A1 (en) System and method for supporting production management
CN101425000A (en) A management method of performance history and a management system of performance history
CN106126410B (en) The reminding method and device of code conflicts
US10198370B2 (en) Memory distribution across multiple non-uniform memory access nodes
CN101694649A (en) Report generating system and method of cluster monitoring
CN101825987A (en) Chart display control unit and program
US20210089005A1 (en) Control device, control system, control method, and computer-readable storage medium
US9158614B2 (en) Service management device, display method, and information storage medium
US9690633B2 (en) Synchronization method
CN110007858A (en) Memory allocation method and device
CN109871368A (en) Database detection method, apparatus, computer installation and storage medium
CN103198071A (en) Data report generation method and device adopting same
US7823029B2 (en) Failure recognition, notification, and prevention for learning and self-healing capabilities in a monitored system
CN104919448A (en) Device, method and system for displaying digital editions
CN111858278A (en) Log analysis method and system based on big data processing and readable storage device
US9864637B2 (en) Adaptable software resource managers based on intentions
CN114003345A (en) Cloud-native-based Kubernetes platform health degree determination method and device
CN110309158A (en) Rolling abnormality judgment method, device and the readable medium of journal file
CN116521083A (en) Storage method, device and medium for distributed storage cluster data
CN105683942A (en) Event chain visualization of performance data

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
GR01 Patent grant
GR01 Patent grant