CN111190871A - Log generation method and device, computer equipment and storage medium - Google Patents

Log generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111190871A
CN111190871A CN201911308595.6A CN201911308595A CN111190871A CN 111190871 A CN111190871 A CN 111190871A CN 201911308595 A CN201911308595 A CN 201911308595A CN 111190871 A CN111190871 A CN 111190871A
Authority
CN
China
Prior art keywords
log
service
node
target
log file
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
CN201911308595.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.)
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou 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 China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201911308595.6A priority Critical patent/CN111190871A/en
Publication of CN111190871A publication Critical patent/CN111190871A/en
Pending legal-status Critical Current

Links

Images

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/069Management of faults, events, alarms or notifications using logs of notifications; Post-processing of notifications

Abstract

The embodiment of the invention discloses a log generation method, a log generation device, computer equipment and a storage medium, wherein the log generation method comprises the following steps: acquiring a log file generated by executing a target service, wherein the log file comprises at least one service log; identifying whether the log file comprises a preset target service log or not; and if the log file comprises the target service log, uploading the log file, otherwise, clearing the log file. Whether the log file is uploaded or not is determined by taking whether the log file contains the target service log as an uploading condition, only the log file containing the designated log is uploaded to be stored, and the rest logs are removed in time and are not stored, so that the handling capacity is improved, batch submission and batch processing are realized, the influence on user service processing is very small, and meanwhile, the log is selectively controlled by utilizing the uploading condition, the log quantity can be greatly reduced, and the log availability is improved.

Description

Log generation method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a log generation method and apparatus, a computer device, and a storage medium.
Background
The log system is used for recording various information such as state behavior and the like during system operation, and can be used for monitoring the system operation state, quickly positioning online problems, discovering system bottlenecks, early warning system potential risks, mining the maximum value of products and optimizing the system behavior according to the information. By content, log systems can be divided into two categories: one is a log of the business level, which the primary user analyzes the business process; the other is system level logging, which is mainly used to maintain the stability of the system. The working process of the existing log system mainly comprises the steps of acquiring information related to nodes at specific nodes to generate log information in a certain format, then temporarily storing local log files according to log control rules, and uploading the log files to a log server at intervals of a certain time period for log management and analysis. Because the data output quantity of the log system is relatively large, the influence of the log system on the performance of the whole system is very important.
The inventor finds that at least the following problems exist in the prior art: when the log is analyzed and used and the problem is solved, most of the situations only interest abnormal log information, so that the mass log information becomes redundant in the situation, the log information cannot be used by the user, the difficulty of information retrieval of log readers is increased, and the system burden is caused.
Disclosure of Invention
The embodiment of the invention aims to provide a log generation method, a log generation device, computer equipment and a storage medium, so that the log quantity is effectively reduced, and the log availability is improved.
In order to solve the above technical problem, an embodiment of the present invention provides a log generation method, including:
acquiring a log file generated by executing a target service, wherein the log file comprises at least one service log;
identifying whether the log file comprises a preset target service log or not;
and if the log file comprises the target service log, uploading the log file, otherwise, clearing the log file.
Optionally, the target service includes at least one service node, each service node is provided with a service log, and before acquiring a log file generated by executing the target service, the method includes:
acquiring node information of a service node;
identifying whether the service node is a preset first target node or not based on a preset node classification rule and the node information;
when the service node is the first target node, identifying whether the level of the service log corresponding to the service node belongs to a preset target log level;
and when the level of the service log belongs to the target log level, writing the service log into the log file.
Optionally, the service node includes a second target node, and after the node information of the service node is obtained, the method includes:
identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
when the service node is the second target node, identifying whether the execution result of the service node is correct;
and when the execution result of the service node is wrong, writing the service log into the log file.
Optionally, the service node includes a second target node, and after the node information of the service node is obtained, the method includes:
identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
when the service node is the second target node, identifying whether the target service is executed;
and when the node task of the service node is not completed, writing the service log into the log file.
Optionally, the service node includes a second target node, and after the node information of the service node is obtained, the method includes:
identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
when the service node is the second target node, identifying whether the target service is executed;
and when the target service is not executed, writing the service log into the log file.
Optionally, after the obtaining the log file generated by executing the target service, the method includes:
acquiring the data capacity of the log file;
comparing the data capacity with a preset capacity threshold;
and when the data capacity is greater than or equal to the capacity threshold value, identifying whether the log file comprises a preset target service log.
Optionally, if the log file includes the target service log, after uploading the log file, the method includes:
and clearing the log file.
An embodiment of the present invention further provides a log generating apparatus, including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a log file generated by executing a target service, and the log file comprises at least one service log;
the processing module is used for identifying whether the log file comprises a preset target service log or not;
and the execution module is used for uploading the log file if the log file comprises the target service log, and clearing the log file if the log file does not comprise the target service log.
The embodiment of the invention also provides a computer device, which comprises a memory and a processor, wherein the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the log generation method.
The embodiment mode of the invention provides a storage medium which stores computer readable instructions, and the computer readable instructions when executed by one or more processors cause the one or more processors to execute the log generation method.
Compared with the prior art, the method and the device have the advantages that whether the log file is uploaded or not is determined by judging whether the log file contains the target service log or not as the uploading condition, only the log file containing the specified log is uploaded to be stored, and the rest logs are cleared in time and are not stored any more, so that the throughput is improved, batch submission and batch processing are realized, the influence on user service processing is very small, and meanwhile, the log is selectively controlled by utilizing the uploading condition, so that the log quantity can be greatly reduced, and the log availability is improved.
In addition, the target service includes at least one service node, each service node is provided with a service log, and before the log file generated by executing the target service is acquired, the method includes: acquiring node information of a service node; identifying whether the service node is a preset first target node or not based on a preset node classification rule and the node information; when the service node is the first target node, identifying whether the level of the service log corresponding to the service node belongs to a preset target log level; and when the level of the service log belongs to the target log level, writing the service log into the log file. The node type is determined through the node information, when the node is a common node, whether the corresponding service log is written into the log file or not is determined according to the log level, the service log can be screened by taking the log level as a condition, and only the important service log is written into the log file, so that the number of logs is effectively reduced.
In addition, the service node includes a second target node, and after the node information of the service node is obtained, the method includes: identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information; when the service node is the second target node, identifying whether the execution result of the service node is correct; and when the execution result of the service node is wrong, writing the service log into the log file. Whether the service logs are written into the log file or not is determined through the execution result of the node, the logs can be screened, and normally executed logs are small in management meaning, so that the logs are written into the log file only when the result is wrong, the written logs are abnormal logs, and the usability of the logs is improved.
In addition, after the log file generated by executing the target service is acquired, the method includes: acquiring the data capacity of the log file; comparing the data capacity with a preset capacity threshold; and when the data capacity is greater than or equal to the capacity threshold value, identifying whether the log file comprises a preset target service log. By setting the capacity threshold, whether the log is uploaded or not is judged when the data volume of the log file exceeds the threshold, the log file can be saved or cleaned in time, and the storage space required by log caching is reduced.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
FIG. 1 is a schematic diagram of a basic flow of a log generation method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart illustrating a process of writing a log according to a log level according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a process of writing a log according to an execution result of a node according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a process of determining whether a service task is completed according to an embodiment of the present invention;
fig. 5 is a schematic flow chart illustrating a process when a service node executes a correct result according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating a process of determining the volume of a log file according to an embodiment of the present invention;
FIG. 7 is a block diagram of a basic structure of a log generating apparatus according to an embodiment of the present invention;
FIG. 8 is a block diagram of the basic structure of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention.
In some of the flows described in the present specification and claims and in the above figures, a number of operations are included that occur in a particular order, but it should be clearly understood that these operations may be performed out of order or in parallel as they occur herein, with the order of the operations being indicated as 101, 102, etc. merely to distinguish between the various operations, and the order of the operations by themselves does not represent any order of performance. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without any inventive step, are within the scope of the present invention.
As will be appreciated by those skilled in the art, "terminal" as used herein includes both devices that are wireless signal receivers, devices that have only wireless signal receivers without transmit capability, and devices that include receive and transmit hardware, devices that have receive and transmit hardware capable of performing two-way communication over a two-way communication link. Such a device may include: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (personal communications service), which may combine voice, data processing, facsimile and/or data communications capabilities; a PDA (personal digital assistant), which may include a radio frequency receiver, a pager, internet/intranet access, web browser, notepad, calendar and/or GPS (global positioning system) receiver; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver. As used herein, a "terminal" or "terminal device" may be portable, transportable, installed in a vehicle (aeronautical, maritime, and/or land-based), or situated and/or configured to operate locally and/or in a distributed fashion at any other location(s) on earth and/or in space. As used herein, a "terminal device" may also be a communication terminal, a web terminal, a music/video playing terminal, such as a PDA, an MID (mobile internet device), and/or a mobile phone with music/video playing function, and may also be a smart tv, a set-top box, and the like.
Specifically, referring to fig. 1, fig. 1 is a basic flow diagram of the log generating method according to the embodiment.
As shown in fig. 1, a log generation method includes:
s1100, acquiring a log file generated by executing a target service, wherein the log file comprises at least one service log;
in the system, a service is divided into at least one service node, corresponding service logs are generated when each service node of a target service is executed, and a log file is used for recording the service logs of all nodes in the target service. In the process of executing the service, when the service log is written into the log file or the capacity of the log file exceeds a certain threshold, the log file is acquired to judge whether to upload the log file, and in some embodiments, the log file is acquired once every corresponding time interval by setting a certain time interval.
S1200, identifying whether the log file comprises a preset target service log or not;
the system is provided with an uploading condition which is used for judging whether the content of the cache region needs to be uploaded to the server, and the uploading condition can be used for judging whether the log file contains the specified type of service log. The specified type of service log, i.e. the target service log, is usually set as an exception log, including but not limited to a node result error, a service execution failure, or a log at a specified level, and the type of the target log file may be adjusted according to different actual application scenarios, which is not limited herein. For example, in the system, the service log is divided into multiple levels, such as VERBOSE, DEBUG, INFO, WARN, ERROR, and false, the target service log may be set as a service log of the false level, and when the log file is obtained, whether the log file contains a false-level service log is identified.
In some embodiments, the target traffic log may be various, for example, three types of traffic logs, such as a node result error, a traffic execution failure, or a log of a specified level, are used as the target traffic log.
S1300, if the log file comprises the target service log, uploading the log file, otherwise, clearing the log file;
when the log file contains the target service log, the log is uploaded to be stored for a long time, if the log file does not contain the target service log, the reference value of the content of the log file is not high, and the log file is cleared in time. In some embodiments, a corresponding cache region is set in the system and used for storing a log file corresponding to a service and a service log not written in the log file, when the log file does not include a target service log, the content temporarily stored in the cache region is removed, a plurality of cache regions may be set, and are respectively stored according to service types, or the cache region may be separately divided for each service.
As shown in fig. 2, S1100 further includes:
s1010, acquiring node information of a service node;
the execution process of the service is abstracted into the ordered execution of a plurality of key nodes, the target service comprises at least one service node, and each service node is correspondingly provided with a service log. When a target service executes a certain node, obtaining node information of the node, where the node information may include, but is not limited to, a service ID, a node name, a node type, a node information parameter, and the like, where the service ID is used to distinguish a specific service, so as to process a service log for the specific service; the node Id and the node name are used for distinguishing nodes in specific services; the node type is used for distinguishing whether the node has final decision right on the log cached by the service; the node information parameter is used for recording the operation state and relevant information of the current node.
S1020, identifying whether the service node is a preset first target node or not based on a preset node classification rule and the node information;
the service nodes of the target service are divided according to the node classification rules, the service nodes can be divided into common nodes and end nodes, the common nodes are process nodes of service processing, the end nodes are end points of service flow, the service is executed downwards from the initial nodes, when the service is executed to one or more appointed nodes, the service is ended, the Type of the appointed node or nodes is an end node (TE), and the Type of the node of other nodes is a common node (TC). After executing the common node, the target service continues to execute the next node according to the flow rule of the node, and the type of the node is recorded in the node information.
S1030, when the service node is the first target node, identifying whether the level of the service log corresponding to the service node belongs to a preset target log level;
the method comprises the steps of dividing the logs into a plurality of levels for representing the importance degree of the logs, setting some levels as target log levels according to actual application requirements, and indicating that the logs at the levels have higher reference and storage values. For example, the service log is divided into multiple levels such as VERBOSE, DEBUG, INFO, WARN, ERROR, FATAL, etc., and the target log level may be set to FATAL level. When the service node is a common node, it indicates that the service has not been executed, the flow needs to be switched to the next node for continuing, a node log corresponding to the service node is obtained, and whether the level of the service log is the target log level is identified. In some embodiments, the target log level is associated with the target traffic log, e.g., the traffic log of the target log level is taken as the target traffic log.
S1040, when the level of the service log belongs to the target log level, writing the service log into the log file;
when the service log belongs to the target log level, the log indicating the level has higher reference and storage values, and the service log is written into a log file.
The node type is determined through the node information, when the node is a common node, whether the corresponding service log is written into the log file or not is determined according to the log level, the service log can be screened by taking the log level as a condition, and only the important service log is written into the log file, so that the number of logs is effectively reduced.
As shown in fig. 3, S1010 further includes:
s1011, identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
the service nodes of the target service are divided according to the node classification rules, the service nodes can be divided into common nodes and end nodes, the common nodes are process nodes of service processing, the end nodes are end points of service flow, the service is executed downwards from the initial nodes, when the service is executed to one or more appointed nodes, the service is ended, the Type of the appointed node or nodes is an end node (TE), and the Type of the node of other nodes is a common node (TC). After executing the common node, the target service continues to execute the next node according to the flow rule of the node, the type of the node is recorded in the node information, in this embodiment, the end node is used as the second target node, and after the node information is obtained, whether the service node is the end node is identified according to the node information.
S1012, when the service node is the second target node, identifying whether an execution result of the service node is correct;
when the service node belongs to the end node, the service is executed and ended, the execution result of the node is recorded in the service log, and whether the execution result of the service node is correct or not is identified according to the service log. The judgment condition for whether the execution result is correct may be set according to the requirement of the actual application scenario, for example, the result type or the result data value is used as the judgment condition, and is not limited herein.
S1013, when the execution result of the service node is wrong, writing the service log into the log file;
whether the service logs are written into the log file or not is determined through the execution result of the node, the logs can be screened, and normally executed logs are small in management meaning, so that the logs are written into the log file only when the result is wrong, the written logs are abnormal logs, and the usability of the logs is improved.
As shown in fig. 4, S1010 further includes:
s1014, identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
the service nodes of the target service are divided according to the node classification rules, the service nodes can be divided into common nodes and end nodes, the common nodes are process nodes of service processing, the end nodes are end points of service flow, the service is executed downwards from the initial nodes, when the service is executed to one or more appointed nodes, the service is ended, the Type of the appointed node or nodes is an end node (TE), and the Type of the node of other nodes is a common node (TC). After executing the common node, the target service continues to execute the next node according to the flow rule of the node, the type of the node is recorded in the node information, in this embodiment, the end node is used as the second target node, and after the node information is obtained, whether the service node is the end node is identified according to the node information.
S1015, when the service node is the second target node, identifying whether the target service is executed;
the execution state of the content of the corresponding node is recorded in each service log, and after the target node is determined to be the end node, whether the service node is executed or not can be judged according to the service log. For example, when all processes and tasks of the service node have been executed, it is determined that the target service has been executed.
S1016, when the node task of the service node is not completed, writing the service log into the log file;
and when the service node is determined to be not executed completely through the service log, for example, one step is not executed, the service log is an abnormal log, and the service log is written into a log file.
According to the judgment condition that whether the node task is completely executed or not is used as whether the service log is written into the log file or not, the normally executed service log does not have referential property, and only the service log which is not completely executed is written into the log file for storage, so that logs stored in the log file are all abnormal logs, and the number of the stored logs is effectively reduced.
As shown in fig. 5, S1012 is followed by:
s1017, identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
the service nodes of the target service are divided according to the node classification rules, the service nodes can be divided into common nodes and end nodes, the common nodes are process nodes of service processing, the end nodes are end points of service flow, the service is executed downwards from the initial nodes, when the service is executed to one or more appointed nodes, the service is ended, the Type of the appointed node or nodes is an end node (TE), and the Type of the node of other nodes is a common node (TC). After executing the common node, the target service continues to execute the next node according to the flow rule of the node, the type of the node is recorded in the node information, in this embodiment, the end node is used as the second target node, and after the node information is obtained, whether the service node is the end node is identified according to the node information.
S1018, when the service node is the second target node, identifying whether the target service is executed;
the execution state of the target service at the corresponding node is recorded in each service log, and when the target node is determined to be the end node, whether the target service is executed or not can be judged according to the service logs. For example, when all the processes in all the nodes of the target service are successfully executed, it is determined that the target service is completely executed.
S1019, when the target service is not executed, writing the service log into the log file;
when the target service is not executed completely, for example, a certain step of one of all nodes executed by the target service is not executed, determining that the target service is not executed completely, and writing all service logs corresponding to the target service into a log file.
Whether the target service is executed or not is used as a judgment condition whether the service log is written into the log file or not, and the service log is written into the log file when the target service is not executed, so that logs stored in the log file are all abnormal logs, and the number of the stored logs is effectively reduced.
As shown in fig. 6, S1100 further includes:
s1110, acquiring the data capacity of the log file;
by setting certain monitoring conditions, the data capacity of the log file is acquired when the monitoring conditions are met. The monitoring condition may be set according to the requirement of the actual application scenario, for example, when the service log is written into the log file, or at regular time intervals, which is not limited herein.
S1120, comparing the data capacity with a preset capacity threshold;
the system is preset with a capacity threshold value used for limiting the temporary storage amount of the log file, and after the data capacity of the log file is obtained, the data capacity is compared with the capacity threshold value.
S1130, when the data capacity is larger than or equal to the capacity threshold value, whether a preset target service log is included in the log file is identified;
when the data capacity is larger than or equal to the capacity threshold value, the log file is larger, and whether the log file contains the target service log is judged at the moment.
In some embodiments, the service logs which are not uploaded and not written in the log file are temporarily stored in the buffer area, when the service logs are generated in the service process, the service logs can be temporarily stored in the buffer area for further processing, and when the service logs are judged to be necessary to be stored for a long time, the service logs are written in the log file. The plurality of cache regions may be configured to cache service logs and log files of different service types according to service partitions, and when the capacity of the cache region reaches a certain capacity threshold (e.g., 80%), identify whether the log file stored in the cache region includes a target service log.
By setting the capacity threshold, whether the log is uploaded or not is judged when the data volume of the log file exceeds the threshold, the log file can be saved or cleaned in time, and the storage space required by log caching is reduced.
In some embodiments, S1300 is followed by:
s1400, clearing the log file;
and after the log file is uploaded, clearing the locally temporarily stored log file.
In other embodiments, the service logs of the log file that are not uploaded and the service logs of the log file that are not written are temporarily stored in the cache region, a plurality of cache regions may be provided for caching the service logs and the log files of different service types according to the service partition, and after the log files are uploaded, the content of the cache region corresponding to the target service is removed.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
The embodiment of the invention also provides a log generation device. Referring to fig. 7, fig. 7 is a block diagram of a basic structure of the log generating apparatus according to the present embodiment.
As shown in fig. 7, the log generating apparatus includes: an acquisition module 2100, a processing module 2200, and an execution module 2300. The acquisition module is used for acquiring a log file generated by executing a target service, wherein the log file comprises at least one service log; the processing module is used for identifying whether the log file comprises a preset target service log or not; and the execution module is used for uploading the log file if the log file comprises the target service log, and clearing the log file if the log file does not comprise the target service log.
Whether the log file is uploaded or not is determined by taking whether the log file contains the target service log as an uploading condition, only the log file containing the designated log is uploaded to be stored, and the rest logs are removed in time and are not stored, so that the handling capacity is improved, batch submission and batch processing are realized, the influence on user service processing is very small, and meanwhile, the log is selectively controlled by utilizing the uploading condition, the log quantity can be greatly reduced, and the log availability is improved.
In some embodiments, the log generating means further comprises: the device comprises a first obtaining submodule, a first identification submodule, a second identification submodule and a first execution submodule. The first obtaining submodule is used for obtaining node information of the service node; the first identification submodule is used for identifying whether the service node is a preset first target node or not based on a preset node classification rule and the node information; the second identification submodule is used for identifying whether the grade of the service log corresponding to the service node belongs to a preset target log grade or not when the service node is the first target node; and the first execution submodule is used for writing the service log into the log file when the level of the service log belongs to the target log level.
In some embodiments, the log generating means further comprises: a third identification submodule, a fourth identification submodule and a second execution submodule. The third identification submodule is used for identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information; the fourth identification submodule is used for identifying whether the execution result of the service node is correct or not when the service node is the second target node; and the second execution submodule is used for writing the service log into the log file when the execution result of the service node is wrong.
In some embodiments, the log generating means further comprises: a fifth identification submodule, a sixth identification submodule and a third execution submodule. The fifth identification submodule is used for identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information; the sixth identification submodule is used for identifying whether the target service is executed or not when the service node is the second target node; and the third execution submodule is used for writing the service log into the log file when the node task of the service node is not completely executed.
In some embodiments, the log generating means further comprises: a seventh identification submodule, a fourth execution submodule and a fifth execution submodule. The seventh identification submodule is used for identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information; the fourth execution submodule is used for identifying whether the target service is executed or not when the service node is the second target node; and the fifth execution submodule is used for writing the service log into the log file when the target service is not executed completely.
In some embodiments, the log generating means further comprises: the second acquisition submodule, the first comparison submodule and the fifth execution submodule. The second obtaining submodule is used for obtaining the data capacity of the log file; the first comparison submodule is used for comparing the data capacity with a preset capacity threshold; and the fifth execution submodule is used for identifying whether the log file comprises a preset target service log or not when the data capacity is greater than or equal to the capacity threshold.
In some embodiments, the log generating means further comprises: a first purge submodule. The first clearing submodule is used for clearing the log file.
The embodiment of the invention also provides computer equipment. Referring to fig. 8, fig. 8 is a block diagram of a basic structure of a computer device according to the present embodiment.
As shown in fig. 8, the internal structure of the computer device is schematically illustrated. As shown in fig. 8, the computer apparatus includes a processor, a nonvolatile storage medium, a memory, and a network interface connected through a system bus. The non-volatile storage medium of the computer device stores an operating system, a database and computer readable instructions, the database can store control information sequences, and the computer readable instructions can enable the processor to realize a log generation method when being executed by the processor. The processor of the computer device is used for providing calculation and control capability and supporting the operation of the whole computer device. The memory of the computer device may have stored therein computer readable instructions that, when executed by the processor, may cause the processor to perform a method of log generation. The network interface of the computer device is used for connecting and communicating with the terminal. It will be appreciated by those skilled in the art that the configurations shown in the figures are block diagrams of only some of the configurations relevant to the present application, and do not constitute a limitation on the computing devices to which the present application may be applied, and that a particular computing device may include more or less components than those shown in the figures, or may combine certain components, or have a different arrangement of components.
In this embodiment, the processor is configured to execute specific functions of the obtaining module 2100, the processing module 2200, and the executing module 2300 in fig. 7, and the memory stores program codes and various data required for executing the modules. The network interface is used for data transmission to and from a user terminal or a server. The memory in the present embodiment stores program codes and data necessary for executing all the submodules in the log generating device, and the server can call the program codes and data of the server to execute the functions of all the submodules.
Embodiments of the present invention also provide a storage medium storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the log generation method according to any one of the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-only memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of log generation, comprising:
acquiring a log file generated by executing a target service, wherein the log file comprises at least one service log;
identifying whether the log file comprises a preset target service log or not;
and if the log file comprises the target service log, uploading the log file, otherwise, clearing the log file.
2. The method for generating logs according to claim 1, wherein the target service includes at least one service node, each service node is provided with a service log, and before the log file generated by the target service is acquired, the method includes:
acquiring node information of a service node;
identifying whether the service node is a preset first target node or not based on a preset node classification rule and the node information;
when the service node is the first target node, identifying whether the level of the service log corresponding to the service node belongs to a preset target log level;
and when the level of the service log belongs to the target log level, writing the service log into the log file.
3. The log generating method as claimed in claim 2, wherein the service node includes a second target node, and after obtaining the node information of the service node, the method comprises:
identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
when the service node is the second target node, identifying whether the execution result of the service node is correct;
and when the execution result of the service node is wrong, writing the service log into the log file.
4. The log generating method as claimed in claim 2, wherein the service node includes a second target node, and after obtaining the node information of the service node, the method comprises:
identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
when the service node is the second target node, identifying whether the target service is executed;
and when the node task of the service node is not completed, writing the service log into the log file.
5. The log generating method as claimed in claim 2, wherein the service node includes a second target node, and after obtaining the node information of the service node, the method comprises:
identifying whether the service node is a preset second target node or not based on a preset node classification rule and the node information;
when the service node is the second target node, identifying whether the target service is executed;
and when the target service is not executed, writing the service log into the log file.
6. The log generating method of claim 1, wherein after obtaining the log file for performing the target service generation, comprising:
acquiring the data capacity of the log file;
comparing the data capacity with a preset capacity threshold;
and when the data capacity is greater than or equal to the capacity threshold value, identifying whether the log file comprises a preset target service log.
7. The log generating method according to claim 1, wherein, if the log file includes the target service log, after uploading the log file, the method includes:
and clearing the log file.
8. A log generating apparatus, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a log file generated by executing a target service, and the log file comprises at least one service log;
the processing module is used for identifying whether the log file comprises a preset target service log or not;
and the execution module is used for uploading the log file if the log file comprises the target service log, and clearing the log file if the log file does not comprise the target service log.
9. A computer device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the log generation method of any of the preceding claims 1-7.
10. A non-transitory computer readable storage medium having instructions which, when executed by a processor of a mobile terminal, enable the mobile terminal to perform a log generation method, the method comprising the log generation method of any of claims 1 to 7 above.
CN201911308595.6A 2019-12-18 2019-12-18 Log generation method and device, computer equipment and storage medium Pending CN111190871A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911308595.6A CN111190871A (en) 2019-12-18 2019-12-18 Log generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911308595.6A CN111190871A (en) 2019-12-18 2019-12-18 Log generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111190871A true CN111190871A (en) 2020-05-22

Family

ID=70710978

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911308595.6A Pending CN111190871A (en) 2019-12-18 2019-12-18 Log generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111190871A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111835562A (en) * 2020-07-01 2020-10-27 北京爱笔科技有限公司 Log uploading method, log query method and log query system
CN113055459A (en) * 2021-03-09 2021-06-29 北京奇艺世纪科技有限公司 Log delivery method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016187967A1 (en) * 2015-05-28 2016-12-01 中兴通讯股份有限公司 Method and apparatus for realizing log transmission
CN106296400A (en) * 2016-08-10 2017-01-04 中国农业银行股份有限公司 A kind of method and system of log recording
CN107171825A (en) * 2017-04-11 2017-09-15 捷开通讯(深圳)有限公司 A kind of repetition daily record filter method of terminal
CN109325010A (en) * 2018-09-26 2019-02-12 中国平安人寿保险股份有限公司 Log inspection method, device, computer equipment and storage medium
CN110046073A (en) * 2019-03-29 2019-07-23 厦门网宿有限公司 A kind of log collection method and device, equipment, storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016187967A1 (en) * 2015-05-28 2016-12-01 中兴通讯股份有限公司 Method and apparatus for realizing log transmission
CN106296400A (en) * 2016-08-10 2017-01-04 中国农业银行股份有限公司 A kind of method and system of log recording
CN107171825A (en) * 2017-04-11 2017-09-15 捷开通讯(深圳)有限公司 A kind of repetition daily record filter method of terminal
CN109325010A (en) * 2018-09-26 2019-02-12 中国平安人寿保险股份有限公司 Log inspection method, device, computer equipment and storage medium
CN110046073A (en) * 2019-03-29 2019-07-23 厦门网宿有限公司 A kind of log collection method and device, equipment, storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111835562A (en) * 2020-07-01 2020-10-27 北京爱笔科技有限公司 Log uploading method, log query method and log query system
CN111835562B (en) * 2020-07-01 2023-10-17 北京爱笔科技有限公司 Log uploading method, log inquiring method and system
CN113055459A (en) * 2021-03-09 2021-06-29 北京奇艺世纪科技有限公司 Log delivery method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111190871A (en) Log generation method and device, computer equipment and storage medium
CN111951972A (en) Medical record grouping method and device, computer equipment and storage medium
CN111507479B (en) Feature binning method, device, equipment and computer-readable storage medium
CN111385122A (en) Distributed system link tracking method and device, computer equipment and storage medium
CN111125059A (en) Data migration method and device, storage medium and server
CN112311902B (en) File sending method and device based on micro-service
CN111552669A (en) Data processing method and device, computing equipment and storage medium
US20110154292A1 (en) Structure based testing
CN110609761B (en) Method and device for determining fault source, storage medium and electronic equipment
CN105074669A (en) Method and system for analyzing a trace timeline of computer system activity
CN110019168B (en) File merging method and system
CN115442262B (en) Resource evaluation method and device, electronic equipment and storage medium
CN111190896A (en) Data processing method, data processing device, storage medium and computer equipment
EP4060435A1 (en) Method and system for infrastructure monitoring
US20150088958A1 (en) Information Processing System and Distributed Processing Method
CN111125161B (en) Method, device, equipment and storage medium for processing data in real time
EP3076302A1 (en) Information collection system, server, edge device, control method, and program
CN112818204A (en) Service processing method, device, equipment and storage medium
CN112488625A (en) Returned piece identification method, returned piece identification device, returned piece identification equipment and storage medium
CN113010310A (en) Job data processing method and device and server
CN110908599A (en) Data writing method and system
CN113093702B (en) Fault data prediction method and device, electronic equipment and storage medium
CN113419992B (en) File clearing configuration page display method and device, electronic equipment and medium
CN112559641B (en) Pull chain table processing method and device, readable storage medium and electronic equipment
CN114092102A (en) Transaction payment confirmation method and device, computer equipment and storage medium

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