CN116756113A - Log recording method and device, electronic equipment and storage medium - Google Patents

Log recording method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116756113A
CN116756113A CN202310808976.0A CN202310808976A CN116756113A CN 116756113 A CN116756113 A CN 116756113A CN 202310808976 A CN202310808976 A CN 202310808976A CN 116756113 A CN116756113 A CN 116756113A
Authority
CN
China
Prior art keywords
log
log analysis
service node
service
matching
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
CN202310808976.0A
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.)
Beijing Renke Interactive Network Technology Co Ltd
Original Assignee
Beijing Renke Interactive Network 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 Beijing Renke Interactive Network Technology Co Ltd filed Critical Beijing Renke Interactive Network Technology Co Ltd
Priority to CN202310808976.0A priority Critical patent/CN116756113A/en
Publication of CN116756113A publication Critical patent/CN116756113A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/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/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • 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/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

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)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a log recording method, a log recording device, electronic equipment and a storage medium, and relates to the technical field of computers, wherein the log recording method comprises the following steps: acquiring log data of at least one first service node corresponding to a service, wherein the log data comprises at least one first parameter identifier; analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of the second service node; the target log analysis result and log data of each first service node are stored and recorded, so that the service problems can be rapidly positioned, the problem checking time is shortened, and the problem processing efficiency of developers is improved.

Description

Log recording method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a log recording method, a log recording device, an electronic device, and a storage medium.
Background
In the development process of the business system, a developer positions and checks the problems on the line in a log checking mode.
The traditional log processing method comprises log display and log statistics; the log display displays log information required by problem investigation to a developer, so that the developer can analyze and process the problem conveniently. For example, in each execution process of the service, the same link identifier (id) is allocated to the service, the log parameters of each service node also have the link id, and the log display page of the log displays the log of each service node of the service according to the link id. The log statistics is to collect log information of each service node by the system, analyze the collected log information, judge the stability of the system and provide various services by using the system. For example, the number of Error logs (Error) of a certain service is collected, and when the number of Error logs reaches a threshold value, the relevant developer is notified in the form of mail, telephone, or the like.
However, in the existing log processing method, the log analysis process of each service node in a specific service is omitted, so that the problem location of each service node still needs to be judged and processed by a developer according to the log printing condition of each service node, and the time cost of the developer for processing the problem is high and the efficiency is low.
Disclosure of Invention
The invention provides a log recording method, a log recording device, electronic equipment and a storage medium, which are used for solving the problems of high time cost and low efficiency of processing problems of developers in the prior art.
The invention provides a log recording method, which comprises the following steps:
acquiring log data of at least one first service node corresponding to a service, wherein the log data comprises at least one first parameter identifier;
analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of a second service node;
and storing and recording the target log analysis result and log data of each first service node.
According to the method for logging provided by the invention, the log data of each service node is analyzed based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result, which comprises the following steps:
sequentially matching each first parameter identifier with each pre-configured log analysis rule to obtain a target log analysis rule;
and determining the log analysis result in the target log analysis rule as the target log analysis result.
According to the log recording method provided by the invention, the matching of each first parameter identifier with each pre-configured log analysis rule sequentially to obtain a target log analysis rule comprises the following steps:
sequentially matching each first parameter identifier with each second parameter identifier in each log analysis rule to obtain at least one second parameter identifier successfully matched;
matching each second parameter identifier successfully matched with the matching condition;
and under the condition that the matching of the second parameter identifiers which are successfully matched with the matching conditions is successful, determining the log analysis rule corresponding to the matching conditions as the target log analysis rule.
According to the log recording method provided by the invention, the log analysis rule further comprises a post event script, and the post event script comprises a post event identifier and post event parameters.
According to the logging method provided by the invention, the method further comprises the following steps:
calling a post event corresponding to the post event identifier based on the target log analysis result; and the post event is used for processing the business problem corresponding to the target log analysis result.
According to the method for logging provided by the invention, the obtaining of log data of at least one first service node corresponding to a service includes:
pre-configuring at least one log storage rule;
and acquiring log data of each first service node corresponding to the service based on each log storage rule.
According to the method for logging provided by the invention, the log data of each first service node corresponding to the service is obtained based on each log storage rule, which comprises the following steps:
processing initial log data of each first service node corresponding to the service based on each log storage rule;
and storing the processed log data to obtain log data of each first service node.
The present invention also provides a log recording device, including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring log data of at least one first service node corresponding to a service, and the log data comprises at least one first parameter identifier;
the analysis module is used for analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of a second service node;
and the recording module is used for storing and recording the target log analysis result and log data of each first service node.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the logging method as described in any one of the above when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a logging method as described in any of the above.
According to the log recording method, the log recording device, the electronic equipment and the storage medium, log data of at least one first service node corresponding to a service are obtained, and the log data comprise at least one first parameter identifier; analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of the second service node; and storing and recording the target log analysis result and log data of each first service node. The method has the advantages that the log data of a plurality of service nodes are analyzed through the log analysis rule, the target log analysis result and the log data of the service nodes are stored and recorded, and the service problems can be rapidly positioned through the subsequent printing of the log data, so that the problem checking time is shortened, and the problem processing efficiency of developers is improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a logging method according to the present invention;
FIG. 2 is a second flowchart of a logging method according to the present invention;
FIG. 3 is a schematic diagram of a log recording apparatus according to the present invention;
fig. 4 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the development process of a business system, developers often locate and check problems on a line in a log checking mode. The following problems are encountered in this process:
problem one: if the service is complex, the developer needs to comprehensively analyze the logs printed by a plurality of service nodes, the number of the service nodes is too large, the time cost of the developer for processing the problems is increased, and the stability of the system is reduced.
And a second problem: in the development of a business system, different developers are responsible for different businesses. If the developer familiar with the current business, the common problems can be rapidly checked according to the printing condition of the log; if the problems are the same, the problems are handled by developers unfamiliar with the business, and a relatively large time cost is input to analyze the log and locate the problems.
Problem three: after the developer has checked out the corresponding problem from the log, some operations may also need to be performed manually to handle the problem, such as repairing the abnormal data, which also increases the time-consuming handling of the problem.
The invention provides a log recording method, which aims to standardize the function of analyzing log positioning problems by a developer and store an investigation result, a problem reason, a processing mode and the like in a log form. Thus, the method is convenient for developers to process the problem of complex business with a plurality of nodes, and is also convenient for the developers unfamiliar with the business to quickly learn the cause and the solution of the problem. Meanwhile, a post event is provided for the analyzed log, so that a developer can automatically process the business problem according to the corresponding content.
The journaling method of the present invention is described below with reference to fig. 1-2.
FIG. 1 is a schematic flow chart of a logging method according to the present invention, as shown in FIG. 1, the method includes steps 101-103; wherein, the liquid crystal display device comprises a liquid crystal display device,
step 101, obtaining log data of at least one first service node corresponding to a service, wherein the log data comprises at least one first parameter identifier.
It should be noted that, the logging method provided by the present invention is applicable to a scenario of service logging, and an execution subject of the method may be a logging device, for example, an electronic device, or a control module in the logging device for executing the logging method.
Specifically, a plurality of first service nodes exist in the service operation process, and each first service node is a key point triggered in the service operation process. For example, the first service NODE may be a method of joining (merhard_part) NODE, service NODE 1 (business_node_1), service NODE 2 (business_node_2), or service NODE 3 (business_node_3).
During operation of the service, each first service node generates log data, wherein the log data comprises at least one first parameter identifier, and the first parameter identifier is used for identifying the first parameter. For example, log data of the merhard_part node is expressed as method_part: the entry log $ { param1}, the entry log $ { param2}: param1: param2; the parameter identification method comprises the steps that parameter 1 and parameter 2 are first parameter identification, and parameter 1 is used for identifying a first parameter of a MERHOD_PARAM node; the log data of BUSINES_NODE_1 is denoted BUSINES_NODE_1: node 1 log $ { param1}, node 1 log $ { param2}, node 1 log $ { param3}: param1: param2: param3; the log data of BUSINES_NODE_2 is expressed as a NODE 2 log $ { param1}: param1; the log data of BUSINES_NODE_3 is expressed as NODE 3 log $ { param1}, NODE 3 log $ { param2}: param1: param2.
102, analyzing log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identification of a second service node.
Specifically, at least one log analysis rule is preconfigured using Java annotation technology; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result, wherein the matching item comprises at least one second parameter identifier of a second service node, the second service node is configured in the log analysis rule, the second parameter identifier is used for identifying a second parameter of the second service node, and the matching condition is used for representing the meeting condition of each matching item; the log analysis results meet the analysis results corresponding to the second service nodes of the matching conditions, and the log analysis results comprise at least one of the following: failure cause, failure record, and solution.
For example, in log analysis rule 1, match 1 is METHOD_PARAM.Param1 equal to 10001, match 2 is METHOD_PARAM.Param1 equal to 10002, match 3 is BUSINES_NODE_3.Param2 less than 2023-01, match 4 is BUSINES_NODE_3.Param2 greater than 2024-01-01; the matching conditions are (1 or 2) and (3 or 4), wherein 1 represents the matching item 1,2 represents the matching item 2,3 represents the matching item 3,4 represents the matching item 4; log analysis results (result): the reasons for failure are users with user id $ { METHOD_PARAM.Parama1 }, $ { METHOD_PARAM.Parama2 }, as special users, only data from 2023-01-01 to 2024-01-01 can be viewed, the reasons are recorded as follows: http:// abc.efg.com/reason/001.
The matching item 1 in the log analysis rule 2 is METHOD_PARAM.Param1 equal to 20001, and the matching item 2 is METHOD_PARAM.Param1 equal to 20002; matching conditions are (1 or 2), log analysis result (result): the failure causes that the user id is $ { method_param.param1}, the user of $ { method_param.param2}, is an abnormal user, and the user is not authorized to execute the operation.
According to each first parameter identifier and at least one pre-configured log analysis rule, each first parameter identifier and each log analysis rule are matched, and when the first parameter identifier and each log analysis rule are matched with the corresponding log analysis rule, the corresponding log analysis rule can be used for analyzing the log data of each service node, so that a target log analysis result is obtained.
And 103, storing and recording the target log analysis result and log data of each first service node.
Specifically, the target log analysis result is saved and recorded in a log form and log data of each first service node, and further log printing is performed on the log data after the log data are saved, so that a developer can conveniently and quickly find out and solve the problem.
According to the log recording method provided by the invention, log data of at least one first service node corresponding to a service is obtained, and the log data comprises at least one first parameter identifier; analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of the second service node; and storing and recording the target log analysis result and log data of each first service node. The method has the advantages that the log data of a plurality of service nodes are analyzed through the log analysis rule, the target log analysis result and the log data of the service nodes are stored and recorded, and the service problems can be rapidly positioned through the subsequent printing of the log data, so that the problem checking time is shortened, and the problem processing efficiency of developers is improved.
Optionally, the specific implementation manner of step 101 includes:
pre-configuring at least one log storage rule; and acquiring log data of each first service node corresponding to the service based on each log storage rule.
Specifically, at least one log storage rule is preconfigured by using a Java annotation technology, wherein the log storage rule indicates whether the log data needs to be stored, a storage mode, a warehousing mode and a storage time. And according to each log storage rule, summarizing log data of each first service node corresponding to the service by using a memory or a database, thereby obtaining the log data of each first service node corresponding to the service.
Optionally, the acquiring, based on each log storage rule, log data of each first service node corresponding to the service includes:
processing initial log data of each first service node corresponding to the service based on each log storage rule; and storing the processed log data to obtain log data of each first service node.
Specifically, based on each log storage rule, processing initial log data of a plurality of first service nodes corresponding to the service, for example, discarding or deleting initial log data which does not need to be stored, storing initial log data which needs to be stored, storing initial log data with relatively short storage time into a memory, and storing initial log data with relatively long storage time into a database, wherein the storage mode comprises a document storage mode or a database storage mode. The processed log data is stored, so that the log data of each first service node can be obtained, whether the log data need to be printed or not can be judged according to the log data of each first service node and the customized rule, and meanwhile, the obtained log data of each first service node can be used as basic data of log analysis.
Optionally, the specific implementation manner of step 102 includes:
sequentially matching each first parameter identifier with each pre-configured log analysis rule to obtain a target log analysis rule; and determining the log analysis result in the target log analysis rule as the target log analysis result.
Specifically, each first parameter identifier is matched with a plurality of log analysis rules which are configured in advance in sequence, so that a target log analysis rule which is successfully matched is obtained; and then the log analysis result in the target log analysis rule can be determined as the target log analysis result, so that the quick positioning of the service with longer link is realized, the problem is quickly positioned and a solution is provided by a developer according to the printed log data, and the time for checking the problem is shortened.
Optionally, the matching each first parameter identifier with each pre-configured log analysis rule sequentially to obtain a target log analysis rule includes:
(1) And matching each first parameter identifier with each second parameter identifier in each log analysis rule in sequence to obtain at least one second parameter identifier successfully matched.
Specifically, each first parameter identifier is matched with each second parameter identifier in each log analysis rule in sequence, so that at least one second parameter identifier which is successfully matched can be obtained.
For example, match method_param1 in log data of merhod_param NODE and method_param.param1 in matching item 1 in log analysis rule 1, method_param.param1 in matching item 2, bussiness_node_3 in matching item 3, -PARAM2, bussiness_node_3.param2 in matching item 4, and match method_param.param1 in matching item 1 and method_param.param1 in matching item 2 in log analysis rule 2 to obtain two methods_param.param.1 successfully matched with log analysis rule 1 and two methods_param.param.1 successfully matched with log analysis rule 2; and matching the param2 in the log data of the BUSINES_NODE_3 with the METHOD_PARAM.Parama1 in the matching item 1 in the log analysis rule 1, the METHOD_PARAM.Parama1 in the matching item 2, the BUSINES_NODE_3.Parama2 in the matching item 3, the BUSINES_NODE_3.Parama2 in the matching item 4, and the METHOD_Parama1 in the matching item 1 in the log analysis rule 2 and the METHOD_Paramam.Parama1 in the matching item 2 to obtain two BUSINES_NODE_3.Parama2 successfully matched with the log analysis rule 1 and unsuccessfully matched with the log analysis rule 2.
(2) And matching each second parameter identifier successfully matched with the matching condition.
Specifically, each second parameter identifier successfully matched with the matching condition is matched. For example, the matching conditions in the log analysis rule 1 are (1 or 2) and (3 or 4), the second parameters successfully matched with the log analysis rule 1 are identified as method_param. Param1 and business_node_3.param2, method_param. Param1 corresponds to the matching item 1 and the matching item 2, business_node_3.param2 corresponds to the matching item 3 and the matching item 4, and the matching conditions (1 or 2) and (3 or 4) are satisfied.
(3) And under the condition that the matching of the second parameter identifiers which are successfully matched with the matching conditions is successful, determining the log analysis rule corresponding to the matching conditions as the target log analysis rule.
Specifically, under the condition that each second parameter identifier successfully matched with the matching condition is successfully matched, determining a log analysis rule corresponding to the matching condition as a target log analysis rule, further taking a log analysis result in the target log analysis rule as a target log analysis result, and storing and recording the target log analysis result and log data, namely storing the target log analysis result and the corresponding log data together in a log form, so that a developer can conveniently and rapidly locate a service problem based on a printing log, and the efficiency of service problem processing is improved.
Optionally, the log analysis rule further includes a post-event script, the post-event script including a post-event identifier and post-event parameters.
Specifically, the log analysis rules also include a post event script (Post script event), represented as Post script event: dealREEOR USER: method_param1. The post event script includes a post event identifier (dead_reeor_user) and a post event parameter (method_param.param1), where the post event identifier is used to identify a post event, the post event may be customized by a developer, and the post event parameter represents a parameter of a METHOD corresponding to the post event identifier executed according to the post event identifier, and when the post event is executed, the corresponding METHOD needs to be invoked, for example, the METHOD is login, and the post event parameter is a USER name and an identity card number.
Optionally, calling a post event corresponding to the post event identifier based on the target log analysis result; and the post event is used for processing the business problem corresponding to the target log analysis result.
Specifically, according to the target log analysis result, the post event corresponding to the post event identifier can be called, and the post event is used for automatically processing the service problem corresponding to the target log analysis result, so that the stability of the service system is improved, and meanwhile, the cost of processing the problem by a developer can be reduced, so that the production efficiency is improved.
FIG. 2 is a second flowchart of the logging method according to the present invention, as shown in FIG. 2, the method includes steps 201-213; wherein, the liquid crystal display device comprises a liquid crystal display device,
the method starts in step 201. And calling the service method in the running process of the service code.
Step 202, it is determined whether to configure annotations for the service, i.e. the service system delegates processing of log data by way of the annotations. At least one log storage rule and a log storage rule, and parameters of the log storage rule and the log storage rule are preconfigured in the process of running the service. In the case that the annotation is not configured, go to step 203; in the case of configuration annotations, go to step 204.
Step 203, sequentially executing a plurality of first service nodes corresponding to the service, namely, a method entering node, a service node 1, a service node 2, a service node 3 to a service node N, and storing log data corresponding to each first service node.
Step 204, initializing a log storage module. The log storage module is initialized with parameters of the log storage rules.
Step 205, save the log data of the method entry node. According to the log storage rule, log data of the node entering the parameter is stored.
Step 206, log data of service node 1 is saved. According to the log storage rule, log data of the participating node and the service node 1 are stored.
Step 207, log data of the service node 2 is saved. According to the log storage rule, log data of the parameter entering node, the service node 1 and the service node 2 are stored.
Step 208, log data of the service node 3 is saved. According to the log storage rule, log data of the parameter entering node, the service node 1, the service node 2 and the service node 3 are stored.
Step 209, save the log data of the service node N. According to the log storage rule, sequentially storing the log data of the method access node, the service node 1, the service node 2 and the service node 3 until the service node N.
Step 210, log printing. And printing the saved log data.
Step 211, log data analysis. And transmitting the log data from the method joining node to the service node N to a log analysis module. When the log data from the method joining node to the service node N reaches the trigger log analysis condition, the log data from the method joining node to the service node N is transmitted to a log analysis module for analysis, and the log analysis module stores and records the log analysis result in the form of a log and the log data from the method joining node to the service node N.
Step 212, a post event is performed. And calling a post event in a post queue according to the log analysis result, and processing the service problem corresponding to the log analysis result.
Step 213, end.
The following describes a logging device provided by the present invention, and the logging device described below and the logging method described above may be referred to correspondingly to each other.
Fig. 3 is a schematic structural diagram of a logging device provided by the present invention, and as shown in fig. 3, the logging device 300 includes an obtaining module 301, an analyzing module 302, and a recording module 303; wherein, the liquid crystal display device comprises a liquid crystal display device,
an obtaining module 301, configured to obtain log data of at least one first service node corresponding to a service, where the log data includes at least one first parameter identifier;
the analysis module 302 is configured to analyze log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule, so as to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of a second service node;
and the recording module 303 is configured to store and record the target log analysis result and log data of each first service node.
The invention provides a log recording device, which is characterized in that log data of at least one first service node corresponding to a service are obtained, wherein the log data comprise at least one first parameter identifier; analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of the second service node; and storing and recording the target log analysis result and log data of each first service node. The method has the advantages that the log data of a plurality of service nodes are analyzed through the log analysis rule, the target log analysis result and the log data of the service nodes are stored and recorded, and the service problems can be rapidly positioned through the subsequent printing of the log data, so that the problem checking time is shortened, and the problem processing efficiency of developers is improved.
Optionally, the analysis module 302 is specifically configured to:
sequentially matching each first parameter identifier with each pre-configured log analysis rule to obtain a target log analysis rule;
and determining the log analysis result in the target log analysis rule as the target log analysis result.
Optionally, the analysis module 302 is specifically configured to:
sequentially matching each first parameter identifier with each second parameter identifier in each log analysis rule to obtain at least one second parameter identifier successfully matched;
matching each second parameter identifier successfully matched with the matching condition;
and under the condition that the matching of the second parameter identifiers which are successfully matched with the matching conditions is successful, determining the log analysis rule corresponding to the matching conditions as the target log analysis rule.
Optionally, the log analysis rule further includes a post-event script, the post-event script including a post-event identifier and post-event parameters.
Optionally, the logging device 300 further includes:
the calling module is used for calling the post event corresponding to the post event identifier based on the target log analysis result; and the post event is used for processing the business problem corresponding to the target log analysis result.
Optionally, the acquiring module 301 is specifically configured to:
pre-configuring at least one log storage rule;
and acquiring log data of each first service node corresponding to the service based on each log storage rule.
Optionally, the acquiring module 301 is specifically configured to:
processing initial log data of each first service node corresponding to the service based on each log storage rule;
and storing the processed log data to obtain log data of each first service node.
Fig. 4 is a schematic physical structure of an electronic device according to the present invention, as shown in fig. 4, the electronic device may include: processor 410, communication interface (Communications Interface) 420, memory 430 and communication bus 440, wherein processor 410, communication interface 420 and memory 430 communicate with each other via communication bus 440. Processor 410 may invoke logic instructions in memory 430 to perform a journaling method comprising: acquiring log data of at least one first service node corresponding to a service, wherein the log data comprises at least one first parameter identifier; analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of a second service node; and storing and recording the target log analysis result and log data of each first service node.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the logging method provided by the above methods, the method comprising: acquiring log data of at least one first service node corresponding to a service, wherein the log data comprises at least one first parameter identifier; analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of a second service node; and storing and recording the target log analysis result and log data of each first service node.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method of logging, comprising:
acquiring log data of at least one first service node corresponding to a service, wherein the log data comprises at least one first parameter identifier;
analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of a second service node;
and storing and recording the target log analysis result and log data of each first service node.
2. The logging method according to claim 1, wherein the analyzing log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result includes:
sequentially matching each first parameter identifier with each pre-configured log analysis rule to obtain a target log analysis rule;
and determining the log analysis result in the target log analysis rule as the target log analysis result.
3. The logging method according to claim 2, wherein the matching each of the first parameter identifiers with each of the pre-configured log analysis rules sequentially to obtain a target log analysis rule includes:
sequentially matching each first parameter identifier with each second parameter identifier in each log analysis rule to obtain at least one second parameter identifier successfully matched;
matching each second parameter identifier successfully matched with the matching condition;
and under the condition that the matching of the second parameter identifiers which are successfully matched with the matching conditions is successful, determining the log analysis rule corresponding to the matching conditions as the target log analysis rule.
4. A logging method according to any one of claims 1 to 3, wherein the logging rules further comprise a post event script comprising a post event identity and post event parameters.
5. The logging method of claim 4, further comprising:
calling a post event corresponding to the post event identifier based on the target log analysis result; and the post event is used for processing the business problem corresponding to the target log analysis result.
6. The method for logging according to claim 1, wherein the obtaining log data of at least one first service node corresponding to a service includes:
pre-configuring at least one log storage rule;
and acquiring log data of each first service node corresponding to the service based on each log storage rule.
7. The method of logging of claim 6, wherein the obtaining, based on each of the log storage rules, log data of each of the first service nodes corresponding to the service includes:
processing initial log data of each first service node corresponding to the service based on each log storage rule;
and storing the processed log data to obtain log data of each first service node.
8. A logging device, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring log data of at least one first service node corresponding to a service, and the log data comprises at least one first parameter identifier;
the analysis module is used for analyzing the log data of each service node based on each first parameter identifier and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule comprises at least one matching item, a matching condition and a log analysis result; the matching item comprises at least one second parameter identifier of a second service node;
and the recording module is used for storing and recording the target log analysis result and log data of each first service node.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the logging method of any one of claims 1 to 7 when the program is executed by the processor.
10. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the logging method according to any one of claims 1 to 7.
CN202310808976.0A 2023-07-04 2023-07-04 Log recording method and device, electronic equipment and storage medium Pending CN116756113A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310808976.0A CN116756113A (en) 2023-07-04 2023-07-04 Log recording method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310808976.0A CN116756113A (en) 2023-07-04 2023-07-04 Log recording method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116756113A true CN116756113A (en) 2023-09-15

Family

ID=87951284

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310808976.0A Pending CN116756113A (en) 2023-07-04 2023-07-04 Log recording method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116756113A (en)

Similar Documents

Publication Publication Date Title
CN111522922B (en) Log information query method and device, storage medium and computer equipment
CN111866016B (en) Log analysis method and system
CN114185708A (en) Data analysis method and device based on distributed link tracking and electronic equipment
US20220050765A1 (en) Method for processing logs in a computer system for events identified as abnormal and revealing solutions, electronic device, and cloud server
CN111552633A (en) Interface abnormal call testing method and device, computer equipment and storage medium
CN112039900B (en) Network security risk detection method, system, computer device and storage medium
CN110764980A (en) Log processing method and device
CN111198797B (en) Operation monitoring method and device and operation analysis method and device
US20180357143A1 (en) Testing computing devices
CN114528457A (en) Web fingerprint detection method and related equipment
CN110851324A (en) Log-based routing inspection processing method and device, electronic equipment and storage medium
CN116346456A (en) Business logic vulnerability attack detection model training method and device
CN108763916B (en) Service interface security assessment method and device
CN110888791A (en) Log processing method, device, equipment and storage medium
CN108650123B (en) Fault information recording method, device, equipment and storage medium
CN112347328A (en) Network platform identification method, device, equipment and readable storage medium
CN116756113A (en) Log recording method and device, electronic equipment and storage medium
CN115328734A (en) Cross-service log processing method and device and server
CN114675989A (en) Data verification method and device, electronic equipment and storage medium
CN107341086A (en) The monitoring method and system of operation condition of server
CN114371866A (en) Version reconfiguration test method, device and equipment of service system
CN112131091B (en) Test method and device and electronic equipment
CN113141366B (en) Message submitting method and device, storage medium and electronic equipment
CN115994098B (en) Analysis method and system for software operation abnormality based on artificial intelligence
CN116996205A (en) Monitoring method, system, equipment and storage medium for preventing webpage from being tampered

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