Log positioning method, system and equipment and storage medium

By intercepting and extracting request IDs through the interface recording module, the log information of the distributed system is automatically located and aggregated, solving the problem of low efficiency in traditional log location and realizing fast and accurate log query and problem investigation.

CN121309330APending Publication Date: 2026-01-09创优数字科技(广东)有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511548708.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-28
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

In modern distributed systems and microservice architectures, traditional log location methods are inefficient and difficult to connect complete request chains, resulting in missing contextual information during problem analysis and making it impossible to quickly trace the root cause of the problem.

Method used

The interface recording module listens for target requests in the distributed system, intercepts interface responses and extracts request IDs, and uses these request IDs to query and aggregate log information in a multi-service log platform, enabling automatic association and display of logs across services.

Benefits of technology

It significantly improves the efficiency and timeliness of problem investigation, can quickly present complete logs, reduce manual operations, ensure that the obtained log information is complete and relevant to the needs, and make up for the shortcomings of traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121309330A_ABST
    Figure CN121309330A_ABST
Patent Text Reader

Abstract

The invention discloses a log positioning method, system and device and a storage medium, and the method comprises the steps: monitoring a target request sent to a preset domain name or a preset path in a distributed system through an interface recording module, intercepting an interface response of the target request, extracting a request id of the interface response through request id field mode matching, and sending the extracted request id to a server; and in a log platform containing a plurality of services, querying each piece of log information associated with the request id, aggregating each piece of log information, and displaying all the aggregated log information. Therefore, the target request response is automatically monitored and intercepted through the interface recording module, the complexity of manual log collection is omitted, the request id is extracted as a unified association identifier, logs dispersed in multiple services can be connected in series, the complete request link context can be supplemented, the logs can be inquired, aggregated and displayed on a multi-service log platform, and the keyword does not need to be guessed by experience; a complete log can be quickly presented, the problem checking efficiency and timeliness are remarkably improved, and the testing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computer software testing, and more particularly, to a log positioning method, system, device and storage medium. BACKGROUND

[0002] In modern distributed systems and microservice architectures, a single user operation involves the cooperative invocation of multiple services and multiple components. When the system has a problem, the traditional log positioning method needs to collect the logs of each associated service for testing. However, the massive amount of logs, the differentiated log formats of each service, and the storage methods make manual searching like finding a needle in a haystack, which is inefficient and prone to missing critical information.

[0003] Further, the complete processing flow of a request is scattered in the logs of different services and different time nodes. Due to the lack of a unified association identifier, even if part of the logs are located, it is difficult to link them to form a complete request link, resulting in a lack of context information during problem analysis and the inability to quickly trace the root cause of the problem.

[0004] Therefore, how to more comprehensively position the logs to improve the testing efficiency and problem troubleshooting capability when the system has a problem is a problem that needs attention. SUMMARY

[0005] In view of the above problems, the present application provides a log positioning method, system, device and storage medium to improve the testing efficiency and problem troubleshooting capability when the system has a problem.

[0006] To achieve the above purpose, the specific scheme is as follows:

[0007] A log positioning method, comprising:

[0008] recording a target request sent to a preset domain name or a preset path in a distributed system through an interface recording module, intercepting an interface response of the target request;

[0009] extracting a request id of the interface response through request id field mode matching;

[0010] querying each piece of log information associated with the request id in a log platform containing multiple services;

[0011] aggregating each piece of the log information, and displaying all the aggregated log information.

[0012] Optionally, before the step of extracting the request id of the interface response through request id field mode matching, the method further comprises:

[0013] structurally analyzing the interface response to obtain a structured interface response.

[0014] Optionally, the interface recording module comprises a traffic interception component and a recording control component, the traffic interception component is deployed at a network layer of the distributed system;

[0015] The interface recording module listens to a target request sent to a preset domain name or a preset path in the distributed system, and intercepts an interface response of the target request, comprising:

[0016] In response to a start recording signal of the recording control component, the traffic interception component listens to an HTTP / HTTPS request sent to a preset domain name or a preset path, and intercepts an interface response of the HTTP / HTTPS request.

[0017] Optionally, the querying each piece of log information associated with the request id in the pre-configured log platform comprises:

[0018] Constructing a query statement for querying in the pre-configured log platform based on the request id;

[0019] Querying each piece of log information associated with the request id in the log platform through the query statement.

[0020] Optionally, the aggregation of each piece of log information comprises:

[0021] De-duplication and structuring processing of each piece of log information to obtain each piece of log information that has been structured and has no duplication;

[0022] Sorting each piece of log information in chronological order or in alphabetical order of the first letter of the name of the service component, to complete the aggregation of each piece of log information.

[0023] Optionally, the method further comprises:

[0024] Temporarily storing the request id recorded by the interface recording module, the target request corresponding to the request id, and all the log information, until receiving an instruction information for emptying the temporary storage, deleting the request id, the target request corresponding to the request id, and all the log information.

[0025] Optionally, the method further comprises:

[0026] In response to the user's operation of selecting a target interface, displaying a request list of the target interface;

[0027] In response to the user's operation of selecting the target request in the request list, displaying all the log information of the request id corresponding to the target request.

[0028] A log positioning system, comprising:

[0029] an interface recording module, configured to listen to a target request sent to a preset domain name or a preset path in a distributed system, and intercept an interface response of the target request;

[0030] a request id extraction module, configured to extract a request id of the interface response through pattern matching of a request id field;

[0031] a log query module, configured to query each piece of log information associated with the request id in a log platform containing a plurality of services;

[0032] a log aggregation module, configured to aggregate each piece of the log information;

[0033] a log display module, configured to display all the aggregated log information.

[0034] Optionally, the system further comprises:

[0035] a response parser, configured to perform structured parsing on the interface response to obtain a structured interface response, before the request id of the interface response is extracted through pattern matching of a request id field.

[0036] Optionally, the interface recording module comprises a traffic interception component and a recording control component, and the traffic interception component is deployed at a network layer of the distributed system.

[0037] The traffic interception component is configured to, in response to a start recording signal of the recording control component, intercept an interface response of an HTTP / HTTPS request by listening to the HTTP / HTTPS request sent to a preset domain name or a preset path.

[0038] Optionally, the log query module comprises:

[0039] a query constructor, configured to construct a query statement for querying in a log platform based on the request id, the log platform containing a plurality of services;

[0040] a query module, configured to query each piece of service log information associated with the request id in each of the services through the query statement;

[0041] a summary module, configured to summarize each piece of the service log information obtained in each of the services to obtain each piece of log information.

[0042] Optionally, the log aggregation module comprises:

[0043] The log aggregator is used to deduplicate and structure each log entry, resulting in a structured log entry without duplicates. The log entries are then sorted by time or alphabetical order of the service component names to complete the aggregation of the log entries.

[0044] Optionally, the system may also include:

[0045] A temporary storage module is used to temporarily store the request ID, the target request corresponding to the request ID, and all the log information recorded by the interface recording module until an instruction to clear the temporary storage is received, at which point the request ID, the target request corresponding to the request ID, and all the log information are deleted.

[0046] Optionally, the system may also include:

[0047] The interface request list display module is used to display the request list of the target interface in response to the user's selection of the target interface;

[0048] A log viewer is used to display all the log information of the request ID corresponding to the target request in response to the user's selection of the target request from the request list.

[0049] A log location device, comprising a memory and a processor;

[0050] The memory is used to store programs;

[0051] The processor is used to execute the program to implement the various steps of the log location method described above.

[0052] A storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the log location method as described above.

[0053] By employing the aforementioned technical solution, this application uses an interface recording module to monitor target requests sent to a preset domain name or path in a distributed system, intercepts the interface responses of the target requests, extracts the request ID of the interface response through pattern matching of the request ID field, queries each log message associated with the request ID in a log platform containing multiple services, aggregates all log messages, and displays all aggregated log messages. Therefore, by automatically monitoring and intercepting target request responses through the interface recording module, the tedious manual collection of logs is eliminated. Extracting the request ID as a unified association identifier can link logs scattered across multiple services, supplementing the complete request chain context. Querying, aggregating, and displaying logs in a multi-service log platform eliminates the need for guessing keywords based on experience, quickly presenting complete logs, significantly improving the efficiency and timeliness of problem investigation, and enhancing testing efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0054] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The detailed description is made with reference to the accompanying drawings.

[0055] Figure 1 A flow diagram of implementing log positioning provided by an embodiment of the present application;

[0056] Figure 2 A system structure diagram of implementing log positioning provided by an embodiment of the present application;

[0057] Figure 3 A structure diagram of a device for implementing log positioning provided by an embodiment of the present application. DETAILED DESCRIPTION

[0058] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0059] The scheme of the present application can be implemented based on a terminal with data processing capability, which can be a computer, a cloud, a server, etc.

[0060] Next, the log positioning method of the present application can include the following steps in combination with the above description. Figure 1

[0061] Step S110, listening to the target request sent to the preset domain name or preset path in the distributed system through the interface recording module, and intercepting the interface response of the target request.

[0062] ​Specifically, the interface recording module can specifically include two core components of traffic interception and recording control. It can rely on agents, browser plug-ins or specific network sniffing tools to run at the network level. After the test personnel start the interface recording module, they can first configure the monitoring rules through the recording control component, including specifying the recording time period, the preset target domain name list or the path prefix regular expression that needs to be monitored. The interface recording module then monitors all network requests in the distributed system in real time within the specified period, accurately filters out HTTP / HTTPS requests to the preset domain name or path, can not only completely intercept these target requests, but also can capture the corresponding server response data synchronously, and can copy and retain the request and response data during the interception process to avoid affecting the normal business flow of the original system and ensure that the request and response information required for subsequent analysis is complete and available.

[0063] It can be understood that by using the interface recording module to monitor the target requests to the preset domain name or preset path in the distributed system and intercept the interface responses of the target requests, the pain points of manually tracking and collecting target request responses in traditional troubleshooting can be solved, without the need for test personnel to manually monitor or filter a large number of requests, greatly reducing the labor cost and error probability. By accurately positioning the target request through the preset domain name or path, irrelevant requests are avoided, and the request and response data obtained is highly relevant to the test scenario, providing accurate data sources for subsequent extraction of request id (Request id, RID). By intercepting and retaining the request and response data in real time, the lag problem in the traditional way is broken, and key data in the test process can be obtained immediately, improving the overall timeliness of testing and problem troubleshooting.

[0064] Step S120, extracting the request id of the interface response through mode matching of the request id field.

[0065] Before extracting the request id of the interface response, the interface response can be structured and parsed to obtain a structured interface response. The intercepted interface response (including the response body and response header) can be structured and parsed by using a response parser, which can adapt to multiple response formats such as JSON, XML and HTML, ensuring that no key data is missed.

[0066] Specifically, the RID identifier with the built-in rule engine can be started, and the preconfigured rules can be used to perform mode matching on the parsed data, which can intelligently identify different named request id fields such as requestId, traceId and x-request-id, and also supports complex field matching scenarios through regular expressions. The extracted request id is immediately transmitted to the RID buffer and stored in association with the corresponding interface request information, which not only ensures the integrity of the request id, but also provides accurate data support for the subsequent log query and aggregation link, and the whole process does not require manual intervention.

[0067] It can be understood that the request id of the interface response is extracted through the request id field mode matching, which can avoid the omission or error caused by the field naming difference and the complex response format, reduce the dependence on personnel experience, and realize the automation and standardization of the extraction process. Through flexible mode matching and multi-format adaptation capability, the request id naming rules of different services in a distributed system can be compatible, ensuring that the unique identification of each target request can be accurately captured, providing a unified association basis for linking multiple service logs and restoring the complete request link. By storing the request information after extraction, accurate query conditions can be provided quickly for log query, saving the time of manual parameter arrangement and significantly improving the efficiency of subsequent log positioning.

[0068] Step S130, in a log platform containing multiple services, query each piece of log information associated with the request id.

[0069] The multiple services can include order service, inventory service, payment service, etc.

[0070] Specifically, the log platform adapter can be connected with the log platform first, and the log platform adapter can provide a unified interface that can adapt to multiple log platforms such as Aliyun log, Elasticsearch, Splunk, etc., without the need to develop query logic for different platforms. Then, a standardized query statement is automatically generated based on the extracted request id as the core query condition and the syntax rules of the log platform, ensuring the accuracy of the query logic. Subsequently, a request is initiated to the log platform containing multiple services such as order service, inventory service, payment service, etc., and all log information containing the request id is synchronously pulled, regardless of whether the log is dispersed in the log library of which service, it can be fully searched, realizing cross-service log association query, and without manual intervention throughout the operation.

[0071] It can be understood that by querying each piece of log information associated with the request id in a log platform containing multiple services, the amount of manual operation is greatly reduced, and the error probability is reduced. Using the request id as the unique association identifier for query can accurately lock all logs related to the target request, avoid irrelevant log interference, ensure that the obtained log information is complete and meets the requirements, provide comprehensive data support for restoring the request link, realize cross-service log linkage query, break the isolated state of different service logs, make up for the pain points of missing log context in the traditional way, and make the test personnel no longer need to manually link multiple service logs, significantly improving the efficiency and accuracy of log query.

[0072] Step S140, aggregate each piece of log information and display all the aggregated log information.

[0073] Specifically, the logs queried across services can be processed first to remove duplicate log entries, sorted by log timestamp or service component, and structured to extract key information such as log messages, timestamps, and service names. Subsequently, the log display module presents the recorded interface request list through an intuitive user interface. When the tester selects a request, the log viewer displays the aggregated logs in real time, supports log filtering, keyword highlighting, and detailed information expansion / folding, and can also store logs asynchronously for subsequent review, ensuring that the logs are presented clearly and orderly.

[0074] It can be understood that aggregating each log information avoids the dispersion of multi-service logs, and manual arrangement is not required. The aggregated logs sorted by time or service can directly restore the request flow link, make up for the lack of context information, and quickly trace the problem node. The filtering and highlighting functions allow the tester to accurately locate the key information without searching line by line in the massive logs, improving the problem analysis efficiency. The real-time or asynchronous display mode avoids the lag of traditional log viewing, meets the review needs in different scenarios, reduces the dependence on personnel experience, makes the troubleshooting process more standardized, and further shortens the problem solving period.

[0075] For example, a tester is testing the order placement process of an e-commerce platform. The tester can click "Start Recording" in the user interface (UI) of the terminal, and set the target domain name as "api.example.com". The tester completes the test preparation operations such as "adding goods to the shopping cart" → "settling" → "submitting an order" on the front-end page. When the "submit order" interface api.example.com / order / submit response is returned, the interface recording module can capture the response, the request id extraction module successfully identifies the "traceId" as "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" from the response body JSON, and the log query module immediately uses "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" as a query condition to initiate a query request to the log platform to obtain all service logs related to the traceId. After recording is completed, the tester clicks the "submit order" interface in the UI, and the system immediately displays all associated logs pulled from the order service, inventory service, and payment service, arranged in chronological order. Further, the tester finds that one of the logs from the "payment service" shows "payment gateway timeout". The tester can quickly locate the problem in the payment link without manually logging into the log platform or guessing the log keywords.

[0076] The log positioning method provided by the embodiment can automatically listen to and intercept target request responses through the interface recording module, thereby saving the trouble of manually collecting logs, taking the request id as a unified association identifier, being able to link logs scattered in multiple services, supplementing the context on the request link, and being able to quickly present complete logs without needing to guess keywords, thereby significantly improving the problem troubleshooting efficiency and timeliness and improving the test efficiency.

[0077] In some embodiments of the present application, the interface recording module mentioned in the above embodiments is introduced, which can include a traffic interception component and a recording control component. The traffic interception component can be deployed at the network layer of the distributed system. Based on this, the process of listening to target requests sent to the preset domain name or the preset path in the distributed system and intercepting the interface responses of the target requests through the interface recording module mentioned in the above embodiments can include:

[0078] In response to the start recording signal of the recording control component, the HTTP / HTTPS request sent to the preset domain name or the preset path is listened to through the traffic interception component, and the interface response of the HTTP / HTTPS request is intercepted.

[0079] Specifically, after the tester triggers the start recording signal of the recording control component through the system, the recording control component synchronizes the preset listening rule to the traffic interception component. The traffic interception component starts working at the network layer relying on a proxy, a browser plug-in or a specific network sniffing tool, and monitors the network traffic in the distributed system in real time within a set time period, and accurately filters all HTTP / HTTPS requests sent to the preset domain name or path. At the same time of capturing these target requests, the recording control component synchronously intercepts the corresponding server interface responses, and the entire process only copies and retains the request and response data, without interfering with the normal business flow of the original system, thereby ensuring that the request and response data required for subsequent analysis is complete and accurate.

[0080] It can be understood that the target request is accurately locked through the preset rule, irrelevant network requests are effectively filtered, the request and response data obtained is highly matched with the test scenario, and irrelevant data is avoided to interfere with the subsequent process. Real-time interception and retention of request and response data break the limitation of data collection lag in the traditional way, can capture key data in the test process in time, lay a foundation for quickly carrying out log association query and positioning problems, and significantly improve the overall timeliness of test and problem troubleshooting.

[0081] In some embodiments of the present application, the process of querying each piece of log information associated with the request id in the log platform containing multiple services is introduced. Specifically, the process can include:

[0082] S1, constructing a query statement for querying in the log platform based on the request id.

[0083] The log platform can include multiple services, such as order service, inventory service, and payment service.

[0084] Specifically, the query constructor extracts the unique request id bound to the target interface request from the cache of the request id extraction module, and calls the preconfigured log platform type information. Then, the query constructor calls the corresponding preset syntax template according to the exclusive syntax rules of the target log platform, and embeds the RID as the core matching condition into the template key position. To further narrow the query range and avoid irrelevant log interference, the constructor can also automatically supplement the time range parameter of the interface recording period, finally generate a complete query statement that conforms to the syntax specification of the target log platform and can accurately locate the RID associated log, and pass it to the log platform adapter, to prepare for subsequent log query request.

[0085] S2, querying each piece of service log information associated with the request id in each service through the query statement.

[0086] Specifically, the log platform adapter can first read the preconfigured multi-service log storage mapping relationship to determine the corresponding exclusive log library or index of the order service, inventory service, payment service, etc. in the log platform. Then, the log platform adapter adjusts the matching rules according to the field format of each service log to ensure that the statement is compatible with the format of each service log. The log platform adapter initiates a query request to each service's log data source with the request id as the core matching condition, accurately pulls the logs related to the request in each service (such as order generation log, inventory deduction log, payment status log), and automatically executes the whole process without manual switching of service log source. The query results are returned to the log aggregator in real time for subsequent processing.

[0087] S3, aggregating each piece of service log information queried in each service to obtain each piece of log information.

[0088] Specifically, the service log information obtained from each service is aggregated to obtain all log information associated with the request id.

[0089] In some embodiments of the present application, the process of aggregating each piece of log information mentioned in the above embodiments is introduced, which can include:

[0090] S1, each log information is deduplicated and structured to obtain each log information which has been structured and has no duplication.

[0091] Specifically, for the logs obtained from the order service, inventory service, payment service and the like, the rules of log unique identification matching are used for deduplication, and the judgment basis can be the unique id of the log itself, or the combination of timestamp, service name and core log content. The repeated log items are automatically identified and removed to avoid the same log being presented multiple times. Then, the deduplicated logs are structured: the key fields are uniformly extracted from the logs according to the preset standard, such as log message, timestamp, service name and log level. The unstructured pure text logs are converted into structured data in the form of key-value pairs to ensure the uniformity of the formats of different service logs, and finally output each log which has no duplication and has standard fields. The standardized data support is provided for the sorting and filtering functions of the subsequent log display module.

[0092] S2, each log information is sorted in time sequence or in alphabetical order of the name of the service component to complete the aggregation of each log information.

[0093] Specifically, if the time sequence sorting is selected, the timestamp field of each structured log can be read, and the logs from the order service, inventory service, payment service and the like are sorted in increasing or decreasing order according to time to completely restore the flow sequence of the request in each service. If the alphabetical order of the service component name is selected, the service name field in the log can be extracted, and all logs of the same service are classified and integrated according to the alphabetical order of English letters A-Z or Chinese pinyin initials. After sorting, the sorted logs can be further grouped and aggregated according to the time sequence link or service dimension to ensure the logical coherence of the logs and lay the foundation for the subsequent log display module to present a clear log context without manual intervention in sorting and aggregation rules.

[0094] In some embodiments of the application, the data storage mode in the log positioning scheme process is introduced, which can specifically include:

[0095] The request id, the target request corresponding to the request id and all log information recorded by the temporary storage interface recording module are temporarily stored, and the request id, the target request corresponding to the request id and all log information are deleted after receiving the instruction information for emptying the temporary storage.

[0096] It can be understood that temporarily storing the request ID, the corresponding target request and all logs can ensure that the tester can repeatedly review and trace the complete request link and log details throughout the problem troubleshooting process, avoid restarting the interface recording or repeatedly querying the log platform due to data loss, reduce invalid operations, and improve the continuity and efficiency of troubleshooting. At the same time, the mode of deleting data only after receiving the empty instruction can retain data according to the needs of the tester, avoid long-term occupation of storage resources by useless data, and reduce the storage pressure of the system.

[0097] In some embodiments of the present application, after the terminal obtains the log information, the interaction process between the terminal and the tester is introduced, which can specifically include:

[0098] S1, in response to the operation of the user selecting the target interface, displaying the request list of the target interface.

[0099] Specifically, when the user completes the selection operation of the target interface in the user interface (UI) by clicking, checking or the like, the terminal can respond to the operation in real time, and then automatically call all request data associated with the target interface stored by the interface recording module during recording. After the data retrieval is completed, the terminal presents the information in the form of a structured request list, which clearly contains the key dimensions of each request in the list: the timestamp of the request, the complete URL path corresponding to the request, the HTTP / HTTPS method used by the request, the response status code returned by the server, and the request id associated with the request. At the same time, the list supports forward or reverse sorting according to the request timestamp, and provides a paging function to facilitate the user to efficiently browse and locate the target request, which meets the core needs of the system to assist in quickly troubleshooting problems.

[0100] S2, in response to the operation of the user selecting the target request in the request list, displaying all log information of the request id corresponding to the target request.

[0101] Specifically, when the user selects a target request in the request list by clicking, checking or the like, the terminal immediately responds to the interaction instruction. First, extract the unique request id bound to the target request from the associated data stored by the interface recording module. Then, call all cross-service logs matching the request id that have been aggregated by the log query aggregation module in advance, and trigger real-time query and structured processing if not aggregated in advance. Finally, all logs are displayed in chronological order on the interface, clearly presenting key information such as log message, service name, timestamp, supporting keyword highlighting and detail expansion functions to help users quickly trace the request flow link.

[0102] The system for realizing log positioning provided by the embodiments of the present application is described below. The system for realizing log positioning described below can be correspondingly referred to the method for realizing log positioning described above.

[0103] Referring to Figure 2 , Figure 2 A system structure schematic diagram for realizing log positioning is disclosed in an embodiment of the present application.

[0104] As Figure 2 shown, the system can include:

[0105] An interface recording module 11 is configured to listen to a target request sent to a preset domain name or a preset path in a distributed system, and intercept an interface response of the target request.

[0106] A request id extraction module 12 is configured to extract a request id of the interface response through request id field mode matching.

[0107] A log query module 13 is configured to query each piece of log information associated with the request id in a log platform containing a plurality of services.

[0108] A log aggregation module 14 is configured to aggregate each piece of the log information.

[0109] A log display module 15 is configured to display all the aggregated log information.

[0110] Optionally, the system further includes:

[0111] A response parser is configured to perform structured parsing on the interface response to obtain a structured interface response before the request id of the interface response is extracted through request id field mode matching.

[0112] Optionally, the interface recording module includes a traffic interception component and a recording control component, and the traffic interception component is deployed at a network layer of the distributed system.

[0113] The traffic interception component is configured to intercept an interface response of an HTTP / HTTPS request by listening to the HTTP / HTTPS request sent to a preset domain name or a preset path in response to a start recording signal of the recording control component.

[0114] Optionally, the log query module includes:

[0115] A query constructor is configured to construct a query statement for querying in a log platform based on the request id, the log platform containing a plurality of services.

[0116] A query module is configured to query each piece of service log information associated with the request id in each of the services through the query statement.

[0117] An aggregation module is configured to aggregate each piece of the service log information obtained by querying in each of the services to obtain each piece of log information.

[0118] Optionally, the log aggregation module comprises:

[0119] a log aggregator configured to: perform deduplication and structuring processing on each piece of the log information to obtain each piece of the log information that has been processed and is not duplicated, sort each piece of the log information in chronological order or in alphabetical order of the first letter of the name of the service component, and complete aggregation of each piece of the log information.

[0120] Optionally, the system further comprises:

[0121] a temporary storage module configured to temporarily store the request id, the target request corresponding to the request id, and all the log information recorded by the interface recording module, and delete the request id, the target request corresponding to the request id, and all the log information after receiving instruction information for emptying the temporary storage.

[0122] Optionally, the system further comprises:

[0123] an interface request list display module configured to display a request list of a target interface in response to an operation of selecting the target interface by a user;

[0124] a log viewer configured to display all the log information of the request id corresponding to the target request in response to an operation of selecting the target request in the request list by the user.

[0125] The log positioning method provided by the embodiments of the present application can be applied to a log positioning device. Optionally, Figure 3 a hardware structure block diagram of the log positioning device is shown, and reference is made to Figure 3 The hardware structure of the log positioning device can comprise: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4.

[0126] In the embodiments of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 complete communication with each other through the communication bus 4.

[0127] The processor 1 can be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application, etc.

[0128] The memory 3 can contain a high-speed RAM memory, and can also include a non-volatile memory, etc., for example, at least one disk memory.

[0129] The memory stores a program, and the processor can invoke the program stored in the memory, and the program is used for:

[0130] The interface recording module is used for monitoring a target request sent to a preset domain name or a preset path in a distributed system, and intercepting an interface response of the target request;

[0131] The request id field is matched in a mode, and a request id of the interface response is extracted;

[0132] In a log platform comprising a plurality of services, each piece of log information associated with the request id is queried;

[0133] The log information is aggregated, and all the log information after aggregation is displayed.

[0134] Optionally, the detailed functions and the extended functions of the program can refer to the description above.

[0135] The application further provides a storage medium, which can store a program suitable for processor execution, and the program is used for:

[0136] The interface recording module is used for monitoring a target request sent to a preset domain name or a preset path in a distributed system, and intercepting an interface response of the target request;

[0137] The request id field is matched in a mode, and a request id of the interface response is extracted;

[0138] In a log platform comprising a plurality of services, each piece of log information associated with the request id is queried;

[0139] The log information is aggregated, and all the log information after aggregation is displayed.

[0140] Optionally, the detailed functions and the extended functions of the program can refer to the description above.

[0141] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and are not intended to denote the presence of any such actual relationship or order. Moreover, the terms "include", "have", or any other variant thereof are intended to encompass non-exclusive inclusions, such that processes, methods, articles, or apparatuses that comprise a list of elements are not required to comprise only those elements in the list, but can include other elements not expressly listed, or also include elements inherent in such processes, methods, articles, or apparatuses. Without additional restrictions, an element preceded by "comprises... a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the stated element.

[0142] The various embodiments in the specification are described in progressive order with each embodiment building on one or more of the previous embodiments, however the order of the embodiments described is not intended to be construed as a requirement or limitation for these embodiments. Any one or more of the embodiments described with reference to a particular set of one or more other embodiments are optionally employable together with one or more other embodiments and / or in any appropriate combination.

[0143] The above description of disclosed embodiments is intended to enable those skilled in the art to make or use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A log location method, characterized in that, include: The interface recording module listens for target requests sent to a preset domain name or preset path in the distributed system and intercepts the interface response of the target request. Extract the request ID from the interface response by matching the pattern of the request ID field; In a log platform that includes multiple services, query each log entry associated with the request ID; Aggregate all the log entries and display all the aggregated log entries.

2. The method according to claim 1, characterized in that, Before extracting the request ID of the interface response through pattern matching of the request ID field, the method further includes: The interface response is parsed in a structured manner to obtain a structured interface response.

3. The method according to claim 1, characterized in that, The interface recording module includes a traffic interception component and a recording control component, wherein the traffic interception component is deployed at the network layer of the distributed system; The step of monitoring target requests sent to a preset domain name or preset path in the distributed system through the interface recording module and intercepting the interface response of the target request includes: In response to the start recording signal from the recording control component, the traffic interception component listens for HTTP / HTTPS requests sent to a preset domain name or preset path and intercepts the interface response of the HTTP / HTTPS requests.

4. The method according to claim 1, characterized in that, The step of querying each log entry associated with the request ID in a log platform containing multiple services includes: A query statement for querying on the log platform is constructed based on the request ID; the log platform includes multiple services. The query statement is used to retrieve the service log information associated with the request ID in each of the services. The log information obtained from each of the aforementioned services is summarized to obtain each log entry.

5. The method according to claim 1, characterized in that, The aggregation of the log entries includes: Each log entry is deduplicated and structured to obtain a structured log entry that is free of duplicates. The log entries are sorted by time sequence or alphabetical order of the service component names to aggregate the log entries.

6. The method according to claim 1, characterized in that, Also includes: The interface recording module temporarily stores the request ID, the target request corresponding to the request ID, and all the log information recorded by the interface recording module until it receives an instruction to clear the temporary storage, at which point it deletes the request ID, the target request corresponding to the request ID, and all the log information.

7. The method according to any one of claims 1-6, characterized in that, Also includes: In response to the user's selection of a target interface, a request list for that target interface is displayed; In response to the user's selection of the target request from the request list, all log information corresponding to the request ID of the target request is displayed.

8. A log location system, characterized in that, include: The interface recording module is used to listen to target requests sent to a preset domain name or preset path in a distributed system and intercept the interface response of the target request; The request ID extraction module is used to extract the request ID of the interface response by matching the pattern of the request ID field. The log query module is used to query each log entry associated with the request ID in a log platform that contains multiple services; The log aggregation module is used to aggregate the log information from each entry. The log display module is used to display all the aggregated log information.

9. A log location device, characterized in that, Including memory and processor; The memory is used to store programs; The processor is configured to execute the program to implement each step of the log location method as described in any one of claims 1-7.

10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the log location method as described in any one of claims 1-7.

Citation Information

Cited By

  • Inter-system data exchange log tracing system and method

    CN121958216A