CN115118583A - Log query method and device, electronic equipment and computer readable storage equipment - Google Patents

Log query method and device, electronic equipment and computer readable storage equipment Download PDF

Info

Publication number
CN115118583A
CN115118583A CN202210758140.XA CN202210758140A CN115118583A CN 115118583 A CN115118583 A CN 115118583A CN 202210758140 A CN202210758140 A CN 202210758140A CN 115118583 A CN115118583 A CN 115118583A
Authority
CN
China
Prior art keywords
target
request
service node
log
traceid
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210758140.XA
Other languages
Chinese (zh)
Other versions
CN115118583B (en
Inventor
舒新胜
宋忠良
张骏杰
李阳幸子
于宗潍
张雪博
杨东伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202210758140.XA priority Critical patent/CN115118583B/en
Publication of CN115118583A publication Critical patent/CN115118583A/en
Application granted granted Critical
Publication of CN115118583B publication Critical patent/CN115118583B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a log query method, a log query device, electronic equipment and a computer-readable storage medium, wherein the method comprises the following steps: determining a first tracking identifier TraceID of a target request to be queried, wherein the first TraceID comprises an identifier of the target request and service node information; determining a target service node based on the service node information, wherein the target service node is a service node through which the target request is executed; sending a log query request to the target service node, wherein the log query request comprises an identifier of the target request, and the query request is used for querying a log of the target request stored by the target service node; and receiving the log of the target request sent by the target service node. The method provided by the embodiment of the invention can improve the log query efficiency.

Description

Log query method and device, electronic equipment and computer readable storage equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a log query method and apparatus, an electronic device, and a computer-readable storage device.
Background
In distributed tracking and monitoring, a tracking Identity (TraceID) in a request process is a fixed and unchangeable character string, is used for uniquely distinguishing requests, and is transmitted in a service link. When all the associated logs are queried according to the TraceID, all the call chains and the related logs need to be stored in an intermediate storage database, and then the TraceID is used as a key word for query by utilizing the retrieval function of the database. However, since the call chain is generated every moment, the number of the call chains is larger and larger along with the scale of the service, that is, the storage space occupied by the storage log in the database is larger and larger, which results in lower query efficiency.
Disclosure of Invention
The embodiment of the invention aims to provide a log query method, a log query device, electronic equipment and computer readable storage equipment so as to improve log query efficiency. The specific technical scheme is as follows:
in a first aspect of the present invention, a log query method is first provided, executed on a terminal device, and includes:
determining a first tracking identifier TraceID of a target request to be queried, wherein the first TraceID comprises an identifier of the target request and service node information;
determining a target service node based on the service node information, wherein the target service node is a service node through which the target request is executed;
sending a log query request to the target service node, wherein the log query request comprises an identifier of the target request, and the query request is used for querying a log of the target request stored by the target service node;
and receiving the log of the target request sent by the target service node.
In a second aspect of the present invention, there is also provided a log query method executed in a target service node, including:
receiving a log query request sent by terminal equipment, wherein the log query request comprises an identifier of a target request, the log query request is used for querying a log of the target request, and the target request and the target service node are determined based on a first tracking identifier TraceID of the target request;
querying a stored log of the target request based on the identification of the target request;
and responding to the query request, and sending the log of the target request to the terminal equipment.
In a third aspect of the present invention, there is further provided a log query apparatus, disposed in a terminal device, including:
the system comprises a first determination module, a first tracking identification TraceID module and a second determination module, wherein the first tracking identification TraceID module is used for determining a first tracking identification TraceID of a target request to be inquired, and the first TraceID comprises an identification of the target request and service node information;
a second determining module, configured to determine a target service node based on the service node information, where the target service node is a service node through which the target request is executed;
a first sending module, configured to send a log query request to the target service node, where the log query request includes an identifier of the target request, and the query request is used to query a log of the target request stored by the target service node;
a first receiving module, configured to receive a log of the target request sent by the target service node.
In a fourth aspect of the present invention, there is provided a log query apparatus, disposed in a target service node, including:
a second receiving module, configured to receive a log query request sent by a terminal device, where the log query request includes an identifier of a target request, the log query request is used to query a log of the target request, and the target request and the target service node are determined based on a TraceID of a first tracking identifier of the target request;
the query module is used for querying the stored log of the target request based on the identification of the target request;
and the second sending module is used for responding to the query request and sending the log of the target request to the terminal equipment.
In another aspect of the present invention, an electronic device is further provided, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of executing any log query method when executing the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any one of the log query methods described above.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the log query methods described above.
According to the log query method provided by the embodiment of the invention, firstly, a terminal device determines a first tracking identifier TraceID of a target request to be queried, wherein the first TraceID comprises the identifier of the target request and service node information. Then, the terminal device determines a target service node based on the service node information, wherein the target service node is a service node through which the target request is executed. And the terminal equipment sends a log query request to the target service node, wherein the log query request comprises the identifier of the target request, and the query request is used for querying the log of the target request stored by the target service node. And finally, the terminal equipment receives the log of the target request sent by the target service node. In the method, a target service node is determined according to service node information in a first traceID of a target request to be queried, and a log query request is sent to the target service node, so that a log of the target request stored in the target service node is obtained, that is, the log query request can be directly sent to the target service node storing the log of the target request, so that a mode of storing all call chains into an intermediate storage database for query can be avoided, and the target service node only needs to store logs generated by executing the target request respectively. Compared with the way of storing the logs in the intermediate storage database, the embodiment of the invention has the advantages that all logs related to the target request can be dispersed in the corresponding service nodes, and the logs of the target request sent by the target service nodes are obtained by sending the log query request to the target service nodes during log query, so that the log query efficiency can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a schematic flowchart of a log query method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another log querying method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of TraceID delivery in an embodiment of the present invention;
FIG. 4 is a schematic diagram of a log retrieval method according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a link topology relationship of a service node according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a log query apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of another log query device according to an embodiment of the present invention;
FIG. 8 is a block diagram of an electronic device in an embodiment of the invention;
fig. 9 is a block diagram of another electronic device in an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a log query method, executed in a terminal device, including:
step 101, determining a first tracking identifier TraceID of a target request to be queried, wherein the first TraceID comprises an identifier of the target request and service node information;
step 102, determining a target service node based on the service node information, wherein the target service node is a service node through which the target request is executed;
103, sending a log query request to the target service node, where the log query request includes an identifier of the target request, and the query request is used to query a log of the target request stored by the target service node;
and step 104, receiving the log of the target request sent by the target service node.
It should be understood that the target request is a request that has been accessed to the service network and is executed by each corresponding service node in the service network, and during the execution of the target request, each service node stores a log generated in the execution process. Meanwhile, a service node in the service network generates and returns a first traceID of the target request, wherein the generated first traceID comprises information of the service node through which the target request is executed.
It should be understood that the terminal device may be an initiator device of the target request, or may be another device. In a case where the terminal device is an initiator of the target request, the terminal device may obtain the first TraceID in an execution device response based on the target request. When the terminal device is another device, the target request execution device obtains the first TraceID after the target request execution is completed. If the terminal device needs to query the relevant log, the terminal device may request the initiator device of the target request to obtain the first TraceID.
It should be understood that the first TraceID described above includes an identification of the target request that is used to uniquely distinguish between different requests, such as: a randomly generated string representation may be used. The service node information included in the first TraceID is used to identify a service node that passes through in the process of executing the target request, for example: the service node identification through which the target request is executed, the topological relation among the service nodes and the like can be included.
The target service node may be any service node through which the target request is executed, for example: taking the example that the target request passes through the serving node a and the serving node B, the target serving node may be the serving node a or the serving node B, or the serving node a and the serving node B. When the target service node includes more than two service nodes, step 103 and step 104 may be performed separately for each service node to obtain the log of the target request stored in each service node.
It should be understood that the log query request may be generated based on a request of a user, and the terminal device sends the log query request to the target service node in step 103 to query the log of the target request stored in the target service node, that is, the log of the target request is stored in the local device, respectively, and it is not necessary to store all call chains and related logs in all service nodes in a storage database and then perform log query.
According to the log query method provided by the embodiment of the invention, firstly, a terminal device determines a first tracking identifier TraceID of a target request to be queried, wherein the first TraceID comprises the identifier of the target request and service node information. Then, the terminal device determines a target service node based on the service node information, wherein the target service node is a service node through which the target request is executed. And the terminal equipment sends a log query request to the target service node, wherein the log query request comprises the identifier of the target request, and the query request is used for querying the log of the target request stored by the target service node. And finally, the terminal equipment receives the log of the target request sent by the target service node. In the method, a target service node is determined according to service node information in a first traceID of a target request to be queried, and a log query request is sent to the target service node, so that a log of the target request stored in the target service node is obtained, that is, the log query request can be directly sent to the target service node storing the log of the target request, so that a mode of storing all call chains into an intermediate storage database for query can be avoided, and the target service node only needs to store logs generated by executing the target request respectively. Compared with the way of storing the logs in the intermediate storage database, the embodiment of the invention has the advantages that all logs related to the target request can be dispersed in the corresponding service nodes, and the logs of the target request sent by the target service nodes are obtained by sending the log query request to the target service nodes during log query, so that the log query efficiency can be improved.
Optionally, the service node information includes an internet protocol address and a log query port of the target service node;
in step 103, the sending of the query request to the target service node may specifically include:
acquiring a log query interface of the target service node based on the internet protocol address and the log query port of the target service node;
and sending a query request to the target service node based on the log query interface.
It should be understood that the TraceID is passed during the service process in the request process of the target request, and each service node may add service node information to the identifier of the target request to identify which service nodes have processed the target request.
In the process of processing the target request by the target service request, the processing is performed based on the received target request sent by the previous service node, and it can be understood that the target request sent by the previous service node includes the identifier of the target request and the service node information of the previous service node. Taking the example that the target request needs to pass through the service node a and the service node B, if the target request is initiated by the user through the device C, the device C sends the target request containing the target request identifier to the service node a, the target request identified by the target request is the original traceID, the service node A processes the received target request, and adds service node information of service node A on original TraceID, and sends the above-mentioned target request to next service node B after obtaining first intermediate TraceID, and in the same way, service node B processes the received above-mentioned target request, and adding service node information of the service node B to the first intermediate traceID to obtain a second intermediate traceID, returning the second intermediate traceID to the service node A by the service node B, and returning the second intermediate traceID serving as a final traceID to the equipment C by the service node A. The service node A processes the received target request, and simultaneously generates a log related to the target request and stores the log to the local; and the service node B processes the received target request, and simultaneously generates a log related to the target request and stores the log to the local.
In the above process of processing the target request, the added service node information may include an Internet Protocol (IP) address and a log query port of the service node. It should be understood that, the service node may provide an external log query interface through the IP address and the log query port, and the terminal device may obtain the log query interface of the service node based on the first TraceID, so as to implement log query.
The log query interface is realized in an invasive or non-invasive manner, for example, Java language can automatically generate an interface with a function of retrieving log files based on the IP address of the service node and the log query port through a bytecode augmentation technology.
In this embodiment, the terminal device obtains a log query interface of the target service node based on the ip address and the log query port of the target service node, and sends a query request to the target service node based on the log query interface. That is, when the terminal device queries the log of the target request, the terminal device may directly query the target request log stored in the target service node based on the obtained log query interface of the target service node, so as to further improve the log query efficiency.
Optionally, the target service node is any one of a plurality of service nodes;
after receiving the log of the target request sent by the target service node in step 104, the method may further include:
acquiring link topology relations of the plurality of service nodes based on the first traceID;
and outputting the log of the target request based on the link topological relation.
It should be understood that, when there are a plurality of service nodes through which the target request is executed, if the log of the target request needs to be queried, a log query request may be sent to the plurality of service nodes through which the target request is executed, so as to obtain logs of the target request stored by the plurality of service nodes, that is, all logs generated by executing the target request. In the process of executing the target request, the target request sequentially passes through the plurality of service nodes, so that the plurality of service nodes can respectively generate logs in the process of executing the target request. It is to be understood that the order in which the target request passes through the plurality of service nodes may be characterized by a link topology relationship, and thus, the link topology relationship may also characterize the order between the logs generated by the plurality of service nodes in the process of executing the target request.
In this embodiment, the terminal device obtains the link topology relationship of the plurality of service nodes based on the first TraceID, and outputs the log of the target request based on the link topology relationship, and may output the logs generated and stored by the plurality of service nodes respectively according to the link topology relationship of the plurality of service nodes, thereby improving readability of the log of the target request.
As shown in fig. 2, an embodiment of the present invention provides a log query method, executed in a target service node, including:
step 201, receiving a log query request sent by a terminal device, where the log query request includes an identifier of a target request, the log query request is used to query a log of the target request, and the target request and the target service node are determined based on a TraceID of a first tracking identifier of the target request;
step 202, inquiring a stored log of the target request based on the identification of the target request;
step 203, responding to the query request, and sending the log of the target request to the terminal device.
Optionally, before the receiving the query request sent by the terminal device in step 201, the method further includes:
receiving a target request, wherein the target request comprises an identification of the target request;
executing the target request and generating a second TraceID, wherein the second TraceID comprises an identifier of the target request and service node information corresponding to the target service node, and the second TraceID is an intermediate TraceID (a first and second relation) for generating the first TraceID;
and returning the second TraceID to the terminal equipment.
It should be understood that the query request is used to query the log of the target request, that is, the target request is executed before the target serving node receives the query request sent by the terminal device in step 201, for example: for the transmission of TraceID between service nodes, as shown in fig. 3, a service node a first receives an identifier of a target request of a user terminal and adds service node information of the service node a to form an intermediate TraceID, a service node B also adds the service node information of the service node B after receiving the intermediate TraceID transmitted by the service node a and transmits the intermediate TraceID to a service node C, and the service node C adds the service node information of the service node C to the received intermediate TraceID and then returns to the service node a through the service node B; and the service node D receives the intermediate TraceID transmitted by the service node A, adds service node information of the service node D and returns the service node D to the service node A, so that the service node A obtains a final TraceID based on the intermediate TraceID returned by the path 1 (from A to B to C) and the intermediate TraceID returned by the path 2 (from A to D), and returns the final TraceID to the user.
For the service node a, the service node B, the service node C, or the service node D, after the service node adds respective service node information, the generated intermediate TraceID is the second TraceID, and the final TraceID returned by the service node a to the user terminal is the first TraceID.
It should be understood that the above-described passing of traceids between service nodes may use compressed data, such as: the identification of the target request may be represented by a randomly generated 32-bit string, and the added service node information may be represented by a string formatted as "IP address: port "indicates that the service node information of the service node a is 192.168.1.1:8888, and data compressed by using base64 is transferred between the service nodes.
In this embodiment, the target service node may identify a target service node through which the target request passes by adding the service node information to the TraceID, so that, when performing log query, the generated log of the target request is stored in the target service node, and the log in the target service node is directly queried, thereby avoiding a problem of storage space occupation caused by uniformly storing the logs of all service nodes in a database for query.
Optionally, the service node information includes an internet protocol address and a log query port of the target service node;
before the receiving of the query request sent by the terminal device, the method further includes:
and generating a log query interface based on the internet protocol address and the log query port of the target service node, wherein the log query interface is used for realizing log query stored by the target service node.
Optionally, the target service node is any one of a plurality of service nodes;
the executing the target request and generating a second TraceID includes:
executing the target request, and generating the second traceID based on the link topology relation of the plurality of service nodes executing the target request, wherein the target request is executed by the plurality of service nodes in sequence.
When the target request is executed by a plurality of servers, the plurality of server nodes sequentially execute the target request, and generate a second TraceID according to a link topology relationship in which the plurality of servers execute the target request.
It should be noted that, the embodiment of the present invention is taken as an implementation manner of a target service node corresponding to the embodiment of the method in fig. 1, and therefore, reference may be made to the relevant description in the embodiment of the method in fig. 1, and the same beneficial effects may be achieved. To avoid repetition of the description, the description is omitted.
The various optional implementations described in the embodiments of the present invention may be implemented in combination with each other or implemented separately without conflict, and the embodiments of the present invention are not limited thereto.
For ease of understanding, specific examples are as follows:
an embodiment of the present invention provides a log retrieval method, as shown in fig. 4, where a TraceID is used to mark a specific request ID, and when a user requests to enter a system, a globally unique TraceID is generated in a first layer of a call network, and the TraceID is carried for downstream service delivery, and a user request can be serially connected in all service systems through the TraceID. The TraceID is a character string, if the accessed service node information, such as the IP information of the service node, is stored in the character string, it can be known which service nodes have processed the request, and then the service nodes are searched for the related logs, so that the log data associated with the TraceID can be searched.
In this embodiment, the TraceID specification is defined first: random string + serving node information. The random string is a random 32-bit string that uniquely distinguishes the request. The format of the service node information may be selected, for example: the format is A (B) (C) and is used for representing the links A to B to C, wherein A, B, C represents three service node information, and the calling link is a tree structure which is represented by brackets. And, each service node information contains the IP address and retrieval port information of the service node, for example: the service node information corresponding to the service node a is 192.168.1.1:8888, wherein 192.168.1.1 is the IP address of the service node a, and 8888 is the retrieval port. Another example is: format a (b (c) D) may represent a link topology relationship as shown in fig. 5, and the passing of TraceID between the service nodes is shown in fig. 3.
When access to the service network is requested, a request TraceID is generated at the first layer, containing the current service IP and port information. The TraceID is transmitted in the downstream of the service, the information of the current service node is supplemented on the basis of the original TraceID every time when passing through one node, and when the request is completed, the new TraceID is transmitted back to the upstream. This forms two traceids: a request TraceID and a response TraceID.
Opening a log retrieval interface: the IP and port representation of the service node provide a log retrieval interface for the outside, such as: 192.168.1.1:8888, i.e., the service node indicates that the http://192.168.1.1:8888/query interface is provided externally, passing the traceID parameter will retrieve the log file in the current machine. The interface can be realized in an invasive or non-invasive manner, for example, Java language, and the interface for retrieving the log file function can be automatically generated through byte code enhancement technology.
A log retrieval center is established, as shown in fig. 4, after the TraceID of the request is input, the service nodes experienced by the request can be automatically analyzed, log information is sequentially inquired from the log retrieval interfaces of the service nodes, and the log information is displayed according to the link topology relationship, so that retrieval is completed.
In this way, by adding the service node information in the response traceID and determining all the service node information passed by the processing request based on the response traceID, the retrieval interface of each service node can be directly called to realize log retrieval, and logs retrieved by each service node are displayed according to the link topology relation.
Referring to fig. 6, fig. 6 is a structural diagram of a log query apparatus 600 according to an embodiment of the present invention.
The log query device 600 is arranged in a terminal device, and includes:
a first determining module 601, configured to determine a first tracking identifier TraceID of a target request to be queried, where the first TraceID includes an identifier of the target request and service node information;
a second determining module 602, configured to determine a target service node based on the service node information, where the target service node is a service node through which the target request is executed;
a first sending module 603, configured to send a log query request to the target service node, where the log query request includes an identifier of the target request, and the query request is used to query a log of the target request stored by the target service node;
a first receiving module 604, configured to receive a log of the target request sent by the target service node.
Optionally, the service node information includes an internet protocol address and a log query port of the target service node;
the first sending module 603 may specifically include:
the acquisition unit is used for acquiring a log query interface of the target service node based on the Internet protocol address and the log query port of the target service node;
and the sending unit is used for sending a query request to the target service node based on the log query interface.
Optionally, the target service node is any one of a plurality of service nodes;
the log query apparatus 600 further includes:
an obtaining module, configured to obtain link topology relationships of the multiple service nodes based on the first TraceID;
and the output module is used for outputting the log of the target request based on the link topological relation.
The log query device 600 can implement each process of the method embodiment of fig. 1 in the embodiment of the present invention, and achieve the same beneficial effects, and is not described herein again to avoid repetition.
Referring to fig. 7, fig. 7 is a structural diagram of a log query device 700 according to an embodiment of the present invention.
The log query apparatus 700, installed in a target service node, includes:
a second receiving module 701, configured to receive a log query request sent by a terminal device, where the log query request includes an identifier of a target request, the log query request is used to query a log of the target request, and the target request and the target service node are determined based on a TraceID of a first tracking identifier of the target request;
a query module 702 configured to query a stored log of the target request based on the identification of the target request;
a second sending module 703, configured to send, in response to the query request, the log of the target request to the terminal device.
Optionally, the log query apparatus 700 further includes:
a third receiving module, configured to receive a target request, where the target request includes an identifier of the target request;
the execution module is used for executing the target request and generating a second traceID, wherein the second traceID comprises an identifier of the target request and service node information corresponding to the target service node, and the second traceID is an intermediate traceID for generating the first traceID;
and the return module is used for returning the second TraceID to the terminal equipment.
Optionally, the service node information includes an internet protocol address and a log query port of the target service node;
the log query apparatus 700 further includes:
and the generating module is used for generating a log query interface based on the internet protocol address and the log query port of the target service node, wherein the log query interface is used for realizing log query stored by the target service node.
Optionally, the target service node is any one of a plurality of service nodes;
the execution module may specifically include:
and the execution unit is used for executing the target request and generating the second traceID based on the link topology relation of the target request executed by the service nodes, wherein the target request is executed by the service nodes in sequence.
The log query device 700 can implement each process of the method embodiment in fig. 2 in the embodiment of the present invention, and achieve the same beneficial effects, and is not described herein again to avoid repetition.
An embodiment of the present invention further provides an electronic device, as shown in fig. 8, which includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete mutual communication through the communication bus 804,
a memory 803 for storing a computer program;
the processor 801 is configured to implement the following steps when executing the program stored in the memory 803:
determining a first tracking identifier TraceID of a target request to be queried, wherein the first TraceID comprises an identifier of the target request and service node information;
determining a target service node based on the service node information, wherein the target service node is a service node through which the target request is executed;
sending a log query request to the target service node, wherein the log query request comprises an identifier of the target request, and the query request is used for querying a log of the target request stored by the target service node;
and receiving the log of the target request sent by the target service node.
Optionally, the service node information includes an internet protocol address and a log query port of the target service node;
the sending the query request to the target service node includes:
acquiring a log query interface of the target service node based on the internet protocol address and the log query port of the target service node;
and sending a query request to the target service node based on the log query interface.
Optionally, the target service node is any one of a plurality of service nodes;
the processor 801 is further configured to, when executing the program stored in the memory 803, implement the following steps:
acquiring link topology relations of the service nodes based on the first TraceID;
and outputting the log of the target request based on the link topological relation.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
An embodiment of the present invention further provides an electronic device, as shown in fig. 9, which includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the following steps when executing the program stored in the memory 903:
receiving a log query request sent by terminal equipment, wherein the log query request comprises an identifier of a target request, the log query request is used for querying a log of the target request, and the target request and the target service node are determined based on a first tracking identifier TraceID of the target request;
querying a stored log of the target request based on the identification of the target request;
and responding to the query request, and sending the log of the target request to the terminal equipment.
Optionally, the processor 901 is further configured to, when executing the program stored in the memory 903, implement the following steps:
receiving a target request, wherein the target request comprises an identification of the target request;
executing the target request and generating a second traceID, wherein the second traceID comprises an identifier of the target request and service node information corresponding to the target service node, and the second traceID is an intermediate traceID for generating the first traceID;
and returning the second TraceID to the terminal equipment.
Optionally, the service node information includes an internet protocol address and a log query port of the target service node;
the processor 901 is further configured to implement the following steps when executing the program stored in the memory 903:
generating a log query interface based on the internet protocol address of the target service node and a log query port;
the log query interface is used for realizing log query stored by the target service node.
Optionally, the target service node is any one of a plurality of service nodes;
the executing the target request and generating a second TraceID includes:
executing the target request, and generating the second traceID based on the link topology relation of the plurality of service nodes executing the target request, wherein the target request is executed by the plurality of service nodes in sequence.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the instructions are executed on a computer, the instructions cause the computer to execute the log query method in any one of the above embodiments.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the log query method of any of the above embodiments.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (11)

1. A log query method is executed on a terminal device, and comprises the following steps:
determining a first tracking identifier TraceID of a target request to be queried, wherein the first TraceID comprises an identifier of the target request and service node information;
determining a target service node based on the service node information, wherein the target service node is a service node through which the target request is executed;
sending a log query request to the target service node, wherein the log query request comprises an identifier of the target request, and the query request is used for querying a log of the target request stored by the target service node;
and receiving the log of the target request sent by the target service node.
2. The method of claim 1, wherein the service node information comprises an internet protocol address and a log query port of the target service node;
the sending the query request to the target service node includes:
acquiring a log query interface of the target service node based on the internet protocol address and the log query port of the target service node;
and sending a query request to the target service node based on the log query interface.
3. The method of any of claims 1 or 2, wherein the target serving node is any one of a plurality of serving nodes;
after receiving the log of the target request sent by the target service node, the method further includes:
acquiring link topology relations of the plurality of service nodes based on the first traceID;
and outputting the log of the target request based on the link topological relation.
4. A log query method, implemented in a target service node, includes:
receiving a log query request sent by terminal equipment, wherein the log query request comprises an identifier of a target request, the log query request is used for querying a log of the target request, and the target request and the target service node are determined based on a first tracking identifier TraceID of the target request;
querying a stored log of the target request based on the identification of the target request;
and responding to the query request, and sending the log of the target request to the terminal equipment.
5. The method of claim 4, wherein before the receiving the query request sent by the terminal device, the method further comprises:
receiving a target request, wherein the target request comprises an identification of the target request;
executing the target request and generating a second traceID, wherein the second traceID comprises an identifier of the target request and service node information corresponding to the target service node, and the second traceID is an intermediate traceID for generating the first traceID;
and returning the second TraceID to the terminal equipment.
6. The method of claim 5, wherein the service node information comprises an internet protocol address and a log query port of the target service node;
before the receiving of the query request sent by the terminal device, the method further includes:
and generating a log query interface based on the internet protocol address and the log query port of the target service node, wherein the log query interface is used for realizing log query stored by the target service node.
7. The method of claim 5, wherein the target serving node is any one of a plurality of serving nodes;
the executing the target request and generating a second TraceID includes:
executing the target request, and generating the second traceID based on the link topology relation of the plurality of service nodes executing the target request, wherein the target request is executed by the plurality of service nodes in sequence.
8. A log inquiry device is arranged in a terminal device and is characterized by comprising:
the system comprises a first determination module, a first tracking identification TraceID module and a second determination module, wherein the first tracking identification TraceID module is used for determining a first tracking identification TraceID of a target request to be inquired, and the first TraceID comprises an identification of the target request and service node information;
a second determining module, configured to determine a target service node based on the service node information, where the target service node is a service node through which the target request is executed;
a first sending module, configured to send a log query request to the target service node, where the log query request includes an identifier of the target request, and the query request is used to query a log of the target request stored by the target service node;
a first receiving module, configured to receive a log of the target request sent by the target service node.
9. A log query device, which is arranged at a target service node, is characterized by comprising:
a second receiving module, configured to receive a log query request sent by a terminal device, where the log query request includes an identifier of a target request, the log query request is used to query a log of the target request, and the target request and the target service node are determined based on a TraceID of a first tracking identifier of the target request;
the query module is used for querying the stored log of the target request based on the identification of the target request;
and the second sending module is used for responding to the query request and sending the log of the target request to the terminal equipment.
10. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1 to 3 or the method steps of any one of claims 4 to 7 when executing a program stored in a memory.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 3, or carries out the method of any one of claims 4 to 7.
CN202210758140.XA 2022-06-29 2022-06-29 Log query method and device, electronic equipment and computer readable storage equipment Active CN115118583B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210758140.XA CN115118583B (en) 2022-06-29 2022-06-29 Log query method and device, electronic equipment and computer readable storage equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210758140.XA CN115118583B (en) 2022-06-29 2022-06-29 Log query method and device, electronic equipment and computer readable storage equipment

Publications (2)

Publication Number Publication Date
CN115118583A true CN115118583A (en) 2022-09-27
CN115118583B CN115118583B (en) 2024-03-26

Family

ID=83330984

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210758140.XA Active CN115118583B (en) 2022-06-29 2022-06-29 Log query method and device, electronic equipment and computer readable storage equipment

Country Status (1)

Country Link
CN (1) CN115118583B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140119196A1 (en) * 2012-10-29 2014-05-01 T-Mobile Usa, Inc. Network Device Trace Correlation
US20140279929A1 (en) * 2013-03-15 2014-09-18 Amazon Technologies, Inc. Database system with database engine and separate distributed storage service
CN105824958A (en) * 2016-03-31 2016-08-03 广州华多网络科技有限公司 Method, device and system for inquiring log
WO2016187967A1 (en) * 2015-05-28 2016-12-01 中兴通讯股份有限公司 Method and apparatus for realizing log transmission
CN106850782A (en) * 2017-01-17 2017-06-13 泰康保险集团股份有限公司 For the method and system of log processing
CN108197200A (en) * 2017-12-27 2018-06-22 金蝶软件(中国)有限公司 Daily record method for tracing, device, computer equipment and storage medium
US20190347343A1 (en) * 2018-05-09 2019-11-14 Palantir Technologies Inc. Systems and methods for indexing and searching
CN110830577A (en) * 2019-11-08 2020-02-21 深圳前海环融联易信息科技服务有限公司 Service request call tracking method and device, computer equipment and storage medium
CN111352902A (en) * 2020-02-28 2020-06-30 中国平安人寿保险股份有限公司 Log processing method and device, terminal equipment and storage medium
CN112612675A (en) * 2020-12-25 2021-04-06 山东经伟晟睿数据技术有限公司 Distributed big data log link tracking method and system under micro-service architecture
CN113127307A (en) * 2021-04-25 2021-07-16 北京大米科技有限公司 Method for processing tracing request, related device, system and storage medium
CN113448936A (en) * 2020-03-25 2021-09-28 阿里巴巴集团控股有限公司 Log tracking method, device, server, system and storage medium
CN114064597A (en) * 2021-11-18 2022-02-18 浙江中控技术股份有限公司 Log processing method and system, electronic equipment and storage medium

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140119196A1 (en) * 2012-10-29 2014-05-01 T-Mobile Usa, Inc. Network Device Trace Correlation
US20140279929A1 (en) * 2013-03-15 2014-09-18 Amazon Technologies, Inc. Database system with database engine and separate distributed storage service
WO2016187967A1 (en) * 2015-05-28 2016-12-01 中兴通讯股份有限公司 Method and apparatus for realizing log transmission
CN105824958A (en) * 2016-03-31 2016-08-03 广州华多网络科技有限公司 Method, device and system for inquiring log
CN106850782A (en) * 2017-01-17 2017-06-13 泰康保险集团股份有限公司 For the method and system of log processing
CN108197200A (en) * 2017-12-27 2018-06-22 金蝶软件(中国)有限公司 Daily record method for tracing, device, computer equipment and storage medium
US20190347343A1 (en) * 2018-05-09 2019-11-14 Palantir Technologies Inc. Systems and methods for indexing and searching
CN110830577A (en) * 2019-11-08 2020-02-21 深圳前海环融联易信息科技服务有限公司 Service request call tracking method and device, computer equipment and storage medium
CN111352902A (en) * 2020-02-28 2020-06-30 中国平安人寿保险股份有限公司 Log processing method and device, terminal equipment and storage medium
CN113448936A (en) * 2020-03-25 2021-09-28 阿里巴巴集团控股有限公司 Log tracking method, device, server, system and storage medium
CN112612675A (en) * 2020-12-25 2021-04-06 山东经伟晟睿数据技术有限公司 Distributed big data log link tracking method and system under micro-service architecture
CN113127307A (en) * 2021-04-25 2021-07-16 北京大米科技有限公司 Method for processing tracing request, related device, system and storage medium
CN114064597A (en) * 2021-11-18 2022-02-18 浙江中控技术股份有限公司 Log processing method and system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115118583B (en) 2024-03-26

Similar Documents

Publication Publication Date Title
CN110928874A (en) Information processing method, device and system, electronic equipment and storage medium
CN108366012B (en) Social relationship establishing method and device and electronic equipment
CN112154420A (en) Automatic intelligent cloud service testing tool
CN109614327B (en) Method and apparatus for outputting information
CN113364853A (en) Business service system, business request method and gateway equipment
CN111309970A (en) Data retrieval method and device, electronic equipment and storage medium
CN108154024B (en) Data retrieval method and device and electronic equipment
CN111563199A (en) Data processing method and device
CN109600254B (en) Method for generating full-link log and related system
CN111382206A (en) Data storage method and device
CN111198885A (en) Data processing method and device
CN111209325A (en) Service system interface identification method, device and storage medium
CN110719200A (en) Information identification method and device
CN110120918B (en) Identification analysis method and device
CN110955460A (en) Service process starting method and device, electronic equipment and storage medium
CN113127693A (en) Traffic data packet statistical method, device, equipment and storage medium
CN111078773A (en) Data processing method and device
CN115118583B (en) Log query method and device, electronic equipment and computer readable storage equipment
CN111884932B (en) Link determining method, device, equipment and computer readable storage medium
CN114490246A (en) Monitoring method, monitoring device, electronic equipment and storage medium
CN113992664B (en) Cluster communication method, related device and storage medium
CN111291127B (en) Data synchronization method, device, server and storage medium
CN110968267B (en) Data management method, device, server and system
CN112597119A (en) Method and device for generating processing log and storage medium
CN113014456A (en) Monitoring data transmission system, method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant