Log recording method and device, electronic equipment and storage medium
By acquiring and analyzing log data from business systems, and utilizing pre-configured log analysis rules and post-event scripts, the problem of high time costs for developers in handling log issues has been solved, enabling rapid location and automated processing, thereby improving efficiency and system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING RENKE INTERACTIVE NETWORK TECH CO LTD
- Filing Date
- 2023-07-04
- Publication Date
- 2026-06-19
AI Technical Summary
In existing technologies, developers face high time costs and low efficiency in handling log issues, especially in complex business systems where comprehensive analysis of log data from multiple business nodes is required, leading to reduced system stability.
By acquiring log data from business nodes, analyzing it based on pre-configured log analysis rules, generating target log analysis results, and saving them along with the log data, the system utilizes log analysis rules and post-event scripts to quickly locate and automate business issues.
It shortened the troubleshooting time, improved the efficiency of developers in handling problems, reduced time costs, and enhanced system stability.
Smart Images

Figure CN116756113B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a log recording method, apparatus, electronic device, and storage medium. Background Technology
[0002] During the development of business systems, developers locate and troubleshoot online issues by reviewing logs.
[0003] Traditional log processing methods include log display and log statistics. Log display presents the log information needed for troubleshooting to developers, facilitating analysis and problem resolution. For example, during each business process, a single link identifier (id) is assigned, and the log parameters of each business node also include this link ID. The log display page then shows the logs of each business node based on the link ID. Log statistics involve the system collecting and analyzing log information from each business node to assess system stability and provide various services. For example, it might collect the number of error log entries for a particular business process, and when the number reaches a threshold, notify relevant developers via email or telephone.
[0004] However, the existing log processing methods lack the process of analyzing the logs of each business node in a specific business transaction. This means that developers still need to judge and handle the problems of each business node based on the log printing of each business node, resulting in high time costs and low efficiency for developers to handle problems. Summary of the Invention
[0005] This invention provides a logging method, apparatus, electronic device, and storage medium to solve the problems of high time cost and low efficiency for developers in the prior art when dealing with problems.
[0006] This invention provides a log recording method, comprising:
[0007] Obtain log data of at least one first business node corresponding to the business, wherein the log data includes at least one first parameter identifier;
[0008] Based on each of the first parameter identifiers and at least one pre-configured log analysis rule, the log data of each of the business nodes is analyzed to obtain the target log analysis result; the log analysis rule includes at least one matching item, matching condition, and log analysis result; the matching item includes at least one second parameter identifier of the second business node;
[0009] The target log analysis results and the log data of each of the first business nodes are saved and recorded.
[0010] According to a log recording method provided by the present invention, the step of analyzing the log data of each of the business nodes based on each of the first parameter identifiers and at least one pre-configured log analysis rule to obtain the target log analysis result includes:
[0011] Each of the first parameter identifiers is sequentially matched with each of the pre-configured log analysis rules to obtain the target log analysis rule;
[0012] The log analysis results in the target log analysis rules are determined as the target log analysis results.
[0013] According to a log recording method provided by the present invention, the step of sequentially matching each of the first parameter identifiers with each of the pre-configured log analysis rules to obtain a target log analysis rule includes:
[0014] Each of the first parameter identifiers is matched sequentially with each of the second parameter identifiers in each log analysis rule to obtain at least one second parameter identifier that is successfully matched.
[0015] Match each of the successfully matched second parameter identifiers with the matching conditions;
[0016] If each of the second parameter identifiers and the matching conditions are successfully matched, the log analysis rule corresponding to the matching condition is determined as the target log analysis rule.
[0017] According to a log recording method provided by the present invention, the log analysis rules further include a post-event script, wherein the post-event script includes a post-event identifier and post-event parameters.
[0018] According to a log recording method provided by the present invention, the method further includes:
[0019] Based on the target log analysis results, the corresponding post-event is invoked; the post-event is used to process the business problem corresponding to the target log analysis results.
[0020] According to a log recording method provided by the present invention, obtaining log data of at least one first service node corresponding to a service includes:
[0021] At least one log storage rule should be pre-configured;
[0022] Based on the log storage rules, obtain the log data of each of the first service nodes corresponding to the service.
[0023] According to a log recording method provided by the present invention, the step of obtaining log data of each first service node corresponding to the service based on each of the log storage rules includes:
[0024] Based on the log storage rules, the initial log data of each of the first service nodes corresponding to the service is processed;
[0025] The processed log data is stored to obtain the log data of each of the first business nodes.
[0026] The present invention also provides a log recording device, comprising:
[0027] The acquisition module is used to acquire log data of at least one first business node corresponding to the business, wherein the log data includes at least one first parameter identifier;
[0028] An analysis module is used to analyze the log data of each of the business nodes based on each of the first parameter identifiers and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule includes at least one matching item, matching condition, and log analysis result; the matching item includes at least one second parameter identifier of the second business node;
[0029] The recording module is used to save and record the target log analysis results and the log data of each of the first business nodes.
[0030] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the logging method described above.
[0031] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the logging method as described above.
[0032] The log recording method, apparatus, electronic device, and storage medium provided by this invention acquire log data from at least one first business node corresponding to a business, the log data including at least one first parameter identifier; analyze the log data of each business 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 includes at least one matching item, matching condition, and log analysis result; the matching item includes at least one second parameter identifier of a second business node; and save and record the target log analysis result and the log data of each first business node. By using log analysis rules to analyze log data from multiple business nodes and saving and recording the target log analysis result and the log data of the business nodes, subsequent logging data printing enables rapid location of business problems, shortens troubleshooting time, and improves the efficiency of developers in handling problems. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0034] Figure 1 This is one of the flowcharts illustrating the log recording method provided by the present invention;
[0035] Figure 2 This is the second flowchart of the log recording method provided by the present invention;
[0036] Figure 3 This is a schematic diagram of the log recording device provided by the present invention;
[0037] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0039] During the development of business systems, developers often locate and troubleshoot online issues by reviewing logs. This process may encounter the following problems:
[0040] Question 1: If the business logic is complex, developers need to comprehensively analyze the logs printed by multiple business nodes. If there are too many business nodes, it will inevitably increase the time cost for developers to deal with problems and reduce the stability of the system.
[0041] Question 2: In business system development, different developers are responsible for different business functions. If a developer is familiar with the current business function, they can quickly troubleshoot some common problems based on the log output. However, if the same problem is handled by a developer who is not familiar with the business function, they will have to spend more time analyzing the logs and locating the problem.
[0042] Question 3: After developers identify the corresponding problem based on the logs, they may need to manually perform some operations to handle the problem, such as fixing abnormal data, which also increases the time spent handling the problem.
[0043] The logging method provided by this invention aims to standardize the function of developers analyzing logs to locate problems, and saves the investigation results, causes of problems, and handling methods in the form of logs. This facilitates developers in handling complex business problems with multiple nodes, and also allows developers unfamiliar with the business to quickly understand the causes of problems and solutions. Simultaneously, it provides post-events for the analyzed logs, allowing developers to automatically handle business problems based on the corresponding content.
[0044] The following is combined with Figures 1-2 The log recording method of the present invention is described.
[0045] Figure 1 This is one of the flowcharts illustrating the log recording method provided by the present invention, such as... Figure 1 As shown, the method includes steps 101-103; wherein,
[0046] Step 101: Obtain log data of at least one first business node corresponding to the business, wherein the log data includes at least one first parameter identifier.
[0047] It should be noted that the logging method provided by the present invention is applicable to scenarios of business log recording. The executing entity of the method can be a logging device, such as an electronic device, or a control module in the logging device for executing the logging method.
[0048] Specifically, there are multiple first business nodes during the business operation process, each of which is a key point triggered during the business operation. For example, the first business node can be a method input parameter (MERHOD_PARAM) node, business node 1 (BUSINESS_NODE_1), business node 2 (BUSINESS_NODE_2), or business node 3 (BUSINESS_NODE_3).
[0049] During business operations, each first business node generates log data. This log data includes at least one first parameter identifier, used to identify the first parameter. For example, the log data for the MERHOD_PARAM node is represented as METHOD_PARAM: Input Parameter Log ${param1}, Input Parameter Log ${param2}: param1: param2; where param1 and param2 are first parameter identifiers, with param1 identifying the first parameter of the MERHOD_PARAM node. The log data for BUSINESS_NODE_1 is represented as BUSINESS_NODE_1: Node 1 Log ${param1}, Node 1 Log ${param2}, Node 1 Log ${param3}: param1: param2: param3; the log data for BUSINESS_NODE_2 is represented as Node 2 Log ${param1}: param1; and the log data for BUSINESS_NODE_3 is represented as Node 3 Log ${param1}, Node 3 Log ${param2}: param1: param2.
[0050] Step 102: Based on each of the first parameter identifiers and at least one pre-configured log analysis rule, analyze the log data of each of the business nodes to obtain the target log analysis result; the log analysis rule includes at least one matching item, matching condition and log analysis result; the matching item includes at least one second parameter identifier of the second business node.
[0051] Specifically, using Java annotation technology, at least one log analysis rule is pre-configured. Each log analysis rule includes at least one matching item, matching conditions, and log analysis results. The matching item includes at least one second parameter identifier for a second business node, where the second business node is the business node configured in the log analysis rule. The second parameter identifier identifies the second parameter of the second business node. The matching conditions indicate the conditions under which each matching item is satisfied. The log analysis results correspond to the analysis results for each second business node that satisfies the matching conditions. The log analysis results include at least one of the following: failure reason, failure record, and solution.
[0052] For example, in log analysis rule 1, match item 1 is METHOD_PARAM.param1 equals 10001, match item 2 is METHOD_PARAM.param1 equals 10002, match item 3 is BUSINESS_NODE_3.param2 less than 2023-01-01, and match item 4 is BUSINESS_NODE_3.param2 greater than 2024-01-01; the matching conditions are (1 or 2) and (3 or 4), where 1 represents match item 1, 2 represents match item 2, 3 represents match item 3, and 4 represents match item 4; the log analysis result (result) is: the failure reason is that the users with user IDs ${METHOD_PARAM.param1} and ${METHOD_PARAM.param2} are special users and can only view data from 2023-01-01 to 2024-01-01. The reason is recorded as follows: http: / / abc.efg.com / reason / 001.
[0053] In log analysis rule 2, match item 1 is METHOD_PARAM.param1 equals 20001, and match item 2 is METHOD_PARAM.param1 equals 20002; the matching condition is (1 or 2). The log analysis result is: the reason for failure is that the users with user IDs ${METHOD_PARAM.param1} and ${METHOD_PARAM.param2} are abnormal users and do not have the right to execute this operation.
[0054] Based on each first parameter identifier and at least one pre-configured log analysis rule, each first parameter identifier and each log analysis rule are matched. When a matching log analysis rule is found, the log data of each business node can be analyzed using the corresponding log analysis rule to obtain the target log analysis result.
[0055] Step 103: Save and record the target log analysis results and the log data of each of the first business nodes.
[0056] Specifically, the target log analysis results are saved and recorded in the form of logs and log data of each first business node. Then, the saved log data is printed to facilitate developers to quickly find and solve problems.
[0057] The log recording method provided by this invention obtains log data from at least one first business node corresponding to a business, the log data including at least one first parameter identifier; analyzes the log data of each business 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 includes at least one matching item, matching condition, and log analysis result; the matching item includes at least one second parameter identifier of a second business node; and saves and records the target log analysis result and the log data of each first business node. By using log analysis rules to analyze log data from multiple business nodes and saving and recording the target log analysis result and the log data of the business nodes, subsequent logging data printing enables rapid location of business problems, shortens troubleshooting time, and improves the efficiency of developers in handling problems.
[0058] Optionally, the specific implementation of step 101 above includes:
[0059] At least one log storage rule is pre-configured; based on each log storage rule, log data of each of the first service nodes corresponding to the service is obtained.
[0060] Specifically, using Java annotation technology, at least one log storage rule is pre-configured. This rule specifies whether log data needs to be stored, the storage method, the method of insertion into the database, and the retention period. Based on each log storage rule, the log data of each first business node corresponding to the business is aggregated using either memory or a database, thereby obtaining the log data of each first business node corresponding to the business.
[0061] Optionally, obtaining the log data of each of the first service nodes corresponding to the service based on each of the log storage rules includes:
[0062] Based on the log storage rules, the initial log data of each of the first service nodes corresponding to the service is processed; the processed log data is stored to obtain the log data of each of the first service nodes.
[0063] Specifically, based on the log storage rules, the initial log data of multiple first business nodes corresponding to the business is processed. For example, initial log data that does not need to be stored is discarded or deleted, initial log data that needs to be stored is stored, initial log data with a short retention period is stored in memory, and initial log data with a long retention period is stored in the database. The storage method includes document storage or database storage. By storing the processed log data, the log data of each first business node can be obtained. Then, based on the log data of each first business node, it can be determined whether log data needs to be printed according to custom rules. At the same time, the obtained log data of each first business node can serve as the basic data for log analysis.
[0064] Optionally, the specific implementation of step 102 above includes:
[0065] Each of the first parameter identifiers is sequentially matched with each of the pre-configured log analysis rules to obtain the target log analysis rule; the log analysis result in the target log analysis rule is determined as the target log analysis result.
[0066] Specifically, each first parameter identifier is matched sequentially with multiple pre-configured log analysis rules to obtain the target log analysis rule that has been successfully matched; then the log analysis result in the target log analysis rule can be determined as the target log analysis result, thereby enabling rapid location of services with long links, and enabling developers to quickly locate problems and provide solutions based on the printed log data, thus shortening the time for troubleshooting.
[0067] Optionally, the step of sequentially matching each of the first parameter identifiers with each of the pre-configured log analysis rules to obtain the target log analysis rule includes:
[0068] (1) Match each of the first parameter identifiers with each of the second parameter identifiers in each log analysis rule in turn to obtain at least one second parameter identifier that is successfully matched.
[0069] Specifically, by matching each first parameter identifier with each second parameter identifier in each log analysis rule in turn, at least one second parameter identifier that is successfully matched can be obtained.
[0070] For example, matching the param1 in the log data of the MERHOD_PARAM node with METHOD_PARAM.param1 in match item 1, METHOD_PARAM.param1 in match item 2, BUSINESS_NODE_3.param2 in match item 3, and BUSINESS_NODE_3.param2 in match item 4 in log analysis rule 1, and matching it with METHOD_PARAM.param1 in match item 1 and METHOD_PARAM.param1 in match item 2 in log analysis rule 2, yields two METHOD_PARAM.param1 instances that successfully match log analysis rule 1 and two METHOD_PARAM.param1 instances that successfully match log analysis rule 2. AM.param1; then, the param2 in the log data of BUSINESS_NODE_3 is matched with METHOD_PARAM.param1 in matching item 1, METHOD_PARAM.param1 in matching item 2, BUSINESS_NODE_3.param2 in matching item 3, and BUSINESS_NODE_3.param2 in matching item 4 in log analysis rule 1, and also matched with METHOD_PARAM.param1 in matching item 1 and METHOD_PARAM.param1 in matching item 2 in log analysis rule 2. The results show two BUSINESS_NODE_3.param2 files that successfully match log analysis rule 1, but fail to match log analysis rule 2.
[0071] (2) Match each of the successfully matched second parameter identifiers with the matching conditions.
[0072] Specifically, the identifiers of the successfully matched second parameters are matched with the matching conditions. For example, the matching conditions in log analysis rule 1 are (1 or 2) and (3 or 4). The identifiers of the second parameters that successfully match log analysis rule 1 are METHOD_PARAM.param1 and BUSINESS_NODE_3.param2. METHOD_PARAM.param1 corresponds to match item 1 and match item 2, and BUSINESS_NODE_3.param2 corresponds to match item 3 and match item 4, satisfying the matching conditions (1 or 2) and (3 or 4).
[0073] (3) If the second parameter identifier and the matching condition are successfully matched, the log analysis rule corresponding to the matching condition is determined as the target log analysis rule.
[0074] Specifically, when the second parameter identifiers and matching conditions are successfully matched, the log analysis rule corresponding to the matching condition is determined as the target log analysis rule. Then, the log analysis result in the target log analysis rule can be used as the target log analysis result. The target log analysis result and log data are saved and recorded. That is, the target log analysis result is saved together with the corresponding log data in log form, which makes it easier for developers to quickly locate business problems based on the printed logs and improve the efficiency of business problem handling.
[0075] Optionally, the log analysis rules may further include a post-event script, which includes a post-event identifier and post-event parameters.
[0076] Specifically, log analysis rules also include post-script events, represented as `Post script event: DEAL_REEOR_USER: METHOD_PARAM.param1`. A post-script event includes a post-script identifier (`DEAL_REEOR_USER`) and post-script parameters (`METHOD_PARAM.param1`). The post-script identifier identifies the post-script event, which can be customized by developers. The post-script parameters represent the parameters for executing the method corresponding to the post-script identifier. Executing the post-script event requires calling the corresponding method; for example, if the method is "login", the post-script parameters would be the username and ID number.
[0077] Optionally, based on the target log analysis results, a post-event corresponding to the post-event identifier is invoked; the post-event is used to process the business problem corresponding to the target log analysis results.
[0078] Specifically, based on the target log analysis results, the corresponding post-event can be invoked to automatically handle business issues related to the target log analysis results, thereby improving the stability of the business system and reducing the cost for developers to handle issues, thus improving productivity.
[0079] Figure 2 This is the second flowchart illustrating the log recording method provided by the present invention, as follows: Figure 2 As shown, the method includes steps 201-213; wherein,
[0080] Step 201, Method Start. The business method is called during the execution of the business code.
[0081] Step 202: Determine if it is a business configuration annotation, meaning the business system delegates log data processing via annotations. During business operation, at least one log storage rule and its parameters are pre-configured. If no annotation is configured, proceed to step 203; if annotation is configured, proceed to step 204.
[0082] Step 203: Execute multiple first business nodes corresponding to the business in sequence, namely method input parameter node, business node 1, business node 2, business node 3 to business node N, and save the log data corresponding to each first business node.
[0083] Step 204: Initialize the log storage module. Initialize the log storage module using the parameters of the log storage rules.
[0084] Step 205: Save the log data of the method input parameter nodes. Store the log data of the method input parameter nodes according to the log storage rules.
[0085] Step 206: Save the log data of business node 1. According to the log storage rules, store the log data of the method input parameter node and business node 1.
[0086] Step 207: Save the log data of business node 2. According to the log storage rules, store the log data of the method input parameter node, business node 1, and business node 2.
[0087] Step 208: Save the log data of business node 3. According to the log storage rules, store the log data of the method input parameter node, business node 1, business node 2, and business node 3.
[0088] Step 209: Save the log data of business node N. According to the log storage rules, store the log data of the method input parameter node, business node 1, business node 2, business node 3, and so on, until the log data of business node N is stored.
[0089] Step 210, Log Printing. Print the saved log data.
[0090] Step 211, Log Data Analysis. The log data from the method input parameter node to business node N is transmitted to the log analysis module. When the log data from the method input parameter node to business node N reaches the condition for triggering log analysis, the log data from the method input parameter node to business node N is transmitted to the log analysis module for analysis. The log analysis module saves the log analysis results in log form along with the log data from the method input parameter node to business node N.
[0091] Step 212: Execute post-events. Based on the log analysis results, call the post-events in the post-queue to handle the business issues corresponding to the log analysis results.
[0092] Step 213, End.
[0093] The logging device provided by the present invention is described below. The logging device described below and the logging method described above can be referred to in correspondence.
[0094] Figure 3 This is a schematic diagram of the log recording device provided by the present invention, as shown below. Figure 3 As shown, the log recording device 300 includes an acquisition module 301, an analysis module 302, and a recording module 303; wherein,
[0095] The acquisition module 301 is used to acquire log data of at least one first business node corresponding to the business, wherein the log data includes at least one first parameter identifier;
[0096] Analysis module 302 is used to analyze the log data of each of the business nodes based on each of the first parameter identifiers and at least one pre-configured log analysis rule to obtain a target log analysis result; the log analysis rule includes at least one matching item, matching condition and log analysis result; the matching item includes at least one second parameter identifier of the second business node;
[0097] The recording module 303 is used to save and record the target log analysis results and the log data of each of the first business nodes.
[0098] The log recording device provided by this invention acquires log data from at least one first business node corresponding to a business, the log data including at least one first parameter identifier; analyzes the log data of each business 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 includes at least one matching item, matching condition, and log analysis result; the matching item includes at least one second parameter identifier of a second business node; and saves and records the target log analysis result and the log data of each first business node. By using log analysis rules to analyze log data from multiple business nodes and saving and recording the target log analysis result and the log data of the business nodes, subsequent logging data printing enables rapid location of business problems, shortens troubleshooting time, and improves the efficiency of developers in handling problems.
[0099] Optionally, the analysis module 302 is specifically used for:
[0100] Each of the first parameter identifiers is sequentially matched with each of the pre-configured log analysis rules to obtain the target log analysis rule;
[0101] The log analysis results in the target log analysis rules are determined as the target log analysis results.
[0102] Optionally, the analysis module 302 is specifically used for:
[0103] Each of the first parameter identifiers is matched sequentially with each of the second parameter identifiers in each log analysis rule to obtain at least one second parameter identifier that is successfully matched.
[0104] Match each of the successfully matched second parameter identifiers with the matching conditions;
[0105] If each of the second parameter identifiers and the matching conditions are successfully matched, the log analysis rule corresponding to the matching condition is determined as the target log analysis rule.
[0106] Optionally, the log analysis rules may further include a post-event script, which includes a post-event identifier and post-event parameters.
[0107] Optionally, the log recording device 300 further includes:
[0108] The calling module is used to call the post-event corresponding to the post-event identifier based on the target log analysis result; the post-event is used to process the business problem corresponding to the target log analysis result.
[0109] Optionally, the acquisition module 301 is specifically used for:
[0110] At least one log storage rule should be pre-configured;
[0111] Based on the log storage rules, obtain the log data of each of the first service nodes corresponding to the service.
[0112] Optionally, the acquisition module 301 is specifically used for:
[0113] Based on the log storage rules, the initial log data of each of the first service nodes corresponding to the service is processed;
[0114] The processed log data is stored to obtain the log data of each of the first business nodes.
[0115] Figure 4 This is a schematic diagram of the physical structure of an electronic device provided by the present invention, such as... Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a logging method. This method includes: acquiring log data of at least one first service node corresponding to a service, the log data including 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 including at least one matching item, matching condition, and log analysis result; the matching item including at least one second parameter identifier of a second service node; and saving and recording the target log analysis result and the log data of each first service node.
[0116] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0117] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the logging method provided by the above methods. The method includes: acquiring log data of at least one first service node corresponding to a service, the log data including 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 including at least one matching item, matching condition, and log analysis result; the matching item including at least one second parameter identifier of a second service node; and saving and recording the target log analysis result and the log data of each first service node.
[0118] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0119] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A log recording method, characterized in that, include: Obtain log data from multiple first business nodes corresponding to the business, wherein the log data includes multiple first parameter identifiers; Based on each of the first parameter identifiers and at least one pre-configured log analysis rule, the log data of each of the business nodes is analyzed to obtain the target log analysis result; the log analysis rule includes multiple matching items, matching conditions, and log analysis results; the matching items include multiple second parameter identifiers of the second business node; Matching conditions are used to indicate the conditions under which each matching item is satisfied; The log analysis results for each second business node that meet the matching conditions include the reasons for failure, failure records, and solutions. The target log analysis results are saved and recorded in the form of logs and log data of each of the first business nodes; The step of analyzing the log data of each of the business nodes based on each of the first parameter identifiers and at least one pre-configured log analysis rule to obtain the target log analysis result includes: Each of the first parameter identifiers is sequentially matched with each of the pre-configured log analysis rules to obtain the target log analysis rule; The log analysis results in the target log analysis rules are determined as the target log analysis results; The step of sequentially matching each of the first parameter identifiers with each of the pre-configured log analysis rules to obtain the target log analysis rule includes: Each of the first parameter identifiers is matched sequentially with each of the second parameter identifiers in each log analysis rule to obtain at least one second parameter identifier that is successfully matched. Match each of the successfully matched second parameter identifiers with the matching conditions; If each of the second parameter identifiers and the matching conditions are successfully matched, the log analysis rule corresponding to the matching condition is determined as the target log analysis rule.
2. The log recording method according to claim 1, characterized in that, The log analysis rules also include a post-event script, which includes a post-event identifier and post-event parameters.
3. The log recording method according to claim 2, characterized in that, The method further includes: Based on the target log analysis results, the corresponding post-event is invoked; the post-event is used to process the business problem corresponding to the target log analysis results.
4. The log recording method according to claim 1, characterized in that, The acquisition of log data from multiple first service nodes corresponding to the service includes: At least one log storage rule should be pre-configured; Based on the log storage rules, obtain the log data of each of the first service nodes corresponding to the service.
5. The log recording method according to claim 4, characterized in that, The step of obtaining log data for each of the first service nodes corresponding to the service based on the log storage rules includes: Based on the log storage rules, the initial log data of each of the first service nodes corresponding to the service is processed; The processed log data is stored to obtain the log data of each of the first business nodes.
6. A log recording device, characterized in that, include: The acquisition module is used to acquire log data of multiple first business nodes corresponding to the business, wherein the log data includes multiple first parameter identifiers; The analysis module is used to analyze the log data of each of the business nodes based on each of the first parameter identifiers and at least one pre-configured log analysis rule to obtain the target log analysis result; the log analysis rule includes multiple matching items, matching conditions and log analysis results; the matching items include multiple second parameter identifiers of the second business node; Matching conditions are used to indicate the conditions under which each matching item is satisfied; The log analysis results for each second business node that meet the matching conditions include the reasons for failure, failure records, and solutions. The recording module is used to save and record the target log analysis results in the form of logs and the log data of each of the first business nodes; The analysis module is specifically used for: Each of the first parameter identifiers is sequentially matched with each of the pre-configured log analysis rules to obtain the target log analysis rule; The log analysis results in the target log analysis rules are determined as the target log analysis results; The analysis module is also used for: Each of the first parameter identifiers is matched sequentially with each of the second parameter identifiers in each log analysis rule to obtain at least one second parameter identifier that is successfully matched. Match each of the successfully matched second parameter identifiers with the matching conditions; If each of the second parameter identifiers and the matching conditions are successfully matched, the log analysis rule corresponding to the matching condition is determined as the target log analysis rule.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the logging method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the logging method as described in any one of claims 1 to 5.