A micro-service log display method, device, equipment and medium

By registering microservice cluster information on the load balancing server through the log collection and remote registration modules in the log display system, the problem of cumbersome microservice log retrieval in complex network environments is solved, and efficient log querying and display are achieved.

CN115168309BActive Publication Date: 2026-01-02INSPUR ZHUOSHU BIG DATA IND DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210718946.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-23
Publication Date
2026-01-02
Estimated Expiration
2042-06-23

AI Technical Summary

Technical Problem

Existing log management systems suffer from cumbersome retrieval processes when displaying microservice logs in complex network environments, leading to display failures.

Method used

A log display system is adopted, including a log collection module, a remote registration module, and a log display module. The remote registration module registers the information of the microservice cluster on the load balancer server and queries and transmits log files when needed to achieve real-time updates and display.

Benefits of technology

It improves the efficiency of microservice log querying, reduces network bandwidth pressure, ensures that developers can obtain the necessary log information in a timely manner, and enhances the convenience and accuracy of log display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168309B_ABST
    Figure CN115168309B_ABST
Patent Text Reader

Abstract

The embodiment of the present specification discloses a micro-service log display method, device, equipment and medium, which is applied to a log display system, the system includes a log collection module, a remote registration module and a log display module, including: the log display module initiates a display request to the log collection module to display the specified micro-service log in the specified cluster; the log collection module sends a query request to the remote registration module to query the specified micro-service log in the specified cluster according to the display request; the remote registration module obtains the corresponding log file according to the query request and sends the log file to the log collection module; the log collection module receives the log file and sends the log file to the log display module for display.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of computer, and particularly relates to a micro-service log display method and device, equipment and medium. BACKGROUND

[0002] In the process of service system deployment, the network environment is complex, there are many service clusters providing services, each service cluster is a logically independent network structure, and considering the security of the server, the access between ports needs to be reported and opened, and then a log management system needs to be used.

[0003] The existing log management system is mostly applied in complex network environment, and when displaying the specified micro-service log, there may be a situation that the micro-service log retrieval is complicated, thereby causing the failure of displaying the micro-service log. SUMMARY

[0004] One or more embodiments of the present specification provide a micro-service log display method, device, equipment and medium, which are used to solve the technical problems proposed in the background.

[0005] One or more embodiments of the present specification adopt the following technical solutions:

[0006] The micro-service log display method provided by one or more embodiments of the present specification is applied to a log display system, the system includes a log collection module, a remote registration module and a log display module, and the method includes:

[0007] The log display module initiates a display request for displaying a specified micro-service log in a specified cluster to the log collection module;

[0008] The log collection module sends a query request for querying the specified micro-service log in the specified cluster to the remote registration module according to the display request;

[0009] The remote registration module acquires a corresponding log file according to the query request, and sends the log file to the log collection module;

[0010] The log collection module receives the log file, and sends the log file to the log display module for display.

[0011] Further, before sending the query request for querying the specified micro-service log in the specified cluster to the remote registration module, the method further includes:

[0012] When the specified cluster starts running, the remote registration module sends a registration request to the log collection module, and sends registration information of the specified cluster.

[0013] Further, the sending, to the off-site registration module, of the query request for querying the specified microservice log in the specified cluster specifically includes:

[0014] The off-site registration module queries the proxy port of the specified cluster and sends the query request for querying the specified microservice log in the specified cluster to the proxy port.

[0015] Further, the specified cluster includes a plurality of servers and a load balancing server including a public network IP, and the off-site registration module is deployed on the load balancing server.

[0016] Further, the registration information includes an off-site registered public network IP address, a proxy port, a deployed microservice name, and corresponding log path information.

[0017] Further, when the registration information of the specified cluster changes, the method further includes:

[0018] The changed registration information is sent to the log collection module, and the log collection module updates a local registration information database according to the changed registration information, to realize registration data synchronization.

[0019] Further, the off-site registration module includes a health check port.

[0020] Before the log collection module sends, to the off-site registration module, the query request for querying the specified microservice log in the specified cluster according to the display request, the method further includes:

[0021] The off-site registration module detects, through the health check port, whether the proxy port is normally running.

[0022] If yes, a signal that the proxy port is normally running is sent to the log collection module.

[0023] One or more embodiments of the present specification provide a microservice log display device, which is applied to a log display system including a log collection module, an off-site registration module, and a log display module, and includes:

[0024] A display request unit initiates, through the log display module, a display request for displaying a specified microservice log in a specified cluster to the log collection module.

[0025] A query request unit sends, to the off-site registration module, a query request for querying the specified microservice log in the specified cluster according to the display request through the log collection module.

[0026] The log acquisition unit acquires corresponding log files according to the query request through the off-site registration module, and sends the log files to the log collection module;

[0027] The display unit receives the log files through the log collection module, and sends the log files to the log display module for display.

[0028] One or more embodiments of the present specification provide a micro-service log display device, which is applied to a log display system, the system comprising a log collection module, an off-site registration module, and a log display module, the device comprising:

[0029] at least one processor; and

[0030] a memory in communication connection with the at least one processor; wherein

[0031] 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:

[0032] The log display module initiates a display request for displaying specified micro-service logs in a specified cluster to the log collection module;

[0033] The log collection module sends a query request for querying the specified micro-service logs in the specified cluster to the off-site registration module according to the display request;

[0034] The off-site registration module acquires corresponding log files according to the query request, and sends the log files to the log collection module;

[0035] The log collection module receives the log files, and sends the log files to the log display module for display.

[0036] One or more embodiments of the present specification provide a non-volatile computer storage medium, which stores computer executable instructions, the computer executable instructions being set to:

[0037] The log display module initiates a display request for displaying specified micro-service logs in a specified cluster to the log collection module;

[0038] The log collection module sends a query request for querying the specified micro-service logs in the specified cluster to the off-site registration module according to the display request;

[0039] The off-site registration module acquires corresponding log files according to the query request, and sends the log files to the log collection module;

[0040] The log collection module receives the log file and sends the log file to the log display module for display.

[0041] The above at least one technical solution adopted by the embodiments of the present specification can achieve the following beneficial effects:

[0042] In order to facilitate developers to query service logs, the embodiments of the present specification register log information of a service accepted by a server, retain the registration information and update it in real time, query on demand, and when a developer proposes to view a certain log of a service, transmit the corresponding log to the developer through a network channel according to the registration information. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can also be obtained without creative labor. In the drawings:

[0044] Figure 1 A flowchart of a microservice log display method provided by one or more embodiments of the present specification is shown;

[0045] Figure 2 A structural diagram of a remote log collection and display system provided by one or more embodiments of the present specification is shown;

[0046] Figure 3 A structural diagram of a microservice log display device provided by one or more embodiments of the present specification is shown;

[0047] Figure 4 A structural diagram of a microservice log display device provided by one or more embodiments of the present specification is shown. DETAILED DESCRIPTION

[0048] The embodiments of the present specification provide a microservice log display method, device, equipment and medium.

[0049] In order to enable those skilled in the art to better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be described clearly and completely in conjunction with the drawings in the embodiments of the present specification. Obviously, the described embodiments are only some of the embodiments of the present specification, not all. Based on the embodiments of the present specification, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present specification.

[0050] Figure 1 A flowchart of a microservice log display method is provided for one or more embodiments of the present specification. The flowchart can be executed by a microservice log display system that can query microservice logs in a pre-registered cluster and display the microservice logs. Some input parameters or intermediate results in the flowchart allow manual intervention to adjust to help improve accuracy.

[0051] The microservice log display method of the embodiments of the present specification can be applied to a log display system, which includes a log collection module, a remote registration module, and a log display module.

[0052] The method flow steps of the embodiments of the present specification are as follows:

[0053] S102, the log display module initiates a display request to the log collection module to display a specified microservice log in a specified cluster.

[0054] In the embodiments of the present specification, the specified cluster can include multiple servers and a load balancing server containing a public IP, and the remote registration module is deployed on the load balancing server. The microservice is a service provided by each server. The microservice log is an event record generated when the microservice is running, and each line of log records the date, time, user, and description of related operations.

[0055] S104, the log collection module sends a query request to the remote registration module to query the specified microservice log in the specified cluster according to the display request.

[0056] In the embodiments of the present specification, before sending the query request to the remote registration module to query the specified microservice log in the specified cluster, the specified cluster needs to be registered, that is, when the specified cluster starts running, the remote registration module sends a registration request to the log collection module and sends the registration information of the specified cluster.

[0057] It should be noted that the registration information can include the remote registration public IP address, the proxy port, the deployed microservice name, and the corresponding log path information.

[0058] In the embodiments of the present specification, when sending the query request to the remote registration module to query the specified microservice log in the specified cluster, the remote registration module can first query the proxy port of the specified cluster and send a query request to the proxy port to query the specified microservice log in the specified cluster. The proxy port is a port that listens to the local service and then forwards the request of the port to the target service. The proxy port can use the nginx proxy port.

[0059] S106, the off-site registration module acquires the corresponding log file according to the query request, and sends the log file to the log collection module.

[0060] S108, the log collection module receives the log file, and sends the log file to the log display module for display.

[0061] Further, when the registration information of the specified cluster changes, the changed registration information can be sent to the log collection module, and the log collection module updates the local registration information database according to the changed registration information, so as to realize registration data synchronization.

[0062] Further, the off-site registration module of the embodiment of the present specification comprises a health check port;

[0063] Before the log collection module sends a query request for querying the specified microservice log in the specified cluster to the off-site registration module according to the display request, the off-site registration module can detect whether the proxy port is normally running through the health check port, so that the log collection module can send a query request for querying the specified microservice log in the specified cluster to the off-site registration module according to the display request. If yes, send a signal to the log collection module that the proxy port is running normally.

[0064] It should be noted that, as for the off-site registration module of the embodiment of the present specification, off-site refers to facing various logically independent network environments, collecting microservice logs in various environments, and facilitating developers to solve problems in the development process.

[0065] In the embodiment of the present specification, Figure 2 A structural schematic diagram of an off-site log collection and display system is provided for one or more embodiments of the present specification. In order to facilitate developers to query microservice logs, the log information of the off-site service can be registered by accepting the log information of the off-site service on the server side, the registration information can be retained and updated in real time, and the log information can be queried on demand. When a developer proposes to view a certain log of a certain service, the corresponding log is transmitted to the developer through a network channel according to the registration information. The system mainly comprises three service modules:

[0066] Log collection module:

[0067] (1) This module exposes a registration port to the outside, providing registration functions for off-site registration services. (2) This module relies on a database to save off-site registration service registration information to the database, which includes off-site registration public IP addresses, nginx proxy ports, deployed microservice names, and corresponding log path information. (3) This module relies on a log query component. When the log query display module initiates a query for logs of a certain cluster and service, this module queries the information of the nginx proxy port of the cluster and sends a request to the port to query the corresponding logs. After the request is successful, the logs are sent to the cache. (4) This module relies on a fast read memory database to quickly save and push log information requested by the log query display module to the log query display module.

[0068] Off-site registration module:

[0069] (1) This module relies on a log information registration component. Each service cluster has several servers and a load balancing server with a public IP. When the off-site registration module service starts running, it sends a registration request to the registration port exposed by the log collection module and sends registration information. (2) This module exposes a log query port to the outside. Nginx is deployed on the load balancing server to proxy an access to the intranet port. This port can respond to log query requests from the log collection module and send corresponding logs to the log collection module. Considering network bandwidth pressure, the last 100 lines of log content are intercepted by default. Developers can choose the number of query lines as needed.

[0070] Log query display module:

[0071] (1) This module relies on an interaction component to provide an interface for developers to query service logs. (2) This module relies on a database to update the content of the module interface using the registration information database of the log collection module and the log storage database.

[0072] It should be noted that the microservice logs of the embodiments of the present specification can be off-site microservice logs. The off-site microservice logs register and update information remotely, allowing remote servers to real-time access log collection information, enabling developers to see and transmit logs, and avoiding network bandwidth pressure caused by off-site log transmission.

[0073] It should be noted that for registration operations, the information registration component sends the registration information of the cluster to the log collection module. The log collection module collects registration information from all groups, including nginx proxy ports for accessing the log cluster, various logs of corresponding microservices, and log path information.

[0074] It should be noted that, for the registration operation, the out-of-place registration module can provide a health check port, and the log collection module keeps health checking all the out-of-place log information ports mastered by the log collection module, so that errors can be found in time when the service is wrong, and the log query module can avoid being unable to meet the demand due to service errors when the log query module proposes an access log demand.

[0075] It should be noted that, for the log query module, in order to reduce network bandwidth pressure and improve query speed, the last 50 lines of the log required by the developer can be called by default, and the developer is provided with a query expansion option, and more recent logs can be selected in necessary cases.

[0076] It should be noted that the out-of-place registration module of the present application can not only send registration information to the log collection module at the time of registration, but also can have a supervision service locally. When the service log file changes, such as the change of the service name and the change of the log path, the change information is sent to the log collection module, and the log collection module updates the local registration information database according to the change information, so as to realize data synchronization.

[0077] It should be noted that the query process of the present application often needs to query multiple logs, and the log query display module can provide a multi-log synchronous query function and provide a clear and intuitive interface to display the contents of multiple log files.

[0078] It should be noted that, in order to cope with the case of large query demand, the log query component of the log collection module can maintain a query demand queue to prevent the loss of query request data during the query peak period.

[0079] It should be noted that the in-memory database of the present application can only retain the current query log information, and a large number of micro-service logs are stored locally to reduce the network bandwidth pressure caused by the traditional log collection and query system.

[0080] It should be noted that the log query display module of the present application can call the query component of the log collection module, the query component sends the log information to be queried to the query port of the out-of-place registration module, and the information is transmitted to the in-memory database of the log collection module, so as to provide fast storage and reading for the developer to query the log.

[0081] Figure 3 A structural schematic diagram of a micro-service log display device provided for one or more embodiments of the present application, the device is applied to a log display system, the system includes a log collection module, an out-of-place registration module and a log display module, and the device includes a display request unit 302, a query request unit 304, a log acquisition unit 306 and a display unit 308.

[0082] The display request unit 302 initiates a display request for displaying the log of the specified microservice in the specified cluster to the log collection module through the log display module;

[0083] The query request unit 304 sends a query request for querying the log of the specified microservice in the specified cluster to the off-site registration module through the log collection module according to the display request;

[0084] The log acquisition unit 306 acquires the corresponding log file according to the query request through the off-site registration module, and sends the log file to the log collection module;

[0085] The display unit 308 receives the log file through the log collection module, and sends the log file to the log display module for display.

[0086] Figure 4 A structural diagram of a microservice log display device is provided for one or more embodiments of the present specification, and the device is applied to a log display system, the system including a log collection module, an off-site registration module, and a log display module, and the device includes:

[0087] at least one processor; and

[0088] a memory in communication connection with the at least one processor; wherein

[0089] 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:

[0090] The log display module initiates a display request for displaying the log of the specified microservice in the specified cluster to the log collection module;

[0091] The log collection module sends a query request for querying the log of the specified microservice in the specified cluster to the off-site registration module according to the display request;

[0092] The off-site registration module acquires the corresponding log file according to the query request, and sends the log file to the log collection module;

[0093] The log collection module receives the log file, and sends the log file to the log display module for display.

[0094] A non-volatile computer storage medium is provided by one or more embodiments of the present specification, and the computer executable instructions are stored in the non-volatile computer storage medium, and the computer executable instructions are set to:

[0095] The log display module initiates a display request to the log collection module to display the log of the specified microservice in the specified cluster;

[0096] The log collection module sends a query request to the off-site registration module to query the log of the specified microservice in the specified cluster according to the display request;

[0097] The off-site registration module acquires the corresponding log file according to the query request and sends the log file to the log collection module;

[0098] The log collection module receives the log file and sends the log file to the log display module for display.

[0099] Each of the embodiments in the specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, the device, the apparatus, and the non-volatile computer storage medium embodiments are basically similar to the method embodiments, and thus the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.

[0100] The above describes specific embodiments of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different than the order in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous or possible.

[0101] The above only describes one or more embodiments of the specification and does not limit the specification. One or more embodiments of the specification can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of one or more embodiments of the specification shall be included in the scope of the claims of the specification.

Claims

1. A method for displaying microservice logs, characterized in that, The method is applied to a log display system, the system comprising a log collection module, a remote registration module and a log display module, the method comprising: The log display module initiates a display request to the log collection module to display the specified microservice log in the specified cluster; The log collection module sends a query request to the remote registration module to query the specified microservice log in the specified cluster according to the display request; The remote registration module acquires the corresponding log file according to the query request and sends the log file to the log collection module; The log collection module receives the log file and sends the log file to the log display module for display; Before sending the query request to the remote registration module to query the specified microservice log in the specified cluster, the method further comprises: When the specified cluster starts running, the remote registration module sends a registration request to the log collection module and sends the registration information of the specified cluster; The query request to the remote registration module to query the specified microservice log in the specified cluster specifically comprises: The remote registration module queries the agent port of the specified cluster and sends a query request to the agent port to query the specified microservice log in the specified cluster; The specified cluster comprises multiple servers and a load balancing server comprising a public IP, and the remote registration module is deployed on the load balancing server; The registration information comprises a registered public IP address, an agent port, a deployed microservice name and corresponding log path information.

2. The method of claim 1, wherein, When the registration information of the specified cluster changes, the method further comprises: Send the changed registration information to the log collection module, and the log collection module updates the local registration information database according to the changed registration information to realize registration data synchronization.

3. The method of claim 1, wherein, The remote registration module comprises a health check port; Before the log collection module sends a query request to the remote registration module to query the specified microservice log in the specified cluster according to the display request, the method further comprises: The remote registration module detects whether the agent port is normally running through the health check port; If yes, send a signal to the log collection module that the agent port is running normally.

4. A device for displaying microservice logs, characterized in that, The device is applied to a log display system, the system comprising a log collection module, a remote registration module and a log display module, the device comprising: A display request unit initiates a display request to the log collection module to display the specified microservice log in the specified cluster through the log display module; A query request unit sends a query request to the remote registration module to query the specified microservice log in the specified cluster according to the display request through the log collection module; A log acquisition unit acquires the corresponding log file according to the query request through the remote registration module and sends the log file to the log collection module; A display unit receives the log file through the log collection module, and sends the log file to the log display module for display. Before sending the query request for querying the specified microservice log in the specified cluster to the off-site registration module, the method further includes: When the specified cluster starts running, the off-site registration module sends a registration request to the log collection module and sends registration information of the specified cluster. The sending of the query request for querying the specified microservice log in the specified cluster to the off-site registration module specifically includes: The off-site registration module queries a proxy port of the specified cluster and sends the query request for querying the specified microservice log in the specified cluster to the proxy port. The specified cluster includes a plurality of servers and a load balancing server including a public network IP, and the off-site registration module is deployed on the load balancing server. The registration information includes a registered public network IP address, a proxy port, a deployed microservice name, and corresponding log path information.

5. A device for presenting microservice logs, characterized in that The device is applied to a log display system, and the system includes a log collection module, an off-site registration module, and a log display module. at least one processor; and The memory is in communication with 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: The log display module initiates a display request for displaying a specified microservice log in a specified cluster to the log collection module. The log collection module sends a query request for querying the specified microservice log in the specified cluster to the off-site registration module according to the display request. The off-site registration module obtains a corresponding log file according to the query request and sends the log file to the log collection module. The log collection module receives the log file and sends the log file to the log display module for display. Before sending the query request for querying the specified microservice log in the specified cluster to the off-site registration module, the method further includes: When the specified cluster starts running, the off-site registration module sends a registration request to the log collection module and sends registration information of the specified cluster. The sending of the query request for querying the specified microservice log in the specified cluster to the off-site registration module specifically includes: The off-site registration module queries a proxy port of the specified cluster and sends the query request for querying the specified microservice log in the specified cluster to the proxy port. The specified cluster includes a plurality of servers and a load balancing server including a public network IP, and the off-site registration module is deployed on the load balancing server. The registration information includes a registered public network IP address, a proxy port, a deployed microservice name, and corresponding log path information.

6. A non-transitory computer storage medium, comprising, The computer executable instructions are set to: The log display module initiates a display request to the log collection module to display the specified microservice log in the specified cluster; The log collection module sends a query request to the off-site registration module to query the specified microservice log in the specified cluster according to the display request; The off-site registration module obtains the corresponding log file according to the query request and sends the log file to the log collection module; The log collection module receives the log file and sends the log file to the log display module for display; Before sending the query request to the off-site registration module to query the specified microservice log in the specified cluster, the method further comprises: When the specified cluster starts running, the off-site registration module sends a registration request to the log collection module and sends the registration information of the specified cluster; The off-site registration module sends a query request to the off-site registration module to query the specified microservice log in the specified cluster, specifically comprising: The off-site registration module queries the proxy port of the specified cluster and sends a query request to the proxy port to query the specified microservice log in the specified cluster; The specified cluster includes multiple servers and a load balancing server containing a public IP, and the off-site registration module is deployed on the load balancing server; The registration information includes: off-site registered public IP address, proxy port, deployed microservice name and corresponding log path information.

Citation Information

Patent Citations

  • Log processing method, servers and client

    CN107463602A

  • Log-based link tracking method and device, computer equipment and storage medium

    CN113590372A