Monitoring log processing method, device, equipment and storage medium
By setting up a local array in the terminal device, cyclically judging and deleting regular logs, and uploading only when storing abnormal logs, the problem of excessive resource and traffic consumption caused by a variety of monitoring log types is solved, resources and traffic are saved, and monitoring efficiency is improved.
Patent Information
- Application Number
- CN202011489454.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-16
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2040-12-16
AI Technical Summary
In the existing technology, the types of monitoring logs are diverse and complex, resulting in excessive consumption of server resources and traffic, which is difficult to save effectively.
By setting a local array in the terminal device, the number of regular logs is cyclically determined and deleted when the preset number is reached. Only abnormal logs are uploaded to the log processing server to reduce traffic consumption.
It effectively saves server processing resources and traffic, reduces the processing volume of log processing servers, reduces operation and maintenance costs, and improves monitoring efficiency.
Smart Images

Figure CN112527600B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud monitoring technology, applied to the field of log monitoring applications, and in particular to a monitoring log processing method, device, equipment and storage medium. Background Art
[0002] With the advancement of information technology, the application scenarios of smart devices such as computers are becoming increasingly diverse, and the variety of applications running on these devices is also increasing. However, errors are inevitable during actual operation. As front-end devices, it is crucial to ensure the stability and proper operation of the smart devices used by users. Therefore, developers often use logging systems to monitor the front-end's operating status and operation content, generating various monitoring logs. For example, in banking front-ends, the logging system plays a crucial monitoring role in troubleshooting anomalies during front-end development.
[0003] In existing technologies, most monitoring logs are regularly uploaded to a monitoring log server (also known as the backend) to facilitate developers' access to the logs and identify issues. However, the diverse and complex nature of the uploaded monitoring logs places high demands on the processing capabilities of the monitoring log server, hindering the conservation of server resources and data traffic. Summary of the Invention
[0004] The present invention relates to the field of cloud monitoring technology and is applied to the field of log monitoring applications. In particular, it provides a monitoring log processing method, device, computer equipment and computer-readable storage medium to solve the problem in the prior art that is not conducive to saving server resources and saving traffic.
[0005] A monitoring log processing method, comprising:
[0006] Acquire the monitoring logs of the business front-end system in real time according to the preset log embedding points, and store the monitoring logs in a local array;
[0007] Determine a log type of the monitoring log in the local array, where the log type includes a regular log;
[0008] According to the log type of the monitoring log in the local array, cyclically determining whether the number of the regular logs in the local array exceeds a preset number;
[0009] If the number of the regular logs in the local array exceeds the preset number, deleting the regular logs in the local array until the number of the regular logs in the local array is less than the preset number;
[0010] When the local array stores abnormal logs, all monitoring logs in the local array are uploaded to the log processing server.
[0011] A monitoring log processing device, comprising:
[0012] The acquisition module is used to obtain the client's monitoring logs in real time according to the preset log embedding points;
[0013] A storage module, configured to store the monitoring log in a local array created by the client;
[0014] A determination module, configured to determine a log type of the monitoring log in the local array, wherein the log type includes a regular log;
[0015] a judging module, configured to cyclically judge whether the number of the regular logs in the local array exceeds a preset number according to the log type of the monitoring log in the local array;
[0016] a deleting module, configured to delete the regular logs of the local array if the number of the regular logs in the local array exceeds the preset number, until the number of the regular logs in the local array is less than the preset number;
[0017] The uploading module is used to upload all monitoring logs in the local array to the log processing server when the local array stores abnormal logs.
[0018] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the monitoring log processing method are implemented.
[0019] A computer-readable storage medium stores a computer program, which implements the steps of the monitoring log processing method when executed by a processor.
[0020] In one solution provided by the aforementioned monitoring log processing method, apparatus, computer device, and storage medium, a local array is set up and looped to discard info-type logs, thereby conserving data traffic. This reduces the log processing workload of the log processing server, conserving backend server processing resources and reducing computing power. Furthermore, when abnormal logs such as warn or error are encountered, they are uploaded to the log processing server. This reduces terminal device data traffic and the processing resources of the log processing server, reducing overall log monitoring operation and maintenance costs. Due to the reduced amount of data transmitted, packet loss can also be reduced to a certain extent, effectively improving monitoring efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] Figure 1 This is a schematic diagram of an application environment of a monitoring log processing method according to an embodiment of the present invention;
[0023] Figure 2 This is a flow chart of a monitoring log processing method according to an embodiment of the present invention;
[0024] Figure 3 yes Figure 2 A schematic diagram of a specific implementation of storing the monitoring log in the local array in step S10;
[0025] Figure 4 This is another flowchart of a monitoring log processing method according to one embodiment of the present invention;
[0026] Figure 5 yes Figure 2 A schematic diagram of a specific implementation of step S50;
[0027] Figure 6 It is a structural diagram of a monitoring log processing device according to an embodiment of the present invention;
[0028] Figure 7 It is a structural diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0030] The monitoring log processing method provided by the embodiment of the present invention can be applied in Figure 1The application environment includes developers, front-end users, terminal devices, business front-end systems, log processing servers, Catlog servers, and Catlog dashboards. The business front-end system is a system running on the terminal device. The business front-end system is used to provide business services to front-end users. It can refer to a variety of business service types. The specific business service types are not limited. For example, a business front-end system can provide a certain loan service. Developers refer to people who develop the business front-end system. Front-end users can operate the business page of the business front-end system. The business page will respond according to the front-end user operation. For example, click on a certain area of the business page to enter another business page. This is the process of the business front-end system responding. In the process of the front-end user operating the business page, relevant monitoring logs will be generated. The terminal device communicates with the log processing server and exchanges data / new signaling. The terminal device is used to upload the generated monitoring logs to the log processing server. In the process, the log processing server will feedback the log acceptance results such as whether the monitoring log is successfully accepted to the terminal device. The log processing server can write the monitoring log uploaded by the terminal device into the Catlog system of the Catlog server. The Catlog server can respond to the monitoring log writing results in real time. After that, the developer can view the content of the front-end log data through the Catlog dashboard. The Catlog dashboard will query the monitoring log data from the Catlog server according to the developer's frequent viewing, and return the monitoring log data to the Catlog dashboard, so that the Catlog dashboard will feedback the viewing response results to the developer, that is, display the viewing response results to the developer, so that the developer can analyze the monitoring log and thus analyze and process the usage of the business front-end system.
[0031] The terminal device may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the log processing server may be implemented using an independent server or a server cluster consisting of multiple servers.
[0032] In one embodiment, if Figure 2 As shown, a monitoring log processing method is provided, which is applied in Figure 1 In the terminal device, the following steps are included:
[0033] S10: Acquire the monitoring log of the business front-end system in real time according to the preset log burial point, and store the monitoring log in a local array.
[0034] The preset log tracking points are tracking points deployed in the business front-end system based on the monitoring log monitoring strategy. In an embodiment of the present invention, the tracking points can be deployed in the form of embedded tracking point codes in the business front-end business system application, so that when the front-end user uses the business front-end system, the corresponding monitoring logs can be obtained by using the tracking points.
[0035] Among them, monitoring logs refer to some record logs when front-end users use the front-end business system. The monitoring logs include but are not limited to various data, such as: the number of business page views or clicks in the front-end business system; the time the front-end user stays on each business page; the entrance through which the front-end user accesses the business page; the behavior triggered by the front-end user in the corresponding business page, etc.
[0036] It should be noted that in the embodiments of the present invention, a business page refers to any business page used by the front-end business system to provide business services to front-end users. Taking the loan business as an example, the loan business system may include different business pages such as the loan application page, loan status page, and loan details page. When the front-end user's related behavior on these business pages meets the preset tracking trigger conditions, the related behavior is recorded, thereby generating a monitoring log.
[0037] In this step, after obtaining the monitoring log of the business front-end system in real time according to the preset log tracking point, the monitoring log of the business front-end system will be stored in a local array. The local array is a local array created by the terminal device.
[0038] S20: Determine the log type of the monitoring log in the local array, where the log type includes a regular log.
[0039] Depending on the monitoring data, monitoring logs have different log types, usually including regular logs and exception logs. In one application scenario, the regular type logs include info type logs, and the exception logs include warn type logs and error type logs.
[0040] In an embodiment of the present invention, after the monitoring logs are stored in the local array, the log types of the monitoring logs in the local array are determined. For example, if there are monitoring logs 1, 2, 3, 4, and N, the log types of monitoring logs 1-N are determined respectively.
[0041] S30: According to the log type of the monitoring log in the local array, cyclically determine whether the number of the regular logs in the local array exceeds a preset number.
[0042] In this step, after determining the log type of the monitoring log in the local array, a loop is performed to determine whether the number of regular logs in the local array exceeds a preset number based on the log type of the monitoring log in the local array. It should be noted that since the monitoring logs stored in the local array are stored in real time, the type and number of monitoring logs in the local array may be constantly changing. Therefore, in this step, it is necessary to continuously loop to determine whether the number of regular logs in the local array exceeds the preset number.
[0043] There is no specific limit to the preset number. After verification, in one application scenario, the preset number is optimally in the range of 4-10. For example, a loop is used to determine whether the number of regular logs in the local array exceeds 4. Once again, there is no fixed limit here, and the number of regular logs stored can be set by yourself.
[0044] S40: If the number of the regular logs in the local array exceeds the preset number, deleting the regular logs in the local array until the number of the regular logs in the local array is less than the preset number.
[0045] For example, if the number of regular logs in the local array exceeds 4, regular logs in the local array can be randomly deleted until the number of regular logs in the local array is less than 4. It should be noted that after this step, the purpose of discarding regular logs can be achieved while retaining some regular logs. Because info type logs are regular user operation logs, when warning and error issues occur, context is still needed for troubleshooting, so some info type logs are still needed to facilitate subsequent troubleshooting based on monitoring logs while not occupying too much space and data on the terminal device.
[0046] S50: When the local array stores abnormal logs, all monitoring logs currently in the local array are uploaded to the log processing server.
[0047] In an embodiment of the present invention, it is determined whether an exception log is stored in the local array, for example, the warn type log and / or error type log referred to above. When an exception log is stored in the local array, all monitoring logs currently in the local array are uploaded to the log processing server.
[0048] As can be seen, in an embodiment of the present invention, a monitoring log processing method is provided. By setting a local array and discarding info type logs in a cyclic judgment manner, the purpose of saving traffic is achieved, and the processing volume of logs processed by the log processing server is reduced, thus saving back-end server processing resources and reducing computing power investment. In addition, when encountering abnormal logs such as warn or error, uploading them to the log processing server can also reduce terminal device traffic and log processing server processing resources, reducing the overall log monitoring operation and maintenance costs. Due to the small amount of transmitted data, the packet loss rate can also be reduced to a certain extent, effectively improving monitoring efficiency.
[0049] In one embodiment, if Figure 3 As shown, in step S10, storing the monitoring log in the local array specifically includes the following steps:
[0050] S11: Create an empty array as the local array, so as to use the local array as a container for localizing logs.
[0051] S12: Configuring the local array to open multiple functional functions to the outside, wherein different functional functions correspond to call entries of monitoring logs of different log types.
[0052] For steps S11-S12, before storing the monitoring log locally, the terminal device will pre-create an empty array as a local array to use the local array as a container for localizing the log. In addition, multiple function functions are configured for the local array as call entry points for monitoring logs of different log types. The specific configuration of the local array opening multiple function functions can be implemented through code and will not be described in detail here. The purpose is to provide a corresponding interface for subsequent calls to monitor logs of different log types and store them in local data.
[0053] For example, the above multiple function functions include a first function info(), a second function warn(), and a third function error(), wherein the first function info(), the second function warn(), and the third function error() serve as the entry points for info, warn, and error type logs, respectively. In this way, info, warn, and error type logs can be called through error(), info(), and warn(), respectively.
[0054] S13: When calling each of the function functions, convert the input parameter array object of each of the function functions into a target array.
[0055] After configuring the local array with function functions such as error(), info(), and warn(), you can call info, warn, and error type logs respectively through error(), info(), and warn(). It should be noted that a function function is a calling method that can only be called with corresponding input parameters. In the embodiment of the present invention, in order to achieve the purpose of compatible data when uploading monitoring logs later and to achieve compatibility with multiple data types, it is necessary not to limit the input parameter type of the function function, and it is necessary to process the input parameters of each function function (i.e., info(), warn(), and error()) used to call the monitoring log. When calling each of the function functions through the input parameters, it is necessary to convert the input parameter array object of each of the function functions into the target array.
[0056] It's understood that the array-like object arguments passed to each function is an object corresponding to the parameters passed to the function. For example, when calling the info() method, the function input arguments is (123,"felog",{a:"a",b:"b"},true), and the corresponding arguments is an array-like object. In specific applications, the slice method can be used to convert all elements in the array-like arguments into the target array.
[0057] For example, the specific implementation code may be Array.prototype.slice.apply(arguments), which can realize the conversion of the array-like input arguments of the function into the target array.
[0058] The sample code is as follows:
[0059]
[0060] S14: Serialize the target array corresponding to each of the function functions to obtain a serialized input parameter object corresponding to each of the function functions.
[0061] S15: Call the corresponding function through the serialized input parameter object corresponding to each function to obtain the corresponding monitoring log serialization data.
[0062] S16: Storing the monitoring log serialized data in a local array.
[0063] For steps S14-S15, it can be understood that because the array-like arguments of the function function does not distinguish between the input parameter types, it can be compatible with JavaScript string values, numbers, Boolean values, arrays, objects and other types. After conversion into the target array, the target array corresponding to each function function can be serialized to obtain a serialized input parameter object.
[0064] For example, you can use the JSON.stringify() method to serialize the target array, then call the corresponding function with its corresponding serialized input object to obtain the corresponding monitoring log serialized data. Finally, the monitoring log data is serialized and stored in a local array. This way, the resulting localized monitoring log is compatible with multiple data types, avoiding data incompatibility issues when uploading monitoring logs later and improving the compatibility of embedded log input data.
[0065] In one embodiment, if Figure 4 As shown, in step S10, after obtaining the monitoring log of the client in real time according to the preset log embedding point, the method further includes the following steps:
[0066] S60: configuring a unique identification number for the life cycle of the business page currently generating the monitoring log.
[0067] When front-end users use different business pages in the business front-end system, these pages have different lifecycles. The lifecycle of a business page here refers to the period from when the business page is opened to when it is closed. In this embodiment of the present invention, a unique identification number is assigned to the business page that currently generates a monitoring log during its lifecycle. In other words, each business page has a unique identification number.
[0068] For example, if business page 1 is opened at 08:45 am and closed at 09:00 am, a unique identification number A1 will be configured for business page 1 during the life cycle of 08:45-09:00; for example, if business page 1 is opened at 14:45 pm and closed at 15:00 pm, a unique identification number A2 will be configured for business page 1 during the life cycle of 14:45-15:00; if business page 2 is opened at 09:45 am and closed at 10:00 am, a unique identification number A3 will be configured for business page 2 during the life cycle of 09:45-10:00.
[0069] S70: Setting a log warning value of a target log type corresponding to the current business page according to the identification number.
[0070] After configuring a unique identification number for the lifecycle of a business page, you can set a log warning value for the target log type corresponding to the current business page based on the identification number. The target log type is generally a warn or error log. Excessive warn or error logs indicate that the current business page may have many errors, so you need to set a corresponding log warning value for each warn or error log.
[0071] For example, for the aforementioned business page 1, after the business page 1 is configured with a unique identification number A1 during its life cycle of 08:45-09:00, the warn type log or error type warning value generated by the business page 1 during its life cycle of 08:45-09:00 can be set according to the identification number A1.
[0072] For another example, for the aforementioned business page 1, after the business page 1 is configured with a unique identification number A2 during its life cycle of 14:45-15:00, the warn type log or error type warning value generated by the business page 1 during its life cycle of 14:45-15:00 can be set according to the identification number A1.
[0073] For another example, for the aforementioned business page 2, after the business page 2 is configured with a unique identification number A3 during its life cycle of 09:45-10:00, the warn type log or error type warning value generated by the business page 2 during its life cycle of 09:45-10:00 can be set according to the identification number A1.
[0074] S80: Determine whether the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value.
[0075] S90: If the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value, a warning message is automatically sent to the terminal of the relevant personnel.
[0076] For steps S80-S90, the embodiment of the present invention configures different processing personnel for different monitoring log types in order to handle the anomalies reflected in the monitoring logs. After setting the log warning value of the target log type corresponding to the current business page according to the identification number, it can be determined whether the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value. If the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value, a warning message is automatically sent to the terminal of the relevant personnel so that the relevant personnel can handle and analyze it.
[0077] For example, for the aforementioned business page 1, if it is determined whether the number of warn type logs generated by the business page 1 during the life cycle of 08:45-09:00 exceeds the warning value corresponding to the warn type log, if the number of warn type logs generated by the business page 1 during the life cycle of 08:45-09:00 exceeds the warning value corresponding to the warn type log, then a warning message is automatically sent to the terminal of the relevant personnel; or, if it is determined whether the number of error type logs generated by the business page 1 during the life cycle of 08:45-09:00 exceeds the warning value corresponding to the error type log, if the number of error type logs generated by the business page 1 during the life cycle of 08:45-09:00 exceeds the warning value corresponding to the error type log, then a warning message is automatically sent to the terminal of the relevant personnel so that the relevant personnel can process and analyze it.
[0078] For another example, for the aforementioned business page 1, if it is determined whether the number of warn type logs generated by the business page 1 during the life cycle of 14:45-15:00 exceeds the warning value corresponding to the warn type log, if the number of warn type logs generated by the business page 1 during the life cycle of 14:45-15:00 exceeds the warning value corresponding to the warn type log, then a warning message is automatically sent to the terminal of the relevant personnel; or, if it is determined whether the number of error type logs generated by the business page 1 during the life cycle of 14:45-15:00 exceeds the warning value corresponding to the error type log, if the number of error type logs generated by the business page 1 during the life cycle of 14:45-15:00 exceeds the warning value corresponding to the error type log, then a warning message is automatically sent to the terminal of the relevant personnel so that the relevant personnel can process and analyze it.
[0079] For another example, for the aforementioned business page 2, if it is determined whether the number of warn type logs generated by the business page 2 during the life cycle of 09:45-10:00 exceeds the warning value corresponding to the warn type log, if the number of warn type logs generated by the business page 2 during the life cycle of 09:45-10:00 exceeds the warning value corresponding to the warn type log, then a warning message is automatically sent to the terminal of the relevant personnel; or, if it is determined whether the number of error type logs generated by the business page 2 during the life cycle of 09:45-10:00 exceeds the warning value corresponding to the error type log, if the number of error type logs generated by the business page 2 during the life cycle of 09:45-10:00 exceeds the warning value corresponding to the error type log, then a warning message is automatically sent to the terminal of the relevant personnel so that the relevant personnel can process and analyze it.
[0080] It should also be noted that the warning values of the same or different monitoring log types for different business pages may be different, and the warning values set for different life cycles of the same business page may also be different. The specific configuration can be based on actual conditions, and the present invention does not impose any restrictions.
[0081] In this embodiment, the main purpose is to set an identification ID for the business page of the terminal device to identify different business pages. Then, the warning value of the warn type log or error type log corresponding to the identification ID can be set, that is, the warning threshold. If the warn type log or error type uploaded by the business page exceeds the corresponding warning value set previously, a warning message will be automatically sent to the terminal of the relevant personnel. It can be seen that the manual monitoring cycle can be flexibly configured here, so that the required warning indication can be obtained according to the cycle, so that the problems reflected in the monitoring log can be quickly resolved.
[0082] In addition, in one embodiment, if the current business page is closed, the memory corresponding to the business page is released to avoid occupying too much memory space of the terminal device.
[0083] In one embodiment, if Figure 5 As shown, in step S50, that is, uploading all monitoring logs in the current local array to the log processing server, specifically includes the following steps:
[0084] S51: Summarize and group all monitoring logs in the current local array according to a preset grouping method.
[0085] For example, all monitoring logs in the current local array can be summarized and grouped according to the monitoring log level. It can be understood that in the field of monitoring log processing, the monitoring log level refers to logs of types such as info, warn, and error. Since different logs contain different information, the monitoring logs need to be summarized and grouped so that they can be subsequently assigned to corresponding personnel for processing and optimize processing efficiency. Among them, the summary statistics can directly summarize different monitoring log level types to determine logs of different monitoring log levels. For example, summary statistics can also be performed according to different conditions such as the generation time of the monitoring log and the monitoring log level. It can be used according to actual conditions.
[0086] S52: Divide the monitored logs that have been counted and grouped into different processing personnel to associate the groups with labels, where the association labels are used to mark the corresponding relationship between the groups and the processing personnel.
[0087] S53: Uploading the monitoring log in the group to the log processing server according to the association tag.
[0088] In this embodiment, by marking and distributing, different processing personnel at all levels can handle corresponding problems, fully utilize the monitoring logs and reasonably allocate solutions, which can improve the speed of resolving errors reflected in the logs.
[0089] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0090] In one embodiment, a monitoring log processing device is provided, which corresponds one-to-one to the monitoring log processing method in the above embodiment. Figure 6 As shown, the monitoring log processing device includes an acquisition module 101, a storage module 102, a determination module 103, a judgment module 104, a deletion module 105 and a transmission module 106. The functional modules are described in detail as follows:
[0091] Acquisition module 101, used to obtain the client's monitoring log in real time according to the preset log embedding point;
[0092] The storage module 102 is used to store the monitoring log in a local array created by the client;
[0093] A determination module 103 is configured to determine a log type of the monitoring log in the local array, where the log type includes a regular log;
[0094] The judging module 104 is configured to cyclically judge whether the number of the regular logs in the local array exceeds a preset number according to the log type of the monitoring log in the local array;
[0095] a deleting module 105, configured to delete the regular logs of the local array if the number of the regular logs in the local array exceeds the preset number, until the number of the regular logs in the local array is less than the preset number;
[0096] The uploading module 106 is configured to upload all monitoring logs in the local array to the log processing server when the local array stores abnormal logs.
[0097] In one embodiment, the storage module is specifically configured to:
[0098] Creating an empty array as the local array to use the local array as a container for localizing logs;
[0099] Configuring the local array to open multiple function functions to the outside, wherein different function functions correspond to call entries of monitoring logs of different log types;
[0100] When calling each of the function functions, convert the input parameter array object of each of the function functions into the target array;
[0101] Serialize the target array corresponding to each function to obtain a serialized input parameter object corresponding to each function;
[0102] Call the corresponding function through the serialized input parameter object corresponding to each function to obtain the corresponding monitoring log serialization data;
[0103] The monitoring log serialized data is stored in a local array.
[0104] In one embodiment, the apparatus further includes a configuration module, a setting module, and a sending module:
[0105] The configuration module is used to configure a unique identification number for the life cycle of the business page that currently generates the monitoring log;
[0106] The setting module is used to set the log warning value of the target log type corresponding to the current business page according to the identification number;
[0107] The judgment module is further configured to judge whether the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value;
[0108] The sending module is used to automatically send a warning message to the terminal of the relevant personnel if the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value.
[0109] In one embodiment, the device further comprises a release mold;
[0110] The release module is configured to release the memory corresponding to the business page if the current business page is closed.
[0111] In one embodiment, the upload module is specifically configured to:
[0112] Summarize and group all monitoring logs in the local array according to a preset grouping method;
[0113] Dividing the monitored logs that have been counted and grouped into different processing personnel to associate the groups with labels, wherein the association labels are used to mark the corresponding relationship between the groups and the processing personnel;
[0114] The monitoring logs in the group are uploaded to the log processing server according to the association tag.
[0115] As can be seen, in an embodiment of the present invention, a monitoring log processing device is provided. By setting a local array and discarding info-type logs in a cyclic determination method, this achieves the purpose of saving traffic, and reduces the log processing workload of the log processing server, thus saving back-end server processing resources and reducing computing power investment. In addition, when encountering abnormal logs such as warn or error, uploading them to the log processing server can also reduce terminal device traffic and log processing server processing resources, reducing overall log monitoring operation and maintenance costs. Due to the small amount of transmitted data, the packet loss rate can also be reduced to a certain extent, effectively improving monitoring efficiency.
[0116] For the specific definition of the monitoring log processing device, please refer to the definition of the monitoring log processing method above and will not be repeated here. Each module in the above-mentioned monitoring log processing device can be implemented in whole or in part through software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each of the above modules.
[0117] In one embodiment, a computer device is provided. The computer device may be a terminal device, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a storage medium and an internal memory. The medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the storage medium. The network interface of the computer device is used to communicate with an external log processing server via a network connection. When the computer program is executed by the processor, a monitoring log processing method is implemented.
[0118] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are performed:
[0119] Acquire the monitoring logs of the business front-end system in real time according to the preset log embedding points, and store the monitoring logs in a local array;
[0120] Determine a log type of the monitoring log in the local array, where the log type includes a regular log;
[0121] According to the log type of the monitoring log in the local array, cyclically determining whether the number of the regular logs in the local array exceeds a preset number;
[0122] If the number of the regular logs in the local array exceeds the preset number, deleting the regular logs in the local array until the number of the regular logs in the local array is less than the preset number;
[0123] When the local array stores abnormal logs, all monitoring logs in the local array are uploaded to the log processing server.
[0124] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0125] Acquire the monitoring logs of the business front-end system in real time according to the preset log embedding points, and store the monitoring logs in a local array;
[0126] Determine a log type of the monitoring log in the local array, where the log type includes a regular log;
[0127] According to the log type of the monitoring log in the local array, cyclically determining whether the number of the regular logs in the local array exceeds a preset number;
[0128] If the number of the regular logs in the local array exceeds the preset number, deleting the regular logs in the local array until the number of the regular logs in the local array is less than the preset number;
[0129] When the local array stores abnormal logs, all monitoring logs in the local array are uploaded to the log processing server.
[0130] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0131] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0132] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A monitoring log processing method, characterized in that: include: Acquire the monitoring logs of the business front-end system in real time according to the preset log embedding points, and store the monitoring logs in a local array; Determine the log type of the monitoring log in the local array, where the log type includes a regular log and an exception log, wherein the regular log is an info type log, and the exception log is a warn type log and an error type log; During the process of storing monitoring logs in the local array, continuously looping and determining whether the number of regular logs in the local array exceeds a preset number according to the log type of the monitoring log in the local array; If the number of the regular logs in the local array exceeds the preset number, randomly deleting the stored regular logs of the local array until the number of the regular logs in the local array is less than the preset number; When the local array stores an abnormal log, all monitoring logs in the local array are uploaded to the log processing server. The upload operation is triggered by the generation of the abnormal log. The step of storing the monitoring log in a local array includes: Creating an empty array as the local array to use the local array as a container for localizing logs; Configuring the local array to open multiple function functions to the outside, wherein different function functions correspond to call entries of monitoring logs of different log types; When calling each of the function functions, convert the input parameter array object of each of the function functions into the target array; Serialize the target array corresponding to each function to obtain a serialized input parameter object corresponding to each function; Call the corresponding function through the serialized input parameter object corresponding to each function to obtain the corresponding monitoring log serialization data; The monitoring log serialized data is stored in a local array.
2. The monitoring log processing method according to claim 1, wherein: After obtaining the client's monitoring log in real time according to the preset log embedding point, the method further includes: Configuring a unique identification number for the life cycle of the business page currently generating the monitoring log; Setting a log warning value of a target log type corresponding to the current business page according to the identification number; Determine whether the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value; If the number of monitoring logs corresponding to the target log type generated during the life cycle of the current business page exceeds the log warning value, a warning message will be automatically sent to the terminal of the relevant personnel.
3. The monitoring log processing method according to claim 2, wherein: The method further comprises: If the current business page is closed, the memory corresponding to the business page is released.
4. The monitoring log processing method according to any one of claims 1 to 3, wherein: Uploading all monitoring logs in the current local array to the log processing server includes: Summarize and group all monitoring logs in the local array according to a preset grouping method; Dividing the monitored logs that have been counted and grouped into different processing personnel to associate the groups with labels, wherein the association labels are used to mark the corresponding relationship between the groups and the processing personnel; The monitoring logs in the group are uploaded to the log processing server according to the association tag.
5. A monitoring log processing device, characterized in that: include: The acquisition module is used to obtain the client's monitoring logs in real time according to the preset log embedding points; A storage module, configured to store the monitoring log in a local array created by the client; A determination module, configured to determine the log type of the monitoring log in the local array, wherein the log type includes a regular log and an abnormal log, wherein the regular log is an info type log, and the abnormal log is a warn type log and an error type log; A judging module, configured to, during the process of storing monitoring logs in the local array, continuously and cyclically judge whether the number of regular logs in the local array exceeds a preset number according to the log type of the monitoring logs in the local array; a deleting module, configured to randomly delete the stored regular logs of the local array if the number of the regular logs in the local array exceeds the preset number, until the number of the regular logs in the local array is less than the preset number; An upload module is used to upload all monitoring logs in the local array to the log processing server when the local array stores an abnormal log. The upload operation is triggered by the generation of the abnormal log; The storage module is specifically used for: Creating an empty array as the local array to use the local array as a container for localizing logs; Configuring the local array to open multiple function functions to the outside, wherein different function functions correspond to call entries of monitoring logs of different log types; When calling each of the function functions, convert the input parameter array object of each of the function functions into the target array; Serialize the target array corresponding to each function to obtain a serialized input parameter object corresponding to each function; Call the corresponding function through the serialized input parameter object corresponding to each function to obtain the corresponding monitoring log serialization data; The monitoring log serialized data is stored in a local array.
6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the monitoring log processing method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the monitoring log processing method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Data logs management in a multi-client architecture
CN104704475A
Log file obtaining method and device and storage medium
CN110232048A