Log collection method and device based on distributed system call chain link and medium

By constructing a log collection context and cross-node log data transmission in a distributed system, the problem of scattered log data in a distributed system is solved, and global log data collection and problem localization of the call chain are realized.

CN115495426BActive Publication Date: 2026-04-14INSPUR GENERSOFT CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-29
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In distributed systems, the inability to locate all log data of business functions in a timely manner makes it impossible to collect log operation status in the call chain in a timely manner, making it difficult to determine the cause of the problem.

Method used

By generating log collection contexts, including log collection IDs and log data IDs, in distributed nodes, passing log collection contexts across nodes, and constructing a log record tree, cross-node log data collection and correlation are achieved.

Benefits of technology

It enables the collection of global log data for distributed system call chains, which can promptly locate the original location of problems and facilitate analysis by operations and maintenance personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115495426B_ABST
    Figure CN115495426B_ABST
Patent Text Reader

Abstract

The application discloses a log collection method and device based on a distributed system call link and a medium. The method comprises the following steps: in a first distributed node, receiving a log collection request of a user for a business function, and generating a first log collection context; the first log collection context comprises a first log collection ID and a first log data ID; generating first log data according to the first log collection context; determining to call a second distributed node, and generating a cross-node log collection context according to the first log collection context; the cross-node log collection context comprises the first log collection ID and the first log data ID; encapsulating the cross-node log collection context into a call request, and sending the encapsulated call request to the second distributed node; in the second distributed node, generating a second log collection context by analyzing the encapsulated call request; and generating second log data according to the second log collection context. All log data of the business function can be located in time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a log collection method, device and medium based on a distributed system call chain. Background Technology

[0002] A distributed system is a system composed of multiple nodes. These nodes are computer servers, and they are generally not isolated but interconnected. From the user's perspective, a distributed system presents a single server providing the services they need. However, these services are actually provided by a distributed system comprised of numerous underlying servers, making a distributed system resemble a supercomputer.

[0003] Currently, in a distributed architecture, an application is split and deployed across different network locations in a certain way, and a complete business function request often spans multiple different modules on multiple distributed nodes. Therefore, the call chain of the same business function is usually scattered across various distributed nodes, and the logs recorded during business function processing are also scattered in different places.

[0004] However, since the application logs seen in a distributed node can only reflect part of the operation of the business function, it is impossible to locate all the log data of the business function in a timely manner. Especially when the business function has a problem, it is difficult to collect the log operation status in the call chain in a timely manner because it is impossible to locate the original location of the problem and clarify the cause of the problem. Summary of the Invention

[0005] This application provides a log collection method, device, and medium based on a distributed system call chain to solve the problem of not being able to locate all log data of business functions in a timely manner.

[0006] The embodiments of this application adopt the following technical solutions:

[0007] On one hand, this application provides a log collection method based on a distributed system call chain. The method includes: in a first distributed node, receiving a user's log collection request for a business function and generating a first log collection context; the first log collection context includes a first log collection ID and a first log data ID; the first log collection ID represents the ID of the call chain corresponding to the log collection request; the first log data ID represents the ID of the latest log data collected by the first distributed node, and is empty by default; when recording the first log, generating first log data according to the first log collection context and sending the first log data to the log data center; determining to call a second distributed node, and generating a cross-node call chain according to the first log collection context. A node log collection context; the cross-node log collection context includes the first log collection ID and the first log data ID; the cross-node log collection context is encapsulated into the call request, and the encapsulated call request is sent to the second distributed node; in the second distributed node, a second log collection context is generated by parsing the encapsulated call request; the second collection context includes a second log collection ID and a second log data ID; the second log collection ID is used to represent the ID of the call chain; the second log data ID represents the ID of the latest log data collected by the second distributed node; when recording the second log, the second log data is generated according to the second log collection context, and the second log data is sent to the log data center.

[0008] In one example, the step of generating first log data based on the first log collection context when recording the first log specifically includes: determining the first log data ID in the first log collection context when recording the current first log; incrementing the value of the first log data ID by 1 to generate a third log data ID; determining the first log text and the first timestamp of the first log; generating the current first log data based on the log collection ID, the identification information of the first distributed node, the third log data ID, the first log text, and the first timestamp; and updating the first log data ID based on the third log data ID to generate the next first log data based on the updated first log collection context.

[0009] In one example, generating a second log collection context by parsing the encapsulated call request specifically includes: determining that the encapsulated call request includes the cross-node log collection context by parsing the encapsulated call request; using the value of the first log collection ID in the cross-node log collection context as the value of the second log collection ID; using the value of the first log data ID in the cross-node log collection context as the value of the second log data ID; and generating the second log collection context based on the second log collection ID and the second log data ID.

[0010] In one example, the step of generating second log data based on the second log collection context when recording the second log specifically includes: determining the second log data ID in the second log collection context when recording the current second log; incrementing the value of the second log data ID by 1 to generate a fourth log data ID; determining the second log text and the second timestamp of the second log; generating the current second log data based on the second log collection ID, the identification information of the second distributed node, the fourth log data ID, the second log text, and the second timestamp; and updating the second log data ID based on the fourth log data ID to generate the next second log data based on the updated second log collection context.

[0011] In one example, after sending the second log data to the log data center, the method further includes: in the log data center, determining, based on the third log data ID and the fourth log data ID, that the first log data and the second log data originate from the same call chain; generating a log record tree for the business function based on the first log data and the second log data; and generating a query interface for the log record tree of the business function to display the log record tree of the business function when a query request is received.

[0012] In one example, after sending the second log data to the log data center, the method further includes: receiving third log data uploaded by the first distributed node in the log data center; the third log data and the first log data are from different call chains; generating a log record tree for the first distributed node based on the first log data and the third log data; and generating a query interface for the log record tree of the first distributed node to display the log record tree of the first distributed node when a query request is received.

[0013] In one example, encapsulating the cross-node log collection context into the invocation request specifically includes: determining the request type of the invocation request; searching the request type in a preset database to match the attachment method of the cross-node log collection context; and encapsulating the cross-node log collection context into the invocation request according to the attachment method.

[0014] In one example, the step of generating first log data based on the first log collection context when recording the first log specifically includes: determining whether a logging point is embedded in the application's logging component; if so, generating first log data based on the first log collection context when recording the first log.

[0015] On the other hand, this application provides a log collection device based on a distributed system call chain, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: receive a user's log collection request for a business function in a first distributed node, and generate a first log collection context; the first log collection context includes a first log collection ID and a first log data ID; the first log collection ID is used to represent the ID of the call chain corresponding to the log collection request; the first log data ID is used to represent the ID of the latest log data collected by the first distributed node, and is empty by default; when recording the first log, generate first log data according to the first log collection context, and record the first log data. Log data is sent to the log data center; a second distributed node is determined to be invoked, and a cross-node log collection context is generated based on the first log collection context; the cross-node log collection context includes the first log collection ID and the first log data ID; the cross-node log collection context is encapsulated into the invocation request, and the encapsulated invocation request is sent to the second distributed node; in the second distributed node, a second log collection context is generated by parsing the encapsulated invocation request; the second collection context includes a second log collection ID and a second log data ID; the second log collection ID is used to represent the ID of the invocation chain; the second log data ID represents the ID of the latest log data collected by the second distributed node; when recording the second log, second log data is generated based on the second log collection context, and the second log data is sent to the log data center.

[0016] On the other hand, embodiments of this application provide a non-volatile computer storage medium for log collection based on a distributed system call chain, storing computer-executable instructions. These computer-executable instructions are configured to: in a first distributed node, receive a user's log collection request for a business function and generate a first log collection context; the first log collection context includes a first log collection ID and a first log data ID; the first log collection ID represents the ID of the call chain corresponding to the log collection request; the first log data ID represents the ID of the latest log data collected by the first distributed node, and is empty by default; when recording the first log, generate first log data according to the first log collection context and send the first log data to the log data center; determine to call a second distributed node, based on... A cross-node log collection context is generated based on the first log collection context; the cross-node log collection context includes the first log collection ID and the first log data ID; the cross-node log collection context is encapsulated into the call request, and the encapsulated call request is sent to the second distributed node; in the second distributed node, a second log collection context is generated by parsing the encapsulated call request; the second collection context includes a second log collection ID and a second log data ID; the second log collection ID is used to represent the ID of the call chain; the second log data ID represents the ID of the latest log data collected by the second distributed node; when recording the second log, second log data is generated based on the second log collection context, and the second log data is sent to the log data center.

[0017] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects:

[0018] By constructing a first log collection context corresponding to the log collection request of the first distributed node, the system can collect the first log data of the call chain corresponding to the log collection request. By generating a second log collection context of the second distributed node based on the first log collection context, the system can collect the second log data of the call chain. Thus, for the same business function, the system can promptly locate all log data of the call chain. When a problem occurs in the business function, it is convenient for operation and maintenance personnel to analyze the log data in a timely manner and locate the original location of the problem. Attached Figure Description

[0019] To more clearly illustrate the technical solution of this application, some embodiments of this application will be described in detail below with reference to the accompanying drawings, in which:

[0020] Figure 1 A flowchart illustrating a log collection method based on a distributed system call chain provided in this application embodiment;

[0021] Figure 2 This is a schematic diagram of the structure of a log collection device based on a distributed system call chain, provided in an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] Some embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0024] Figure 1 This document provides a flowchart illustrating a distributed system call chain method as an embodiment of this application. This method can be applied to various business domains, such as internet finance, e-commerce, instant messaging, gaming, and government services. Certain input parameters or intermediate results in the process can be manually adjusted to improve accuracy.

[0025] The analysis method involved in the embodiments of this application can be implemented by a terminal device or a server of a distributed system. The distributed system includes a first distributed node, a second distributed node, a log data center, etc. For ease of understanding and description, the following embodiments will be described in detail using the first distributed node, the second distributed node, and the log data center as examples.

[0026] Figure 1 The process may include the following steps:

[0027] S102: In the first distributed node, receive the user's log collection request for business functions and generate the first log collection context.

[0028] The first log collection context includes a first log collection ID and a first log data ID. The first log collection ID represents the ID of the call chain corresponding to the log collection request and is globally unique. The first log data ID represents the ID of the latest log data collected by the first distributed node and is empty by default. That is, since no first log data has been generated when the first log collection context is first constructed, the first log data ID in the first log collection context is empty by default, meaning its initial value is 0.

[0029] In other words, after a user initiates a call to a business function, the first distributed node will receive the user's call request. It should be noted that if the first distributed node starts a background task, it will automatically generate the first log collection context.

[0030] By setting the first log collection context using the first log collection ID and the first log data ID, the call chain of the first log data can be identified.

[0031] S104: When recording the first log, generate the first log data according to the first log collection context, and send the first log data to the log data center.

[0032] In some embodiments of this application, the first distributed node generates logs when completing business functions. When recording logs, the first distributed node determines whether a logging point is embedded in the application's logging component. If so, step S104 is executed.

[0033] If not, feedback is sent to the management user terminal so that the management user can subsequently add tracking points to the logging component. In other words, only by adding tracking points to the logging component in the application can the first log data be generated when the first log is recorded, and a new first log data record be generated for each first log entry.

[0034] Specifically, when recording the current first log, the first log data ID in the first log collection context is determined.

[0035] Then, the value of the first log data ID is incremented by 1 to generate the third log data ID, thus determining the first log text and the first timestamp of the first log.

[0036] Then, based on the log collection ID, the identifier information of the first distributed node, the third log data ID, the first log text, and the first timestamp, the current first log data is generated.

[0037] Finally, the first log data ID is updated based on the third log data ID, so that the next first log data can be generated based on the updated first log collection context.

[0038] S106: Determine to call the second distributed node, and generate a cross-node log collection context based on the first log collection context.

[0039] The cross-node log collection context includes the first log collection ID and the first log data ID.

[0040] It should be noted that when the first distributed node needs to call the function of the second distributed node to perform business functions, the second distributed node will be called. For example, the second distributed node is a sub-function of the business function.

[0041] S108: Encapsulate the cross-node log collection context into the call request, and send the encapsulated call request to the second distributed node.

[0042] In some embodiments of this application, the request type of the invocation request will be determined. A search is performed in a pre-defined database to match the appending method of the cross-node log collection context. Then, based on the appending method, the cross-node log collection context is encapsulated into the invocation request. For example, for HTTP requests, the appending method is used.

[0043] S110: In the second distributed node, a second log collection context is generated by parsing the encapsulated call request.

[0044] The second collection context includes a second log collection ID and a second log data ID. The second log collection ID represents the ID of the call chain. The second log data ID represents the ID of the latest log data collected by the second distributed node.

[0045] In some embodiments of this application, by parsing the encapsulated call request, it is determined that the encapsulated call request includes a cross-node log collection context.

[0046] Then, the value of the first log collection ID in the cross-node log collection context is used as the value of the second log collection ID.

[0047] Then, the value of the first log data ID in the cross-node log collection context is used as the value of the second log data ID.

[0048] Finally, a second log collection context is generated based on the second log collection ID and the second log data ID.

[0049] As can be seen, by using the value of the first log collection ID in the cross-node log collection context as the value of the second log collection ID, it is possible to quickly identify that the first log data and the second log data belong to the same call chain.

[0050] S112: When recording the second log, generate second log data according to the second log collection context, and send the second log data to the log data center.

[0051] In some embodiments of this application, the second distributed node generates logs when completing business functions. Specifically, when recording the second log, the second distributed node determines whether a logging point is embedded in the application's logging component. If so, step S112 is executed.

[0052] If not, feedback will be sent to the management user terminal so that the management user can subsequently add tracking points to the logging component. In other words, only by adding tracking points to the logging component in the application can second log data be generated when recording the second log, and one second log data will be generated for each second log entry.

[0053] Specifically, when recording the current second log, the second distributed node determines the second log data ID in the second log collection context.

[0054] Then, the value of the second log data ID is incremented by 1 to generate the fourth log data ID.

[0055] Then, determine the second log text and the second timestamp of the second log.

[0056] Then, based on the second log collection ID, the identification information of the second distributed node, the fourth log data ID, the second log text, and the second timestamp, the current second log data is generated;

[0057] Finally, the second log data ID is updated based on the fourth log data ID, so that the next second log data can be generated based on the updated second log collection context.

[0058] It can construct a second log collection context based on the cross-node log collection context, and can associate the first log data and the second log data with the call chain as the main line.

[0059] In some embodiments of this application, after receiving a series of log data, the log center will automatically construct a log record tree for the business function.

[0060] Specifically, in the log data center, the first log data and the second log data are determined to come from the same call chain based on the third log data ID and the fourth log data ID.

[0061] Then, based on the first log data and the second log data, a log record tree for the business function is generated.

[0062] Finally, a query interface for generating the log tree of business functions is provided so that the log tree of business functions can be displayed when a query request is received.

[0063] In addition, after receiving a series of log data, the log data center generates log record trees for each distributed node.

[0064] Specifically, the log data center receives third log data uploaded by the first distributed node. The third log data and the first log data belong to different call chains. The log data center determines which log data belongs to the first distributed node based on the node's identification information.

[0065] Then, based on the first log data and the third log data, a log record tree is generated for the first distributed node.

[0066] Finally, a query interface for the log record tree of the first distributed node is generated so that the log record tree of the first distributed node can be displayed when a query request is received.

[0067] It should be noted that the log data center can generate query interfaces according to actual needs, such as generating queries to find log data that meet certain keyword criteria. Furthermore, it supports querying and displaying log data in a browser.

[0068] More intuitively, suppose a distributed system includes node A and node B. A user accesses node A to complete a certain function. In this function call, node A needs to call a sub-function of node B. That is, the first distributed node is node A and the second distributed node is node B. Then the specific process of log collection includes:

[0069] Step 1: After the user initiates the function call, node A will receive the user's log collection request and automatically generate a log collection context corresponding to the log collection request, in the form of {"collectId":"ci01","logId":null}. The above parameters collectId represent the log collection ID of this request, that is, the log collection ID of this request is ci01, and logId is the log data ID, that is, the log data ID of this request is currently non-existent log data, that is, it is empty.

[0070] Step Two: When Node A completes its business function, it generates application logs. By embedding a point in the logging component, logs can be received, and a log data entry can be generated for each log entry, in the form of:

[0071] {

[0072] "collectId":"ci10",

[0073] "node":"Node A",

[0074] "prevLogId":null,

[0075] "logId":"1",

[0076] "logTime":1591856949939,

[0077] "logText":"xxxxxxx"

[0078] }

[0079] The above data means the following: the log collection ID is ci01, node is a distributed node, specifically node A; "prevLogId" is the ID of the previous log entry, meaning there is no previous log entry ID for this log entry because it is the first log entry. The log data ID is 1, logTime is the timestamp for recording the log, specifically 1658215018359, and logText is the log text, specifically xxxxxxx. It should be noted that after this log data is created, the log data ID in the log collection context in step 1 becomes 1.

[0080] As the application runs, subsequent logs will also be generated in the same format as described above, such as:

[0081] {

[0082] "collectId":"ci10",

[0083] "node":"Node A",

[0084] "prevLogId":"1",

[0085] "logId":"2",

[0086] "logTime":1591856949959,

[0087] "logText":"yyyyyyyy"

[0088] }

[0089] The above log data indicates that: the log collection ID is ci01, the distributed node is node A, the previous log data ID is 1, the log data ID of this log is 2, the timestamp of the log record is 1591856949959, and the text of this log is yyyyyyyy. After this log data is created, the log data ID in the log collection context in step 1 becomes 2.

[0090] As can be seen, it is necessary to first determine the log data ID in the log collection context in step 1, and then increment the value by 1 to obtain the log data ID of the current log. That is, the log collection context of node A is updated once after a log data is generated, providing a reference for the log data ID in the next log data.

[0091] After the log data of node A is generated, it will be sent to the log center for storage asynchronously.

[0092] Step 3: As described in the example, node A calls the function in node B. At this time, the log collection context associated with the log collection request in node A is {"collectId":"ci01","logId":"2"}. Node A converts the log collection context into a cross-node log collection context and appends the cross-node log collection context to the request calling node B. The appending method can vary depending on the request type. Generally, for HTTP requests, the header method is used, such as: Log-Header:ci01:2, which means that the current log collection ID is ci01 and the log data ID is 2.

[0093] Step 5: After receiving the call request, Node B unpacks the cross-node log collection context from the call request and creates its own log collection context accordingly, in the form of {"collectId":"ci01","logId":"2"}. Subsequent logs from Node B's processing of this business function will generate log data in the form of:

[0094] {

[0095] "collectId":"ci10",

[0096] "node":"Node B",

[0097] "prevLogId":"2",

[0098] "logId":"3",

[0099] "logTime":1591856949969,

[0100] "logText":"zzzzzzzz"

[0101] }

[0102] The above log data indicates that: the log collection ID is ci01, the distributed node is node B, the previous log data ID is 2, the current log data ID is 3, the timestamp of the recorded log is 1591856949969, and the text of the log is zzzzzzzz. After this log data is created, the log data ID in the log collection context in step five becomes 3.

[0103] After the log data of node B is generated, it will be sent to the log center for storage asynchronously.

[0104] It should be noted that, although the embodiments in this application are based on... Figure 1Steps S102 to S112 will be described sequentially, but this does not mean that steps S102 to S112 must be performed in a strict order. The reason this embodiment follows this order is... Figure 1 The order in which steps S102 to S112 are described is provided to facilitate understanding of the technical solutions of the embodiments of this application by those skilled in the art. In other words, in the embodiments of this application, the order of steps S102 to S112 can be appropriately adjusted according to actual needs.

[0105] pass Figure 1 The method can collect the first log data of the call chain corresponding to the log collection request of the first distributed node by constructing the first log collection context corresponding to the log collection request of the first distributed node. By generating the second log collection context of the second distributed node based on the first log collection context, the second log data of the above call chain can be collected. Thus, for the same business function, all log data of the call chain can be located in a timely manner. When the business function has problems, it is convenient for operation and maintenance personnel to analyze the log data in a timely manner and locate the original location of the problem.

[0106] Based on the same idea, some embodiments of this application also provide devices and non-volatile computer storage media corresponding to the above methods.

[0107] Figure 2 A schematic diagram of the structure of a log collection device based on a distributed system call chain, provided in an embodiment of this application, includes:

[0108] At least one processor; and,

[0109] A memory communicatively connected to the at least one processor; wherein,

[0110] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:

[0111] In the first distributed node, a user's log collection request for a business function is received, and a first log collection context is generated. The first log collection context includes a first log collection ID and a first log data ID. The first log collection ID is used to represent the ID of the call chain corresponding to the log collection request. The first log data ID is used to represent the ID of the latest log data collected by the first distributed node, and is empty by default.

[0112] When recording the first log, first log data is generated based on the first log collection context and sent to the log data center;

[0113] The second distributed node is determined to be invoked, and a cross-node log collection context is generated based on the first log collection context; the cross-node log collection context includes the first log collection ID and the first log data ID.

[0114] The cross-node log collection context is encapsulated into the call request, and the encapsulated call request is sent to the second distributed node;

[0115] In the second distributed node, a second log collection context is generated by parsing the encapsulated call request; the second collection context includes a second log collection ID and a second log data ID; the second log collection ID is used to represent the ID of the call chain; the second log data ID represents the ID of the latest log data collected by the second distributed node;

[0116] When recording the second log, second log data is generated based on the second log collection context, and the second log data is sent to the log data center.

[0117] Some embodiments of this application provide a non-volatile computer storage medium for log collection based on a distributed system call chain, which stores computer-executable instructions, wherein the computer-executable instructions are configured as follows:

[0118] In the first distributed node, a user's log collection request for a business function is received, and a first log collection context is generated. The first log collection context includes a first log collection ID and a first log data ID. The first log collection ID is used to represent the ID of the call chain corresponding to the log collection request. The first log data ID is used to represent the ID of the latest log data collected by the first distributed node, and is empty by default.

[0119] When recording the first log, first log data is generated based on the first log collection context and sent to the log data center;

[0120] The second distributed node is determined to be invoked, and a cross-node log collection context is generated based on the first log collection context; the cross-node log collection context includes the first log collection ID and the first log data ID.

[0121] The cross-node log collection context is encapsulated into the call request, and the encapsulated call request is sent to the second distributed node;

[0122] In the second distributed node, a second log collection context is generated by parsing the encapsulated call request; the second collection context includes a second log collection ID and a second log data ID; the second log collection ID is used to represent the ID of the call chain; the second log data ID represents the ID of the latest log data collected by the second distributed node;

[0123] When recording the second log, second log data is generated based on the second log collection context, and the second log data is sent to the log data center.

[0124] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.

[0125] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0126] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0127] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0128] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0129] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0130] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0131] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0132] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0133] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0134] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the technical principles of this application should fall within the protection scope of this application.

Claims

1. A log collection method based on a distributed system call chain, characterized in that, The method includes: In the first distributed node, a user's log collection request for a business function is received, and a first log collection context is generated. The first log collection context includes a first log collection ID and a first log data ID. The first log collection ID is used to represent the ID of the call chain corresponding to the log collection request. The first log data ID is used to represent the ID of the latest log data collected by the first distributed node, and is empty by default. When recording the first log, first log data is generated based on the first log collection context and sent to the log data center; When recording the first log, generating the first log data based on the first log collection context specifically includes: When recording the current first log, determine the first log data ID in the first log collection context; Increment the value of the first log data ID by 1 to generate the third log data ID; Determine the first log text and the first timestamp of the first log; The current first log data is generated based on the log collection ID, the identification information of the first distributed node, the third log data ID, the first log text, and the first timestamp. The first log data ID is updated based on the third log data ID, so as to generate the next first log data according to the updated first log collection context; The second distributed node is determined to be invoked, and a cross-node log collection context is generated based on the first log collection context; the cross-node log collection context includes the first log collection ID and the first log data ID. The cross-node log collection context is encapsulated into a call request, and the encapsulated call request is sent to the second distributed node; In the second distributed node, a second log collection context is generated by parsing the encapsulated call request; the second log collection context includes a second log collection ID and a second log data ID; the second log collection ID is used to represent the ID of the call chain; the second log data ID represents the ID of the latest log data collected by the second distributed node; The step of generating a second log collection context by parsing the encapsulated call request specifically includes: By parsing the encapsulated call request, it is determined that the encapsulated call request includes the cross-node log collection context; The value of the first log collection ID in the cross-node log collection context is used as the value of the second log collection ID; The value of the first log data ID in the cross-node log collection context is used as the value of the second log data ID; The second log collection context is generated based on the second log collection ID and the second log data ID; When recording the second log, second log data is generated based on the second log collection context, and the second log data is sent to the log data center; After sending the second log data to the log data center, the method further includes: In the log data center, based on the third log data ID and the fourth log data ID, it is determined that the first log data and the second log data come from the same call chain; Based on the first log data and the second log data, generate a log record tree for the business function; A query interface for generating the log tree of the business function is provided so that the log tree of the business function can be displayed when a query request is received. After sending the second log data to the log data center, the method further includes: In the log data center, third log data uploaded by the first distributed node is received; the third log data and the first log data are from different call chains. Based on the first log data and the third log data, a log record tree is generated for the first distributed node; A query interface for generating the log record tree of the first distributed node is provided so that the log record tree of the first distributed node can be displayed when a query request is received.

2. The method according to claim 1, characterized in that, When recording the second log, generating second log data based on the second log collection context specifically includes: When recording the current second log, determine the second log data ID in the second log collection context; Increment the value of the second log data ID by 1 to generate the fourth log data ID; Determine the second log text and the second timestamp of the second log; The current second log data is generated based on the second log collection ID, the identification information of the second distributed node, the fourth log data ID, the second log text, and the second timestamp. The second log data ID is updated based on the fourth log data ID, so as to generate the next second log data based on the updated second log collection context.

3. The method according to claim 1, characterized in that, The step of encapsulating the cross-node log collection context into the invocation request specifically includes: Determine the request type of the invocation request; The request type is retrieved from the preset database to match the attachment method of the cross-node log collection context; According to the aforementioned additional method, the cross-node log collection context is encapsulated into the invocation request.

4. The method according to claim 1, characterized in that, When recording the first log, generating the first log data based on the first log collection context specifically includes: Determine whether logging is implemented in the application's logging component; If so, when recording the first log, the first log data is generated based on the first log collection context.

5. A log collection device based on a distributed system call chain, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform a log collection method based on a distributed system call chain as described in any one of claims 1-4.

6. A non-volatile computer storage medium for log collection based on a distributed system call chain, storing computer-executable instructions, characterized in that, The computer-executable instructions are configured to execute the log collection method based on a distributed system call chain as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Log recording method, device and system based on distributed SDN controller

    CN112751888A