A network fault location method for business call chain based on log analysis

Through the real-time collection and processing of interface call log information, combined with the caching mechanism of Redis and Elasticsearch, the rapid fault location of the business call chain in the distributed system is realized, which solves the problem of low efficiency of fault location in the traditional method and provides intuitive and Effective data support.

CN114064718BActive Publication Date: 2024-09-20SHANGHAI NEW CENTURION NETWORK INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111308824.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-05
Publication Date
2024-09-20
Estimated Expiration
2041-11-05

AI Technical Summary

Technical Problem

In distributed systems, traditional distributed link monitoring methods are difficult to quickly locate faulty business system modules or interfaces, cannot quickly determine the scope of fault impact, have low processing efficiency, and cannot be directly provided to business operators for use.

Method used

Obtain relevant log information by calling the interface, collect it in real time and process it centrally, match the business initiation name, use Redis and Elasticsearch for data caching and query, set scheduled tasks for data matching and display, the front-end system uses the business process name and time slice. Data query statistics.

Benefits of technology

It realizes fast, intuitive and effective fault location of business call chain, improves fault location efficiency, and can directly provide data used by business operators to support system optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064718B
    Figure CN114064718B
Patent Text Reader

Abstract

The present invention discloses a network fault location method for a business call chain based on log analysis, including: S1) obtaining relevant call log information for interface calls; S2) real-time collection of log information distributed on different nodes, and centralized sending to a server for processing; S3) finding the corresponding business process by matching the business initiation name, and caching the business request ID corresponding to the business process; S4) after receiving the data, the server queries the corresponding business process in the cache system by the business request ID, writes the process name into the database, and temporarily caches the data that has not been successfully matched; S5) setting a scheduled task to match the business process name of the temporarily cached business data; S6) performing data query statistics and display in the front-end system by the process name and time slice of the business process. The present invention can quickly locate the network fault of the business call chain, and the business link analysis is more intuitive and effective.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a network fault locating method, and in particular to a network fault locating method for a service call chain based on log analysis. Background Art

[0002] With the expansion of Internet architecture, distributed systems are becoming increasingly complex, and more and more components are becoming distributed, such as microservices, message sending and receiving, distributed databases, distributed caches, distributed object storage, and cross-domain calls. These components together constitute a complex distributed network. The problem now is that after a request passes through these services, a call fails. We only know that there is an exception. To find out which service caused the exception, we need to enter each service to check the log. However, in a distributed environment, each service is deployed on a different machine. When troubleshooting, we need to log in to different servers and perform manual filtering and analysis based on the time when the fault occurred. This processing efficiency is very low. In addition, when a fault occurs, it is impossible to locate the specific business attribution of the fault, resulting in the system being unavailable only when a certain business is unavailable. Therefore, whether the faulty business can be quickly located has become a very important requirement.

[0003] As can be seen from the above, the traditional distributed link monitoring method can analyze the specific links of each call. When a fault occurs, it is impossible to quickly determine which business system module or interface has a problem, and it is impossible to quickly determine the scope of the fault. It cannot correspond to a specific business name, but requires specific technicians to convert the data for the second time before matching it to the corresponding business, and it cannot be directly provided to business operators for use. Traditional distributed link monitoring can only calculate the average delay of a single season change, and cannot calculate the overall average delay of the entire business process. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a network fault locating method for a business call chain based on log analysis, which can quickly locate the network fault of the business call chain, is more intuitive and effective in business link analysis, has higher efficiency, is highly practical, and is easy to promote and use.

[0005] The technical solution adopted by the present invention to solve the above-mentioned technical problems is to provide a network fault locating method for a business call chain based on log analysis, comprising the following steps: S1) obtaining relevant call log information for interface calls; S2) collecting log information distributed on different nodes in real time, and sending them to the server for processing; S3) finding the corresponding business process by matching the business initiation name, and caching the business request ID corresponding to the business process; S4) after receiving the data, the server queries the corresponding business process in the cache system through the business request ID, writes the process name into the database, and temporarily caches the data that has not been successfully matched; S5) setting a scheduled task to match the business process name of the temporarily cached business data; S6) performing data query, statistics and display in the front-end system through the process name and time slice of the business process.

[0006] Furthermore, the step S1 prints relevant log data at the end of each interface call and writes it to the server hard disk.

[0007] Furthermore, the relevant log data includes: business call request ID, start time, end time, time consumed, call result, call method name, parent node ID and current node ID; the business call request ID is a globally unique ID generated for each request, the current node ID is a globally unique ID generated for each interface request, and the parent node ID is the previous node ID that calls the current node.

[0008] Furthermore, the step S2 collects the log information distributed on different nodes in real time by deploying a collection program, formats the data, stores the relevant fields separately in Elasticsearch, and stores the original log data separately as a field.

[0009] Furthermore, step S3 caches the service name and service call request ID corresponding to the first interface initiated by the data service process into Redis, and sets an expiration time for the cached data. The cached data is used for subsequent service matching of all links through which the service passes.

[0010] Furthermore, in step S4, for the first interface data not initiated by a business, the corresponding business name is queried in the cached Redis through the business call request ID, and the interface data that has not yet matched the business name is cached in the local first cache.

[0011] Furthermore, step S5 sets a timed task to match the temporarily cached local business data to Redis through the business call request ID to obtain the corresponding business name; if the match is successful, the data is written to Elasticsearch, and the data that is not successfully matched is rewritten to the local second cache.

[0012] Furthermore, in step S5, for data that has not been successfully matched, the number of record matches is increased by 1 and then the matching is performed again during the next scheduling. If the number of matches exceeds 10 and the business name is still not matched, the data is discarded.

[0013] Furthermore, in the timed scheduling task, step S5 only obtains 60%-80% of the data in the local first cache and all the data in the local second cache for matching operations each time, so that the data that comes in earlier is matched first.

[0014] Furthermore, step S6 performs data query and statistics in the front-end system through the process name and time slice of the business process, and can display all the links that the business goes through, with each link separately displaying the business volume, number of successes, number of failures and average delay.

[0015] Compared with the prior art, the present invention has the following beneficial effects: the network fault location method of the business call chain based on log analysis provided by the present invention matches the business name of all business data in the data acquisition and processing link, and stores the business name in Elasticsearch. When performing business analysis, you only need to enter the business name to match the data indicators of all links that the business passes through, and you can perform statistical summary analysis on these indicators, thereby providing strong data support for system optimization. Not only can it quickly locate the network fault of the business call chain, but it is also more intuitive and effective in business link analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a flow chart of network fault location of a service call chain based on log analysis of the present invention;

[0017] Figure 2 It is a data collection, processing and analysis flow chart of the present invention;

[0018] Figure 3 This is a flow chart of cache data matching after-supplement of the present invention. DETAILED DESCRIPTION

[0019] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0020] With the popularity of microservice architecture, the call relationship between services is becoming more and more complex, and how to track the call relationship between them and analyze the dependency is becoming more important. The network fault location method of a business call chain based on log analysis provided by the present invention mainly involves the input of log data, data collection, data processing, data storage, data analysis and other aspects. At the end of the method call, the relevant log is printed on the local disk, and the data written to the disk is collected in real time by proxy, and sent to the server for processing. After receiving the data, the server determines whether it is the initiation method of the business call. If so, the method and the corresponding business call request ID are stored in Redis. For the non-business call initiation method, the business call request ID is used to obtain the corresponding business name in Redis, and then the data is formatted, key field information is provided, and the data is written to Elasticsearch. The front-end system performs data statistical analysis through the business name and time slice to provide strong data support for system optimization.

[0021] See also Figure 1 , the specific implementation process of the present invention is:

[0022] S1. Before the calling method of the interface ends, print the calling log information, including: business call request ID, start time, end time, time consumption, status, calling method name, parent node ID, current node ID. The business call request ID is only created in the calling interface initiated by the business, and then the request ID is passed to the next interface by parameter passing. The calling interface that is not initiated by the business directly obtains the ID from the calling parameter for printing, and writes it to the local file in real time.

[0023] S2. Collect data on the server through a proxy. By real-time monitoring of file changes, when data is written to the file, collect the data in real time and send it to the collection server through the TCP interface; and record the current collection location and save it on the local server.

[0024] S3. The collection server implements the data receiving interface, starts and monitors the port, and receives the data sent by the collection client in real time. After receiving the data, the collection server formats the data, extracts the business call request ID, start time, end time, time consumption, status, call method name, parent node ID, current node ID and other key fields, and matches whether the call method name is the business initiation method. If so, the business name and the corresponding business call request ID are stored in the Redis cluster, and the data expiration time is set to 1 hour. After that, the data is called by the Elasticsearch API interface to write the data to the Elasticsearch cluster for subsequent data query. If it is not a business initiation method, the business call request ID is used as the key value to query the Redis cluster to obtain the business name corresponding to the ID. When the business name is obtained, the business name is used as the field value and written to the Elasticsearch cluster. However, when the business name cannot be matched in the Redis cluster, the data is cached in the local first cache. The data collection, processing and analysis process is as follows: Figure 2 shown.

[0025] S4. The system develops a scheduled task function, which executes a scheduled schedule every 10 seconds. The local cached data is read out regularly, and the business call request ID is used as the key value. The query is performed in the Redis cluster to obtain the business name corresponding to the ID. When the business name is obtained, the business name is used as the field value and written to the Elasticsearch cluster. However, if the business name cannot be matched in the Redis cluster, the data is cached in the local second cache, and the matching number is recorded plus 1 and waits for the next scheduling to match again. The cache data matching process is as follows: Figure 3 shown.

[0026] S5. In the scheduled task, only 60%-80% of the data in the local first cache and all the data in the local second cache are obtained for matching operations each time, ensuring that the earlier the data is matched, the more timely it is. If the number of matches exceeds 10 and the business name is still not matched, the data will be discarded to ensure that the cache system will not grow indefinitely.

[0027] S6. In the front-end system, data query is performed by entering the process name and time slice of the business process, and all the links that the business goes through are displayed. The business volume, number of successes, number of failures, and average delay are displayed separately for each link, thereby providing strong data support for system optimization.

[0028] Although the present invention has been disclosed as above with preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art may make some modifications and improvements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be based on the definition of the claims.

Claims

1. A network fault location method for a service call chain based on log analysis, characterized in that: The steps include: S1) Call the interface to obtain relevant call log information; S2) collects log information distributed on different nodes in real time and sends it to the server for processing; S3) Find the corresponding business process by matching the business name, and cache the business call request ID corresponding to the business process; S4) After receiving the data, the server searches the cache system for the corresponding business process through the business call request ID, writes the business name into the database, and temporarily caches the data that has not been successfully matched; S5) Setting a scheduled task to match the business name of the temporarily cached business data; S6) In the front-end system, data query, statistics and display are performed based on the business name and time slice of the business process; The step S3 includes: the collection server implements the data receiving interface, starts and monitors the port, and receives the data sent by the collection client in real time. After receiving the data, the collection server formats the data, extracts the business call request ID, start time, end time, time consumption, status, call method name, parent node ID and current node ID, and matches whether the call method name is a business initiation method. If so, the business name and the corresponding business call request ID are stored in the Redis cluster, and the expiration time of the data is set to 1 hour. After that, the data is called by the Elasticsearch API interface to write the data to the Elasticsearch cluster for subsequent data query. If it is not a business initiation method, the business call request ID is used as the key value to query the Redis cluster to obtain the business name corresponding to the ID. When the business name is obtained, the business name is used as the field value and written to the Elasticsearch cluster. However, when the business name cannot be matched in the Redis cluster, the data is cached in the local first cache.

2. The network fault location method of the service call chain based on log analysis according to claim 1 is characterized in that: The step S1 prints the relevant log data at the end of each interface call and writes it to the server hard disk.

3. The network fault location method of the service call chain based on log analysis as claimed in claim 2, characterized in that: The relevant log data includes: business call request ID, start time, end time, time consumed, call result, call method name, parent node ID and current node ID; the business call request ID is a globally unique ID generated for each request, the current node ID is a globally unique ID generated for each interface request, and the parent node ID is the previous node ID that calls the current node.

4. The network fault location method of the service call chain based on log analysis according to claim 1 is characterized in that: The step S2 collects the log information distributed on different nodes in real time by deploying a collection program, formats the data, stores the relevant fields separately in Elasticsearch, and stores the original log data separately as a field.

5. The network fault location method of the service call chain based on log analysis according to claim 1, characterized in that: The step S3 caches the service name and service call request ID corresponding to the first interface initiated by the data service process into Redis, and sets the expiration time of the cached data. The cached data is used for subsequent service matching of all links through which the service passes.

6. The network fault location method of the service call chain based on log analysis according to claim 1, characterized in that: In step S4, for the first interface data not initiated by a business, the corresponding business name is queried in the cached Redis through the business call request ID, and the interface data that has not yet matched the business name is cached in the local first cache.

7. The network fault location method of the service call chain based on log analysis according to claim 6 is characterized in that: The step S5 sets a scheduled task, and matches the temporarily cached local business data to Redis through the business call request ID to obtain the corresponding business name; if the match is successful, the data is written to Elasticsearch, and the data that is not successfully matched is rewritten to the local second cache.

8. The network fault location method of the service call chain based on log analysis as claimed in claim 7, characterized in that: In step S5, for data that has not been successfully matched, the number of record matches is increased by 1 and then the matching is performed again during the next scheduling. If the number of matches exceeds 10 and the business name is still not matched, the data is discarded.

9. The network fault location method of the service call chain based on log analysis as claimed in claim 1, characterized in that: In the timed scheduling task, step S5 only obtains 60%-80% of the data in the local first cache and all the data in the local second cache for matching operations each time, so that the data that comes in earlier is matched first.

10. The network fault location method of the service call chain based on log analysis according to claim 1, characterized in that: The step S6 performs data query and statistics in the front-end system through the business name and time slice of the business process, and can display all the links that the business has passed through, and each link separately displays the business volume, number of successes, number of failures and average delay.