Log processing method, system, device, equipment and storage medium
The log processing server matches and distributes the request log files of the load balancing server, which solves the problem of non-independent request forwarding information in the Nginx load balancing cluster and realizes independent log analysis and data security protection between project applications.
Patent Information
- Application Number
- CN202011201228.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-02
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-11-02
AI Technical Summary
In the Nginx load balancing cluster, the traditional logging method causes the request forwarding information between project applications to be inconsistent, making it difficult to independently analyze and protect data security.
The log processing server matches the associated information in the load balancing server's request log file with the forwarding rule information, generates and distributes independent request log files for each project application, and ensures that each project application can only see its own request forwarding status.
It improves the efficiency of log search and troubleshooting, ensures the independence and data security of each project application, and protects the privacy and security of project applications.
Smart Images

Figure CN112463751B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a log processing method, system, device, equipment and storage medium. Background Art
[0002] At present, major Internet companies mainly use Nginx servers as software load balancing to handle high-concurrency business requests. After receiving the client's request, the load balancing server forwards it to multiple back-end project application servers according to the set forwarding rules, and the project application servers are responsible for responding to the client's request. In this scenario, the forwarding records of all client requests are stored on the load balancing server responsible for forwarding. If there is a forwarding failure or the back-end application cannot handle it, it is necessary to find the request log on the load balancing server to analyze the cause of the forwarding failure.
[0003] Multiple load balancing servers are deployed in the Nginx load balancing cluster to process client requests in parallel. Therefore, requests belonging to the same project application will be dispersed to different load balancing servers in the cluster. When a project application needs to view the client's request forwarding status, it can only search all request logs in the cluster. In this way, the administrator of project application 1 will see the request access log of project application 2. However, each project application is independent of each other and should not be able to view each other's request forwarding information. Therefore, the traditional log recording method is not conducive to each project to independently analyze the application request status, and a more reliable and efficient solution is needed. Summary of the invention
[0004] In order to solve the problems of the prior art, the present application provides a log processing method, system, device, equipment and storage medium. The technical solution is as follows:
[0005] In one aspect, a log processing method is provided, the method comprising:
[0006] At least one load balancing server sends a request log file to a log processing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications;
[0007] The log processing server sends a request forwarding rule information query request to the at least one load balancing server;
[0008] The at least one load balancing server sends the request rule forwarding information to the log processing server;
[0009] The log processing server matches the associated information of each request in the request log file with the request rule forwarding information, and determines the project application to which the associated information of each request in the request log file belongs;
[0010] The log processing server generates a request log file for each project application based on the associated information of the requests belonging to the same project application;
[0011] The log processing server sends the request log file of each project application to the project application server corresponding to each project application.
[0012] On the other hand, a log processing method is provided, the method comprising:
[0013] Receiving a request log file sent by at least one load balancing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications;
[0014] Sending a request forwarding rule information query request to the at least one load balancing server;
[0015] Receiving request rule forwarding information sent by the at least one load balancing server;
[0016] Matching the association information of each request in the request log file with the request rule forwarding information to determine the project application to which the association information of each request in the request log file belongs;
[0017] Generate a request log file for each project application based on the associated information of the requests belonging to the same project application;
[0018] The request log file of each project application is sent to the project application server corresponding to each project application.
[0019] On the other hand, a log processing system is provided, the system comprising: at least one load balancing server, a log processing server and at least two project application servers:
[0020] The at least one load balancing server is used to send the request log file to the log processing server; send the request rule forwarding information to the log processing server;
[0021] The log processing server is used to receive the request log file; send a request forwarding rule information query request to the at least one load balancing server; receive the request forwarding rule information; match the associated information of each request in the request log file with the request rule forwarding information, and determine the project application to which the associated information of each request in the request log file belongs; based on the associated information of requests belonging to the same project application, generate a request log file for each project application; and send the request log file of each project application to the project application server corresponding to each project application respectively;
[0022] The at least two project application servers are used to respectively receive request log files of their respective project applications.
[0023] In another aspect, a log processing device is provided, the device comprising:
[0024] A request log receiving module, used to receive a request log file sent by at least one load balancing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications;
[0025] A rule forwarding information query request module, used to send a request forwarding rule information query request to the at least one load balancing server;
[0026] A rule forwarding information receiving module, used to receive the request rule forwarding information sent by the at least one load balancing server;
[0027] An information matching module, used to match the associated information of each request in the request log file with the request rule forwarding information, and determine the project application to which the associated information of each request in the request log file belongs;
[0028] A project application request log generation module, used to generate a request log file for each project application based on the associated information of requests belonging to the same project application;
[0029] The project application request log sending module is used to send the request log file of each project application to the project application server corresponding to each project application.
[0030] On the other hand, a log processing device is provided, characterized in that the device includes a processor and a memory, the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the log processing method as described above.
[0031] On the other hand, a computer-readable storage medium is provided, characterized in that at least one instruction or at least one program is stored in the storage medium, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the log processing method as described above.
[0032] The log processing method, system, device, equipment and storage medium provided by this application have the following technical effects:
[0033] This application splits the request log file of the load balancing server according to the rule forwarding information based on a specific rule matching algorithm, and sends the split log information to the corresponding project application server. On the one hand, it improves the efficiency of log search for abnormal requests and troubleshooting application failures. On the other hand, it ensures the independence and confidentiality between various project applications and protects the security of various project applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0035] Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application;
[0036] Figure 2 It is a flow chart of a log processing method provided by an embodiment of the present application;
[0037] Figure 3 It is a schematic diagram of the process of generating a request log file provided by an embodiment of the present application;
[0038] Figure 4 is a flow chart of another log processing method provided by an embodiment of the present application;
[0039] Figure 5 It is a schematic diagram of a log processing device provided in an embodiment of the present application;
[0040] Figure 6 This is a hardware structure block diagram of a log processing server that provides a log processing method according to an embodiment of the present application. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0042] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0043] See also Figure 1 , Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application, such as Figure 1 As shown, the above application environment includes a client 01 , a load balancing server 02 , a log processing server 03 and a project application server 04 .
[0044] Specifically, the client 01 may include physical devices such as smart phones, desktop computers, tablet computers, laptops, digital assistants, smart wearable devices, etc., and may also include software running in physical devices, such as applications (APPs), web pages, WeChat applets, etc. Specifically, the client 01 may send an access request to the load balancing server.
[0045] Specifically, the load balancing server 02 may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers. The load balancing server 02 may include a network communication unit, a processor, a memory, etc. Specifically, the load balancing server 02 may receive an access request sent by a client; forward the received access request to a corresponding project application server based on local request rule forwarding information; record the associated information of the received request to a request log file; send the above request log file to a log processing server; send the request rule forwarding information to the log processing server.
[0046] Specifically, the log processing server 03 may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers. The log processing server 03 may include a network communication unit, a processor, a memory, etc. Specifically, the log processing server 03 may receive the above-mentioned request log file; send the above-mentioned request forwarding rule information query request to the load balancing server; receive the above-mentioned request forwarding rule information; match the association information of each request in the above-mentioned request log file with the above-mentioned request rule forwarding information, and determine the project application to which the association information of each request in the above-mentioned request log file belongs; based on the association information of the requests belonging to the same project application, generate a request log file for each project application; send the request log file of each project application to the project application server corresponding to each project application respectively.
[0047] Specifically, the project application server 04 may include two independently running servers, or a distributed server, or a server cluster composed of multiple servers. The project application server 04 may include a network communication unit, a processor, a memory, etc. Specifically, the project application server 04 may receive access requests forwarded by a load balancing server; and receive request log files of project applications sent by a log processing server.
[0048] The following describes a log processing method provided by an embodiment of the present application. Figure 2 A flow chart of a log processing method provided for an embodiment of the present application. It should be noted that this specification provides method operation steps as described in the embodiment or flow chart, but more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the system or product is executed in practice, it can be executed in the order shown in the embodiment or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, Figure 2 As shown, the above method may include:
[0049] S201, sending a request log file, wherein the request log file sent by any one of at least one load balancing server includes correlation information of requests corresponding to at least two project applications.
[0050] In the embodiment of this specification, after receiving the access request from the client and forwarding the access request to the corresponding project application server, the load balancing server will generate a corresponding request log file, specifically, Figure 3 As shown, generating a request log file may include:
[0051] S301: Receive an access request sent by at least one client.
[0052] S303: Each of the received access requests is forwarded to the corresponding project application server based on the local request rule forwarding information.
[0053] In actual applications, each of the at least one load balancing server is preset with its own load balancing forwarding rule. Specifically, the load balancing forwarding rule is a rule for scheduling the client's request through the load balancing server and forwarding the request to the corresponding project application server according to the load condition of each project application server.
[0054] The rule forwarding information represents the mapping relationship between the project application server receiving the access request and the access request. The project application server receiving the access request is determined according to the load of each project application server in the project application service cluster corresponding to the project application. Specifically, the rule forwarding information may include but is not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request and the URL (Uniform Resource Locator) of the request.
[0055] After receiving the access request from the at least one client, the at least one load balancing server forwards information based on local rules, selects one of the at least two project application servers at the back end, and forwards the access request to the selected project application server for processing.
[0056] S305: Record the associated information of the respectively received requests into a request log file.
[0057] In the embodiment of this specification, after receiving the access request, the load balancing server will forward the access request. In actual application, the access request may be forwarded successfully or unsuccessfully. Accordingly, the request log file includes a request forwarding success log file or a request forwarding failure log file.
[0058] Specifically, when the request is forwarded successfully, the at least one load balancing server records the associated information of the request forwarded successfully to a request forwarding success log file, and sends the request forwarding success log file to the log processing server.
[0059] Correspondingly, the associated information of the above-mentioned successfully forwarded request may include, but is not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, the URL (Uniform Resource Locator) of the request, the status code returned by the application after the request is forwarded to the back-end application, the initiation time of the request, the request success record, the time taken to complete the request forwarding, etc.
[0060] When request forwarding fails, the at least one load balancing server records the associated information of the respective requests that failed to be forwarded into a request forwarding failure log file, and sends the request forwarding failure log file to the log processing server.
[0061] Correspondingly, the associated information of the above-mentioned request that failed to be forwarded may include, but is not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, the URL (Uniform Resource Locator) of the request, the status code returned by the application after the request is forwarded to the back-end application, the initiation time of the request, the request failure record, the reason for the request failure, etc.
[0062] In the embodiment of the present specification, the at least one load balancing server sends the request log file to the log processing server at a preset time interval. Specifically, the preset time interval is customized by the system administrator, for example, it can be thirty minutes or one hour.
[0063] S203, sending a request for querying forwarding rule information.
[0064] In some embodiments, the log processing server sends a request forwarding rule information query request to the at least one load balancing server every the preset time.
[0065] S205, sending request rule forwarding information.
[0066] In some embodiments, the at least one load balancing server sends request rule forwarding information to the log processing server every preset time.
[0067] S207, matching the association information of each request in the request log file with the request rule forwarding information, and determining the project application to which the association information of each request in the request log file belongs.
[0068] In some embodiments, when the at least one load balancing server includes only one load balancing server, the log processing server matching the association information of each request in the request log file with the request rule forwarding information may include:
[0069] 1) The log processing server reads the associated information of each request in the above request log file;
[0070] 2) The log processing server matches the associated information of each request in the request log file with the request rule forwarding information based on a preset matching field, and determines the project application to which the associated information of each request in the request log file belongs.
[0071] Specifically, the above matching fields may include but are not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request. The above matching fields are used to match the association information of the request with the forwarding information of the request rule, and the project application to which the request belongs is determined based on the three pieces of information: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request.
[0072] In some other embodiments, when the at least one load balancing server includes at least two load balancing servers, before the log processing server matches the association information of each request in the request log file with the request rule forwarding information, the log processing method further includes:
[0073] The log processing server renames the received request log files according to the identification information of the corresponding load balancing server to obtain the identification information of each of the received request log files.
[0074] Specifically, the above-mentioned identification information can be used to distinguish different load balancing servers and different request log files. For example, the identification information of the load balancing server can be: the first load balancing server, the second load balancing server, the third load balancing server, etc.; accordingly, the identification information of each of the received request log files can be: the request log file of the first load balancing server, the request log file of the second load balancing server, the request log file of the third load balancing server, etc.
[0075] In an embodiment of the present specification, when the at least one load balancing server includes at least two load balancing servers, the received request log file is renamed according to the identification information of the corresponding load balancing server so that in the following information matching process, the associated information of each request in each request log file can be matched with the request rule forwarding information of the corresponding load balancing server.
[0076] The log processing server matches the associated information of each request in the request log file with the request rule forwarding information, and determines the project application to which the associated information of each request in the request log file belongs, which may include:
[0077] 1) The log processing server reads the associated information of each request in each request log file;
[0078] 2) Based on the identification information and matching fields of the received request log files, the log processing server matches the associated information of each request in each request log file with the corresponding request rule forwarding information, and determines the project application to which the associated information of each request in each request log file belongs.
[0079] Specifically, the above matching fields may include but are not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request. The above matching fields are used to match the associated information of each request in each request log file with the corresponding request rule forwarding information of the load balancing server, and determine the project application to which the request belongs based on the three information of the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request.
[0080] S209: Generate a request log file for each project application based on the associated information of the requests belonging to the same project application.
[0081] In the embodiment of the present specification, the log processing server generates a request log file for each project application based on the associated information of the requests belonging to the same project application, including:
[0082] 1) The log processing server sorts the associated information of requests belonging to the same project application in ascending chronological order;
[0083] 2) The log processing server generates a request log file for each project application based on the associated information of the requests belonging to the same project application after ascending sorting.
[0084] In some embodiments, the at least two load balancing servers process the requests of the at least one client in parallel, and there may be a situation where the requests belonging to the same project application are forwarded by different load balancing servers. Therefore, the log processing server can sort the associated information of the requests belonging to the same project application in ascending chronological order, and then generate a request log file for each project application for aggregation.
[0085] S211, sending the request log file of each project application to the project application server corresponding to each project application.
[0086] In actual applications, when the project application administrator needs to count the number of application request visits, whether the requests are abnormal, and other information, he can log in to the project application server and open the request log file of his own project application for analysis.
[0087] In actual applications, the load balancing server repeatedly sends request log files to the log processing server, and the log processing server repeatedly queries the request rule forwarding information of the corresponding load balancing server, splits the request log files and sends them to the corresponding project application server.
[0088] The present application also provides another log processing method. Figure 4 It is a flowchart of another log processing method provided by an embodiment of the present application. It should be noted that this specification provides method operation steps as described in the embodiment or flowchart, but more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the system or product is executed in practice, it can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment) according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 4 As shown, the above method may include:
[0089] S401, receiving a request log file sent by at least one load balancing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications.
[0090] In the embodiment of this specification, after receiving the access request, the load balancing server will forward the access request. In actual application, the access request may be forwarded successfully or unsuccessfully. Accordingly, the request log file received by the log processing server includes a request forwarding success log file or a request forwarding failure log file.
[0091] Specifically, when the request is forwarded successfully, the at least one load balancing server records the associated information of the request forwarded successfully to a request forwarding success log file, and the log processing server receives the request forwarding success log file sent by the at least one load balancing server.
[0092] Correspondingly, the associated information of the above-mentioned successfully forwarded request may include, but is not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, the URL (Uniform Resource Locator) of the request, the status code returned by the application after the request is forwarded to the back-end application, the initiation time of the request, the request success record, the time taken to complete the request forwarding, etc.
[0093] When request forwarding fails, the at least one load balancing server records the associated information of the respective failed requests in a request forwarding failure log file, and the log processing server receives the request forwarding failure log file sent by the at least one load balancing server.
[0094] Correspondingly, the associated information of the above-mentioned request that failed to be forwarded may include, but is not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, the URL (Uniform Resource Locator) of the request, the status code returned by the application after the request is forwarded to the back-end application, the initiation time of the request, the request failure record, the reason for the request failure, etc.
[0095] In the embodiment of the present specification, the log processing server receives the request log file sent by the at least one load balancing server at a preset time interval. Specifically, the preset time is customized by the system administrator, for example, it can be thirty minutes or one hour.
[0096] S403: Send a request forwarding rule information query request to the at least one load balancing server.
[0097] In actual applications, the rule forwarding information represents the mapping relationship between the project application server receiving the access request and the access request. The project application server receiving the access request is determined according to the load of each project application server in the project application service cluster corresponding to the project application. Specifically, the rule forwarding information may include but is not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, or the URL (Uniform Resource Locator) of the request.
[0098] In some embodiments, the log processing server sends a request forwarding rule information query request to the at least one load balancing server every the preset time.
[0099] S405: Receive request rule forwarding information sent by the at least one load balancing server.
[0100] In some embodiments, the log processing server receives the request rule forwarding information sent by the at least one load balancing server at every preset time.
[0101] S407, matching the association information of each request in the request log file with the request rule forwarding information, and determining the project application to which the association information of each request in the request log file belongs.
[0102] In some embodiments, when the at least one load balancing server includes only one load balancing server, the log processing server matching the association information of each request in the request log file with the request rule forwarding information may include:
[0103] 1) The log processing server reads the associated information of each request in the above request log file;
[0104] 2) The log processing server matches the associated information of each request in the request log file with the request rule forwarding information based on a preset matching field, and determines the project application to which the associated information of each request in the request log file belongs.
[0105] Specifically, the above matching fields may include but are not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request. The above matching fields are used to match the association information of the request with the forwarding information of the request rule, and the project application to which the request belongs is determined based on the three pieces of information: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request.
[0106] In some other embodiments, when the at least one load balancing server includes at least two load balancing servers, before the log processing server matches the association information of each request in the request log file with the request rule forwarding information, the log processing method further includes:
[0107] The log processing server renames the received request log files according to the identification information of the corresponding load balancing server to obtain the identification information of each of the received request log files.
[0108] Specifically, the above-mentioned identification information can be used to distinguish different load balancing servers and different request log files. For example, the identification information of the load balancing server can be: the first load balancing server, the second load balancing server, the third load balancing server, etc.; accordingly, the identification information of each of the received request log files can be: the request log file of the first load balancing server, the request log file of the second load balancing server, the request log file of the third load balancing server, etc.
[0109] In an embodiment of the present specification, when the at least one load balancing server includes at least two load balancing servers, the received request log file is renamed according to the identification information of the corresponding load balancing server so that in the following information matching process, the associated information of each request in each request log file can be matched with the request rule forwarding information of the corresponding load balancing server.
[0110] The log processing server matches the associated information of each request in the request log file with the request rule forwarding information, and determines the project application to which the associated information of each request in the request log file belongs, which may include:
[0111] 1) The log processing server reads the associated information of each request in each request log file;
[0112] 2) Based on the identification information and matching fields of the received request log files, the log processing server matches the associated information of each request in each request log file with the corresponding request rule forwarding information, and determines the project application to which the associated information of each request in each request log file belongs.
[0113] Specifically, the above matching fields may include but are not limited to: the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request. The above matching fields are used to match the associated information of each request in each request log file with the corresponding request rule forwarding information of the load balancing server, and determine the project application to which the request belongs based on the three information of the source IP (Internet Protocol) of the request, the destination IP (Internet Protocol) of the request, and the URL (Uniform Resource Locator) of the request.
[0114] S409: Generate a request log file for each project application based on the associated information of the requests belonging to the same project application.
[0115] In the embodiment of the present specification, the log processing server generates a request log file for each project application based on the associated information of the requests belonging to the same project application, including:
[0116] 1) The log processing server sorts the associated information of requests belonging to the same project application in ascending chronological order;
[0117] 2) The log processing server generates a request log file for each project application based on the associated information of the requests belonging to the same project application after ascending sorting.
[0118] In some embodiments, the at least two load balancing servers process the requests of the at least one client in parallel, and there may be a situation where the requests belonging to the same project application are forwarded by different load balancing servers. Therefore, the log processing server can sort the associated information of the requests belonging to the same project application in ascending chronological order, and then generate a request log file for each project application for aggregation.
[0119] S411, sending the request log file of each project application to the project application server corresponding to each project application.
[0120] In actual applications, when the project application administrator needs to count the number of application request visits, whether the requests are abnormal, and other information, he can log in to the project application server and open the request log file of his own project application for analysis.
[0121] In actual applications, the log processing server repeatedly receives the request log files sent by the load balancing server, and then repeatedly queries the request rule forwarding information of the corresponding load balancing server, splits the request log files and sends them to the corresponding project application servers.
[0122] The present application also provides a log processing system for implementing Figure 2 The method shown. This system embodiment corresponds to the aforementioned method embodiment and can implement all the contents in the aforementioned method embodiment. For ease of reading, this system embodiment only provides a summary description of the contents in the aforementioned method embodiment, and does not repeat the details in the method embodiment one by one. The above system includes: at least one client, at least one load balancing server, a log processing server and at least two project application servers:
[0123] The at least one client is used to send an access request to the at least one load balancing server;
[0124] The at least one load balancing server is configured to receive access requests sent by the at least one client; forward the received access requests to corresponding project application servers based on local request rule forwarding information; record the associated information of the received requests to request log files; send request log files to the log processing server; send request rule forwarding information to the log processing server;
[0125] The log processing server is used to receive the request log file; send a request forwarding rule information query request to the at least one load balancing server; receive the request forwarding rule information; match the associated information of each request in the request log file with the request rule forwarding information, and determine the project application to which the associated information of each request in the request log file belongs; generate a request log file for each project application based on the associated information of requests belonging to the same project application; and send the request log file of each project application to the project application server corresponding to each project application respectively;
[0126] The at least two project application servers are used to respectively receive the access requests forwarded by the at least one load balancing server, and respectively receive request log files of their respective project applications.
[0127] From the above description, it can be seen that in the embodiment of the present application, the at least one client in the log processing system sends a request to the at least one load balancing server; the at least one load balancing server forwards the received request to the corresponding project application server based on the local request rule forwarding information, and then records the associated information of the received request to the request log file and sends the request log file to the log processing server; the log processing server queries the rule forwarding information of the at least one load balancing server, and then matches the associated information of each request in the request log file with the request rule forwarding information, determines the project application to which the associated information of each request in the request log file belongs, and generates a request log file for each project application based on the associated information of the requests belonging to the same project application, that is, the full request log file of the load balancing server is split into the request log file of each project application, which is convenient for each project application administrator to perform daily request log search and application troubleshooting; finally, the request log file of each project application is sent to the project application server corresponding to each project application, which ensures that each project application administrator can only see the request forwarding status of his own application, and protects the privacy and security of each project application.
[0128] The present application also provides another log processing system for implementing Figure 4 The method shown. This system embodiment corresponds to the aforementioned method embodiment and can implement all the contents in the aforementioned method embodiment. For ease of reading, this system embodiment only provides a summary description of the contents in the aforementioned method embodiment, and does not repeat the details in the method embodiment one by one. The above system includes: at least one load balancing server, a log processing server and at least two project application servers:
[0129] The at least one load balancing server is used to send the request log file to the log processing server; send the request rule forwarding information to the log processing server;
[0130] The log processing server is used to receive the request log file; send a request forwarding rule information query request to the at least one load balancing server; receive the request forwarding rule information; match the associated information of each request in the request log file with the request rule forwarding information, and determine the project application to which the associated information of each request in the request log file belongs; generate a request log file for each project application based on the associated information of requests belonging to the same project application; and send the request log file of each project application to the project application server corresponding to each project application respectively;
[0131] The at least two project application servers are used to respectively receive request log files of their respective project applications.
[0132] From the above description, it can be seen that in the embodiment of the present application, the at least one load balancing server in the log processing system sends the request log file to the log processing server; the log processing server queries the rule forwarding information of the at least one load balancing server, and then matches the associated information of each request in the request log file with the request rule forwarding information, determines the project application to which the associated information of each request in the request log file belongs, and generates a request log file for each project application based on the associated information of the requests belonging to the same project application, that is, splits the full request log file of the load balancing server into the request log file of each project application, so as to facilitate the administrators of each project application to perform daily request log search and application troubleshooting; finally, the request log file of each project application is sent to the project application server corresponding to each project application, and each project application administrator can only see the request forwarding status of his own application, which ensures the independence of each project application and protects the security of each project application.
[0133] The present application also provides a log processing device, such as Figure 5 As shown, the above device comprises:
[0134] The request log receiving module 510 is used to receive a request log file sent by at least one load balancing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications;
[0135] A rule forwarding information query request module 520 is used to send a request rule forwarding information query request to the at least one load balancing server;
[0136] A rule forwarding information receiving module 530 is used to receive the request rule forwarding information sent by the at least one load balancing server;
[0137] An information matching module 540 is used to match the associated information of each request in the request log file with the request rule forwarding information to determine the project application to which the associated information of each request in the request log file belongs;
[0138] A project application request log generation module 550, for generating a request log file for each project application based on the associated information of the requests belonging to the same project application;
[0139] The project application request log sending module 560 is used to send the request log file of each project application to the project application server corresponding to each project application.
[0140] In the embodiment of this specification, the request log receiving module 510 may include:
[0141] A request forwarding success log receiving unit, used to receive the request forwarding success log file sent by the at least one load balancing server;
[0142] The request forwarding failure log receiving unit is used to receive the request forwarding failure log file sent by the at least one load balancing server.
[0143] In the embodiment of this specification, the information matching module 540 may include:
[0144] An information reading unit, used to read the associated information of each request in the above request log file;
[0145] The information matching unit is used to match the associated information of each request in the above request log file with the above request rule forwarding information based on a preset matching field, and determine the project application to which the associated information of each request in the above request log file belongs.
[0146] In the embodiment of this specification, the project application request log generation module 550 may include:
[0147] An information sorting unit, used to sort the associated information of the requests belonging to the same project application in ascending chronological order;
[0148] The log generating unit is used to generate a request log file of each project application according to the ascending sorted associated information of the requests belonging to the same project application.
[0149] In an embodiment of the present application, the log processing device may further include:
[0150] The module for obtaining log identification information is used to rename the received request log files according to the identification information of the corresponding load balancing server to obtain the identification information of each of the received request log files.
[0151] The device and method embodiments in the above-mentioned device embodiments are based on the same application concept.
[0152] An embodiment of the present application provides a log processing device, which includes a processor and a memory, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the log processing method provided in the above method embodiment.
[0153] The memory can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required for functions, etc.; the data storage area can store data created according to the use of the above devices, etc. In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0154] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal, a server or a similar computing device, that is, the above-mentioned computer device can include a mobile terminal, a computer terminal, a server or a similar computing device. Taking running on a server as an example, Figure 6 1 is a hardware structure diagram of a log processing server of a log processing method provided in an embodiment of the present application. Figure 6As shown, the log processing server 600 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 610 (the processor 610 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 630 for storing data, and one or more storage media 620 (such as one or more mass storage devices) for storing application programs 623 or data 622. Among them, the memory 630 and the storage medium 620 can be short-term storage or permanent storage. The program stored in the storage medium 620 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 610 may be configured to communicate with the storage medium 620 and execute a series of instruction operations in the storage medium 620 on the log processing server 600. The log processing server 600 may also include one or more power supplies 660, one or more wired or wireless network interfaces 650, one or more input and output interfaces 640, and / or one or more operating systems 621, such as Windows ServerTM, Mac OSXTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0155] The input-output interface 640 can be used to receive or send data via a network. The above-mentioned network specific example may include a wireless network provided by a communication provider of the log processing server 600. In one example, the input-output interface 640 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the input-output interface 640 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.
[0156] It can be understood by those skilled in the art that Figure 6 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 6 More or fewer components as shown, or with Figure 6 Different configurations are shown.
[0157] An embodiment of the present application also provides a storage medium, which can be set in a server to store at least one instruction, at least one program, code set or instruction set related to a log processing method in one of the method embodiments. The at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement the log processing method provided in the above method embodiment.
[0158] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0159] It can be seen from the embodiments of the log processing method, system, device, equipment or storage medium provided by the present application that the log processing method in the present application can receive a request log file sent by at least one load balancing server, and the request log file sent by any one of the at least one load balancing server includes the association information of requests corresponding to at least two project applications; then send a request rule forwarding information query request to the at least one load balancing server, receive the request rule forwarding information sent by the at least one load balancing server, and obtain the project application to which the association information of each request belongs by querying the request forwarding rule information; then match the association information of each request in the request log file with the request rule forwarding information, determine the project application to which the association information of each request in the request log file belongs, and generate a request log file for each project application based on the association information of the requests belonging to the same project application, that is, split the full request log file in the load balancing server into request log files of different project applications; finally, send the request log file of each project application to the project application server corresponding to each project application, thereby ensuring the independence between each project application and protecting the security of each project application. When the project application administrator needs to count the number of application request visits, whether the requests are abnormal, and other information, he can log in to the project application server and open his own project application request log file for analysis, which improves the efficiency of searching for abnormal requests in the log and troubleshooting application failures.
[0160] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0161] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0162] A person skilled in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by instructing the relevant hardware through a program, and the above program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0163] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A log processing method, characterized in that: The method comprises: At least one load balancing server sends a request log file to the log processing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications; The log processing server sends a request rule forwarding information query request to the at least one load balancing server; The at least one load balancing server sends request rule forwarding information to the log processing server, wherein the request rule forwarding information represents a mapping relationship between a project application server receiving a request and a forwarded request; The log processing server matches the associated information of each request in each request log file with the request rule forwarding information corresponding to the identification information based on the identification information corresponding to each request log file, and determines the project application to which the associated information of each request in each request log file belongs, and the identification information corresponding to each request log file is used to identify the load balancing server that sends the corresponding request log file; The log processing server generates a request log file for each project application based on the associated information of the requests belonging to the same project application; The log processing server sends the request log file of each project application to the project application server corresponding to each project application.
2. A log processing method, characterized in that: The method comprises: Receiving a request log file sent by at least one load balancing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications; Sending a request rule forwarding information query request to the at least one load balancing server; Receiving request rule forwarding information sent by the at least one load balancing server, wherein the request rule forwarding information represents a mapping relationship between a project application server receiving a request and a forwarded request; Based on the identification information corresponding to each request log file, the associated information of each request in each request log file is matched with the request rule forwarding information corresponding to the identification information, and the project application to which the associated information of each request in each request log file belongs is determined, and the identification information corresponding to each request log file is used to identify the load balancing server that sends the corresponding request log file; Generate a request log file for each project application based on the associated information of the requests belonging to the same project application; The request log file of each project application is sent to the project application server corresponding to each project application.
3. The method according to claim 2, characterized in that The request log file includes a request forwarding success log file or a request forwarding failure log file; The receiving of a request log file sent by at least one load balancing server includes: Receiving the request forwarding success log file sent by the at least one load balancing server; or, Receive the request forwarding failure log file sent by the at least one load balancing server.
4. The method according to claim 2 or 3, characterized in that: The receiving of the request log file sent by at least one load balancing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications, includes: Receiving the request log file sent by the at least one load balancing server at a preset time interval; The sending of the request rule forwarding information query request to the at least one load balancing server comprises: Sending the request rule forwarding information query request to the at least one load balancing server at the preset time interval; The receiving the request rule forwarding information sent by the at least one load balancing server includes: The request rule forwarding information sent by the at least one load balancing server is received every preset time.
5. The method according to claim 2 or 3, characterized in that: When the at least one load balancing server includes at least two load balancing servers, before matching the associated information of each request in each request log file with the request rule forwarding information corresponding to the identification information based on the identification information corresponding to each request log file, and determining the project application to which the associated information of each request in each request log file belongs, the method further includes: Rename each received request log file according to the identification information of the corresponding load balancing server to obtain the identification information corresponding to each request log file; The step of matching the associated information of each request in each request log file with the request rule forwarding information corresponding to the identification information based on the identification information corresponding to each request log file, and determining the project application to which the associated information of each request in each request log file belongs includes: Based on the identification information and matching fields corresponding to each request log file, the associated information of each request in each request log file is matched with the corresponding request rule forwarding information to determine the project application to which the associated information of each request in each request log file belongs.
6. The method according to any one of claims 2 to 3, characterized in that: The step of generating a request log file for each project application based on the associated information of the requests belonging to the same project application includes: Sort the associated information of requests belonging to the same project application in ascending chronological order; A request log file for each project application is generated according to the associated information of the requests belonging to the same project application after ascending sorting.
7. A log processing system, characterized in that: The system includes: at least one load balancing server, a log processing server and at least two project application servers: The at least one load balancing server is used to send a request log file to the log processing server, wherein the request log file includes association information of requests corresponding to at least two project applications; send request rule forwarding information to the log processing server, wherein the request rule forwarding information represents a mapping relationship between a project application server receiving a request and a forwarded request; The log processing server is used to receive the request log file; send a request rule forwarding information query request to the at least one load balancing server; receive the request rule forwarding information; based on the identification information corresponding to each request log file, match the associated information of each request in each request log file with the request rule forwarding information corresponding to the identification information, and determine the project application to which the associated information of each request in each request log file belongs, and the identification information corresponding to each request log file is used to identify the load balancing server that sends the corresponding request log file; based on the associated information of requests belonging to the same project application, generate a request log file for each project application; and send the request log file of each project application to the project application server corresponding to each project application; The at least two project application servers are used to respectively receive request log files of their respective project applications.
8. A log processing device, characterized in that: The device comprises: A request log receiving module, used to receive a request log file sent by at least one load balancing server, wherein the request log file sent by any one of the at least one load balancing server includes association information of requests corresponding to at least two project applications; A rule forwarding information query request module, used to send a request rule forwarding information query request to the at least one load balancing server; A rule forwarding information receiving module, used to receive the request rule forwarding information sent by the at least one load balancing server, wherein the request rule forwarding information represents a mapping relationship between the project application server receiving the request and the forwarded request; An information matching module is used to match the associated information of each request in each request log file with the request rule forwarding information corresponding to the identification information based on the identification information corresponding to each request log file, and determine the project application to which the associated information of each request in each request log file belongs, wherein the identification information corresponding to each request log file is used to identify the load balancing server that sends the corresponding request log file; A project application request log generation module, used to generate a request log file for each project application based on the associated information of requests belonging to the same project application; The project application request log sending module is used to send the request log file of each project application to the project application server corresponding to each project application.
9. A log processing device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the log processing method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the log processing method according to any one of claims 1 to 6.
