Log-based monitoring item processing method and device, equipment and storage medium

By automatically identifying and adding monitoring items through the log printing function in the business code, the inefficiency and low accuracy caused by manually sorting logs are solved, and efficient and accurate management of monitoring items is achieved.

CN118567960BActive Publication Date: 2025-10-21BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410650514.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2025-10-21
Estimated Expiration
2044-05-23

AI Technical Summary

Technical Problem

In existing technologies, the method of manually sorting through logs to determine monitoring items is inefficient and prone to omissions, affecting monitoring efficiency and accuracy.

Method used

By receiving the business code uploaded by the user, the log printing function is used to automatically determine the location of the monitoring item, and it is added to the monitoring system through the preset interface to achieve automated monitoring item management.

Benefits of technology

The processing efficiency of monitoring items has been improved, reducing the time from hours to seconds, thus improving the accuracy and efficiency of monitoring items and avoiding errors and omissions caused by manual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567960B_ABST
    Figure CN118567960B_ABST
Patent Text Reader

Abstract

The present disclosure provides a log-based monitoring item processing method and device, equipment and storage medium, relates to the technical field of computers, in particular to the field of log monitoring. The specific implementation scheme is: receiving the business code uploaded by the user; the business code is used to generate the log of the business, and the log of the business is output in a preset log format; the business code includes a log printing function, and the log printing function represents the preset log format; according to the log printing function, the character information located at the preset position in the business code is determined as a monitoring item to be added; the monitoring item to be added is added to the preset monitoring system by calling a preset interface; the preset interface is used for data transmission with the preset monitoring system, and the preset monitoring system is used for monitoring the content of the log according to the monitoring item. The scanning of the code is automatically triggered every time the code is submitted, the monitoring item of the log is extracted, and the management efficiency and accuracy of the monitoring item are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of log monitoring in the field of computer technology, and in particular to a method, apparatus, device, and storage medium for processing log-based monitoring items. Background Art

[0002] During business processing, business logs are generated in real time. Logs can be used to represent the business process. Monitoring logs can help quickly identify online problems. Monitoring items play a crucial role in monitoring, and different monitoring items can be used to monitor different information in the logs.

[0003] Monitoring items are derived from business logs. Manual log sorting can easily lead to omission of monitoring items, resulting in low management efficiency and accuracy of monitoring items, which in turn affects the efficiency and accuracy of log monitoring. Summary of the Invention

[0004] The present disclosure provides a log-based monitoring item processing method, apparatus, device, and storage medium.

[0005] According to a first aspect of the present disclosure, a method for processing log-based monitoring items is provided, wherein the monitoring items represent items in the log that need to be monitored, and the method includes:

[0006] Receive a business code uploaded by a user; wherein the business code is used to generate a business log and output the business log in a preset log format, the business code includes a log printing function, and the log printing function represents the preset log format;

[0007] According to the log printing function, character information located at a preset position is determined from the business code as a monitoring item to be added;

[0008] By calling a preset interface, the monitoring item to be added is added to a preset monitoring system; wherein, the preset interface is used to transmit data with the preset monitoring system, and the preset monitoring system is used to monitor the content of the log according to the monitoring item.

[0009] According to a second aspect of the present disclosure, a device for processing log-based monitoring items is provided, where the monitoring items represent items in the log that need to be monitored. The device includes:

[0010] A code receiving unit, configured to receive a service code uploaded by a user; wherein the service code is used to generate a service log and output the service log in a preset log format, wherein the service code includes a log printing function, and the log printing function represents the preset log format;

[0011] A monitoring item determination unit, configured to determine, according to the log printing function, character information located at a preset position in the business code as a monitoring item to be added;

[0012] The monitoring item adding unit is used to add the monitoring item to be added to the preset monitoring system by calling the preset interface; wherein the preset interface is used to transmit data with the preset monitoring system, and the preset monitoring system is used to monitor the content of the log according to the monitoring item.

[0013] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0014] at least one processor; and

[0015] a memory communicatively coupled to the at least one processor;

[0016] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.

[0017] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect.

[0018] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising: a computer program, which implements the method described in the first aspect when executed by a processor.

[0019] According to the technology disclosed in the present invention, the processing efficiency and accuracy of monitoring items are improved.

[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0022] Figure 1 This is a flow chart of a method for processing log-based monitoring items according to an embodiment of the present disclosure;

[0023] Figure 2 This is a flow chart of a method for processing log-based monitoring items according to an embodiment of the present disclosure;

[0024] Figure 3This is a flow chart of a method for processing log-based monitoring items according to an embodiment of the present disclosure;

[0025] Figure 4 is a schematic diagram of a visual interface of a monitoring system provided according to an embodiment of the present disclosure;

[0026] Figure 5 This is a structural block diagram of a log-based monitoring item processing device provided according to an embodiment of the present disclosure;

[0027] Figure 6 This is a structural block diagram of a log-based monitoring item processing device provided according to an embodiment of the present disclosure;

[0028] Figure 7 is a block diagram of an electronic device for implementing the log-based monitoring item processing method of an embodiment of the present disclosure;

[0029] Figure 8 The block diagram is a block diagram of an electronic device used to implement the log-based monitoring item processing method of an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0031] Monitoring is designed to quickly identify online issues. Monitoring items play a crucial role in this process. Monitoring items represent items in logs that need to be monitored, such as traffic volume or CPU usage.

[0032] Monitoring items are generated from logs printed by businesses, which are numerous. Currently, the logs are manually sorted, and keywords for monitoring items are obtained from them. These keywords are then manually added to the monitoring system to manage monitoring items. This method is inefficient for processing monitoring items and is prone to missing items, impacting the efficiency and accuracy of subsequent log monitoring.

[0033] The present disclosure provides a log-based monitoring item processing method, apparatus, device, and storage medium, which are applied to the field of log monitoring in the field of computer technology to improve the processing efficiency and accuracy of monitoring items.

[0034] It should be noted that the data in this embodiment is not targeted at a specific user and does not reflect the personal information of a specific user. It should be noted that the data in this embodiment comes from a public data set.

[0035] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0036] In order to enable readers to have a deeper understanding of the implementation principle of this disclosure, the following Figures 1-8 The embodiment is further refined.

[0037] Figure 1 The flowchart of a method for processing log-based monitoring items according to an embodiment of the present disclosure is provided. The monitoring items represent items that need to be monitored in the log. The method can be executed by a device for processing log-based monitoring items. Figure 1 As shown, the method includes the following steps:

[0038] S101. Receive a business code uploaded by a user. The business code is used to generate a business log and output the business log in a preset log format. The business code includes a log printing function, which represents the preset log format.

[0039] For example, a user can be a business developer, and the business code is the code submitted by the developer when developing a business function. The business code can include the code for executing the business function and the code for printing logs. Whenever a user updates a business function or updates the log generation requirements, they can upload new business code. For example, if a user adds a business function, they will update the code for executing the business function. After uploading the new business code, the new business function can be executed.

[0040] The business code includes a code portion for printing logs, so the business code can be used to generate business logs. Users can set a preset log format in the business code, and the business log can be output in the preset log format through the business code. The preset log format can be determined by a preset log printing function, that is, the business code can include a log printing function, and different log printing functions can represent different log formats. Based on the preset log printing function, a standardized log format is provided, and R&D personnel add the log printing function to the business code to facilitate the subsequent generation of logs in a standard format. In this embodiment, the preset log printing function is not specifically limited.

[0041] Users can upload business codes at any time. Every time a user uploads a business code, the business code can be received in real time, thereby achieving timely processing of monitoring items and improving the efficiency of log monitoring.

[0042] S102: According to the log printing function, character information located at a preset position is determined from the business code as a monitoring item to be added.

[0043] For example, after obtaining the business code, the business code can be statically checked to determine the monitoring items to be added from the business code. For example, when the user submits the business code, the callback hook of the pipeline is triggered, and the business code is automatically statically checked, and the monitoring items are extracted from the code portion of the business code print log.

[0044] The business code contains a log printing function. Different locations in the log printing function can correspond to different parameters. Parameters refer to the business-related information represented in the log, and monitoring items can be parameters in the code. In other words, different locations in the business code can correspond to different parameters. By setting up the log printing function, you can determine the location of each parameter in the code. After setting up the log printing function, you can determine the location of the parameters to be monitored in the business code, that is, the location of the monitoring items in the business code.

[0045] In other words, a preset location in the business code can be pre-determined based on the log printing function. After receiving the business code, the character information located at the preset location can be determined from the business code, and the obtained character information can be determined as the monitoring item to be added. For example, relevant parameters in the log printing function can be obtained, and the first parameter can be determined as the monitoring item to be added. In this embodiment, one or more monitoring items to be added can be determined.

[0046] In this embodiment, the method also includes: if the log printing function does not exist in the business code, the monitoring item to be added is not extracted from the business code, and a second prompt message is sent to the user; wherein the second prompt message is used to remind the user to check the log printing function of the business code.

[0047] Specifically, the business code is written by the user. When writing the business code, the user may not add the log printing function to the business code, that is, the log printing function may not exist in the business code.

[0048] When statically testing the business code, it is possible to first determine whether the business code contains a log printing function. If so, the character information at a preset position in the business code can be determined as the monitoring item to be added. If not, the monitoring item to be added cannot be extracted from the business code, and a second prompt message can be issued to the user. The second prompt message can be used to remind the user to check the business code to confirm whether the log printing function is missing, so that the business code can be resubmitted and tested again.

[0049] The beneficial effect of this setting is that if the business code does not contain a preset log printing function, the user will be reminded that the monitoring item cannot be extracted, avoiding subsequent unnecessary detection operations, improving the extraction efficiency and accuracy of the monitoring item, and improving the accuracy of the business code.

[0050] S103. Add the monitoring item to be added to the preset monitoring system by calling a preset interface; wherein the preset interface is used to transmit data with the preset monitoring system, and the preset monitoring system is used to monitor the content of the log according to the monitoring item.

[0051] For example, the monitoring items to be added are monitoring items that need to be added to a preset monitoring system, and the monitoring system can be used to monitor the content of the log according to the monitoring items and determine abnormal conditions written in the log. In this embodiment, the preset monitoring system is not specifically limited.

[0052] After obtaining the monitoring items to be added, the monitoring items to be added can be automatically added to the preset monitoring system. For example, the API (Application Programming Interface) of the monitoring system can be called, that is, the preset interface can be called, and the preset interface can be used to transmit data with the preset monitoring system to automatically add the monitoring items to the monitoring system.

[0053] The monitoring system stores multiple monitoring items. During actual business operations, the monitoring system obtains logs in a preset log format. Based on the preset monitoring items, the system extracts the corresponding content from the logs, thus obtaining the content to be monitored. Based on the preset log format, the corresponding position of each monitoring item in the log can be determined, thereby extracting the log content corresponding to the monitoring item, improving monitoring efficiency.

[0054] In the embodiment of the present disclosure, a business code uploaded by a user is received, and the business code includes a log printing function, and the log printing function can be used to print the log in a preset log format. The detection of the business code is automatically triggered, and according to the log printing function, the character information located at the preset position in the business code is determined as the monitoring item to be added. By calling the preset interface, the monitoring item to be added is automatically added to the preset monitoring system, so that the preset monitoring system can monitor the content of the log according to the monitoring item. There is no need to manually sort out the monitoring items and add them to the monitoring system. By automatically determining the monitoring items and automatically adding them to the monitoring system, the efficiency of adding monitoring items can be improved, and the process of adding monitoring items can be reduced from the hour level to the second level, thereby improving the processing efficiency and accuracy of the monitoring items. It also avoids the problem of online anomalies that cannot be discovered due to manual omission of monitoring items, thereby improving the efficiency and accuracy of monitoring.

[0055] Figure 2 A flowchart of a log-based monitoring item processing method provided in an embodiment of the present disclosure is provided.

[0056] In this embodiment, according to the log printing function, the character information located at the preset position is determined from the business code as the monitoring item to be added, including: obtaining the log level in the business code; wherein the log level represents the abnormality level of the log; if the log level in the business code is the preset log level, then according to the log printing function and the log level in the business code, the character information located at the preset position is determined from the business code as the monitoring item to be added.

[0057] like Figure 2 As shown, the method includes the following steps:

[0058] S201. Receive a business code uploaded by a user. The business code is used to generate a business log and output the business log in a preset log format. The business code includes a log printing function, which represents the preset log format.

[0059] For example, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0060] S202: Obtain the log level in the business code; wherein the log level represents the abnormal level of the log.

[0061] Exemplarily, the business code is checked to determine whether the business code contains a preset log printing function. If so, the log level contained in the business code is determined; if not, the monitoring item is not extracted. The log level can represent the abnormal level of the log. For example, the log level can include debug, info, warning, error, etc. The business code can include one or more log levels. When generating a business log, a log of the log level contained in the business code can be generated.

[0062] When writing business code, users can place the log level in a preset code line. When obtaining the log level in the business code, you can locate the code line and directly extract the log level from it.

[0063] S203: If the log level in the business code is a preset log level, then according to the log printing function and the log level in the business code, character information at a preset position is determined from the business code as a monitoring item to be added.

[0064] For example, one or more log levels are pre-set as standard log levels. After obtaining the log level in the business code, it is determined whether the log level in the business code is the preset log level, that is, whether it is the standard log level. If so, the monitoring items to be added can be determined from the business code; if not, the monitoring items to be added cannot be extracted.

[0065] There can be multiple log levels in the business code, and each log level is judged in turn to see if it is a standard log level. If there is a log level in the business code that is a standard log level, the preset position corresponding to the log level in the business code can be determined based on the log printing function, and the character information at the preset position can be determined from the business code as the monitoring item to be added. For example, the code line where the log level is located in the business code can be determined, and according to the log format represented by the log printing function, the preset position set in the log format can be found from the code line, and the monitoring item to be added can be extracted from the position.

[0066] In this embodiment, the business code is statically detected to determine the preset log level contained in the business code, thereby avoiding confusion in monitoring items of all log levels, accurately determining monitoring items based on log levels, and improving the accuracy of determining monitoring items.

[0067] In this embodiment, the method also includes: if the log levels in the business code are not preset log levels, the monitoring items to be added are not extracted from the business code, and a first prompt message is sent to the user; wherein the first prompt message is used to remind the user to check the log level in the business code.

[0068] Specifically, each log level in the business code is compared with the preset log level. If each log level in the business code is not the preset log level, that is, it is not the standard log level, the monitoring item to be added cannot be extracted from the business code, and a first prompt message can be issued to the user. The first prompt message can be used to remind the user to check the log level in the business code. If the user determines that there is an error in the log level in the business code, the business code can be resubmitted to perform the business code detection and monitoring item extraction again. If the user determines that there is no problem with the business code, the monitoring item will not be extracted, and the business functions will be executed directly according to the business code and the business log will be generated.

[0069] The beneficial effect of this setting is that if the business code does not contain the preset log level, the monitoring item cannot be extracted, avoiding subsequent redundant operations, improving the efficiency of code detection, and thus improving the processing efficiency of monitoring items.

[0070] In this embodiment, according to the log printing function and the log level in the business code, the character information located at a preset position is determined from the business code as the monitoring item to be added, including: from the business code, determining the code line corresponding to the log level in the business code as the target code line; according to the log printing function, determining the character information located at a preset position from the target code line as the monitoring item to be added.

[0071] Specifically, different lines of code correspond to different log levels in the business code. For example, info is on the first line, warning is on the second line, and error is on the third line. Determine the standard log level in the business code and then determine the line of code in the business code that corresponds to that standard log level. That is, after determining that the log level in the business code is the standard log level, determine the line of code in the business code that corresponds to that log level and use it as the target line of code.

[0072] The log printing function can indicate the location of the parameter represented by the monitoring item in the code. Different log printing functions can correspond to different locations. For example, the parameter represented by the monitoring item in function one is the first parameter, and the parameter represented by the monitoring item in function two is the second parameter. After determining the target code line, the location of the parameter represented by the monitoring item in the code is determined according to the target printing function as the preset location. The character information at the preset location is determined from the target code line as the monitoring item to be added. For example, the first parameter is obtained from the error code line as the monitoring item to be added.

[0073] The beneficial effect of this setting is that relevant parameters are obtained according to the log printing function. For example, the first parameter is obtained as the monitoring item to be added, so that the monitoring item is automatically determined, manual operations are reduced, and the management efficiency and accuracy of the monitoring item are improved.

[0074] In this embodiment, the method further includes: associating and storing the monitoring item to be added with the log level in the business code.

[0075] Specifically, for different log levels, different monitoring items to be added can be extracted. The monitoring items to be added are determined to be extracted, and the log levels corresponding to the monitoring items to be added are determined. The monitoring items to be added are associated with the corresponding log levels and stored.

[0076] The beneficial effect of this setting is that different log levels can correspond to different monitoring items, which facilitates the subsequent monitoring of logs of different log levels and improves the accuracy of log monitoring.

[0077] In this embodiment, the method further includes: generating a log in a preset log format according to the log printing function, which is the log to be monitored; and extracting information corresponding to the monitoring item to be added from the log to be monitored according to the preset log format.

[0078] Specifically, when the business code is actually running and generating logs, a standardized log can be generated based on a pre-set structured log printing function. That is, a log in a pre-set log format can be generated as the log to be monitored. In the pre-set log format, information of pre-set categories is written in different locations. For example, the first line of the log may contain information about traffic volume, while the second line may contain information about whether the service is overloaded.

[0079] According to the preset log format, the corresponding position of the monitoring item to be added in the monitored log is determined, and the information corresponding to the monitoring item to be added is extracted at the corresponding position in the monitored log to obtain the content to be monitored. For example, the first to fourth characters of the first line of the monitored log can be extracted as the information content corresponding to the monitoring item to be added.

[0080] The beneficial effect of such a setting is that, during actual monitoring, a log in a preset format can be generated, making it easier to quickly obtain the required information from the log, thereby improving the efficiency and accuracy of log monitoring.

[0081] In this embodiment, according to the preset log format, information corresponding to the monitoring item to be added is extracted from the log to be monitored, including: determining the log level of the log to be monitored; determining the monitoring item to be added that is associated with the log level of the log to be monitored as the target monitoring item; according to the preset log format, extracting information corresponding to the target monitoring item from the log to be monitored.

[0082] Specifically, after generating a log to be monitored, the log level of the log to be monitored is determined. For example, the log to be monitored may be marked with a log level identifier. This identifier is obtained to determine the log level of the log to be monitored. Different log levels are associated with different monitoring items. From the predetermined monitoring items to be added, the monitoring item associated with the log level of the log to be monitored is determined as the target monitoring item. One or more target monitoring items can be determined.

[0083] Based on the preset log format, determine the location of the target monitoring item in the log to be monitored. From this location, obtain the information corresponding to the target monitoring item recorded in the log, thus obtaining the information to be monitored. Alternatively, based on the preset log format, obtain the information corresponding to all monitoring items from the log to be monitored, and then filter the information corresponding to the target monitoring item from the information corresponding to all monitoring items.

[0084] The log can contain identifiers such as the name or keyword of the monitoring item. Based on the identifier of the target monitoring item, the string of a preset length following the identifier can be searched in the monitored log to be used as the information corresponding to the target monitoring item. For example, if the target monitoring item is traffic size, and the monitored log contains "Traffic size: exceeds 30% of the preset size", the four characters "traffic size" can be searched in the monitored log to be used and the ten characters following "traffic size" can be determined as the information corresponding to the traffic size.

[0085] The beneficial effect of this setting is that, according to the log level of the log, the monitoring items that need to be monitored are determined, the targeted monitoring of the log is achieved, and the accuracy of log monitoring is improved.

[0086] In this embodiment, according to the preset log format, information corresponding to the target monitoring item is extracted from the log to be monitored, including: according to the preset log format, determining the position corresponding to the target monitoring item in the log to be monitored, which is the target position; extracting the information at the target position from the log to be monitored, which is the information corresponding to the target monitoring item.

[0087] Specifically, the log format is provided with the location of each monitoring item in the log. After determining the target monitoring item, according to the preset log format, the location corresponding to the target monitoring item in the log to be monitored is found as the target location.

[0088] Different target monitoring items correspond to different target locations. For each target monitoring item, the information at the target location is extracted from the monitored log as the information corresponding to the target monitoring item. Each target monitoring item and the corresponding information are associated and displayed, for example, on a visual interface of the monitoring system for users to view. In other words, after the monitoring items of the monitoring system are managed, when the log is actually generated, the log level of the monitored log is determined, and the monitoring items corresponding to the log level in the monitoring system are determined. Based on the monitoring items in the monitoring system, the information in the monitored log is extracted and displayed.

[0089] The beneficial effect of such a setting is that the required information is obtained from the corresponding position in the log, redundancy of the obtained information is avoided, and the accuracy and efficiency of log monitoring are improved.

[0090] S204. Add the monitoring item to be added to the preset monitoring system by calling the preset interface; wherein the preset interface is used to transmit data with the preset monitoring system, and the preset monitoring system is used to monitor the content of the log according to the monitoring item.

[0091] For example, this step may refer to the above-mentioned step S103 and will not be described in detail.

[0092] In the embodiment of the present disclosure, a business code uploaded by a user is received, and the business code includes a log printing function, and the log printing function can be used to print the log in a preset log format. The detection of the business code is automatically triggered, and according to the log printing function, the character information located at the preset position in the business code is determined as the monitoring item to be added. By calling the preset interface, the monitoring item to be added is automatically added to the preset monitoring system, so that the preset monitoring system can monitor the content of the log according to the monitoring item. There is no need to manually sort out the monitoring items and add them to the monitoring system. By automatically determining the monitoring items and automatically adding them to the monitoring system, the efficiency of adding monitoring items can be improved, and the process of adding monitoring items can be reduced from the hour level to the second level, thereby improving the processing efficiency and accuracy of the monitoring items. It also avoids the problem of online anomalies that cannot be discovered due to manual omission of monitoring items, thereby improving the efficiency and accuracy of monitoring.

[0093] Figure 3 A flowchart of a log-based monitoring item processing method provided in an embodiment of the present disclosure is provided.

[0094] In this embodiment, the monitoring items to be added are added to the preset monitoring system by calling the preset interface, including: transmitting the monitoring items to be added to the preset monitoring system by calling the preset interface; wherein the preset monitoring system is configured with a visualization interface; storing the monitoring items to be added in the preset monitoring system and displaying them on the visualization interface.

[0095] like Figure 3 As shown, the method includes the following steps:

[0096] S301. Receive a business code uploaded by a user. The business code is used to generate a business log and output the business log in a preset log format. The business code includes a log printing function, which represents the preset log format.

[0097] For example, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0098] S302: According to the log printing function, character information located at a preset position is determined from the business code as a monitoring item to be added.

[0099] For example, this step may refer to the above-mentioned step S102 and will not be described in detail.

[0100] S303: Transmit the monitoring item to be added to the preset monitoring system by calling a preset interface; wherein the preset monitoring system is configured with a visual interface.

[0101] For example, a monitoring system API interface is pre-configured, and by calling the pre-configured API interface, the monitoring items to be added are transmitted to the pre-configured monitoring system. The monitoring system is configured with a visual interface that can be used to display the monitoring items and information from the logs corresponding to the subsequently extracted monitoring items. In this embodiment, the transmission process of the monitoring items to be added is not specifically limited.

[0102] S304: Store the monitoring item to be added in a preset monitoring system and display it on a visual interface.

[0103] Exemplarily, the monitoring system receives the monitoring item to be added, stores the monitoring item to be added in the monitoring system, and can display the monitoring item to be added on a visual interface of the monitoring system. When storing the monitoring item to be added in the monitoring system, the monitoring item to be added can be associated with the log level for storage.

[0104] The visualization interface can be set up with a table of monitoring items, with each row representing one monitoring item. After viewing the extracted monitoring items through the visualization interface, users can modify or delete them based on actual business needs. For example, they can change the name or description of the monitoring item. If the user confirms that the monitoring items on the interface are correct, the log will be monitored accordingly.

[0105] In this embodiment, the API of the monitoring system is called to automatically add monitoring items to the monitoring system, reducing the user's adding operations, improving the management efficiency of monitoring items, and avoiding problems such as poor monitoring effects caused by manual omission of monitoring items.

[0106] Figure 4 Schematic diagram of the visual interface of the monitoring system. Figure 4 The "Error log monitoring items" represent the monitoring items at the error log level, and the "Warning log monitoring items" represent the monitoring items at the warning log level. Figure 4 The display shows the monitoring items added for the error log level. The monitoring items identified for addition are "db error" and "actionrecover." Different monitoring items have their own descriptions, which are simple explanations of their meaning. Users can click the "Edit" or "Delete" controls on the interface to operate on monitoring items. Users can also click the "Add" control to manually add monitoring items.

[0107] In the embodiment of the present disclosure, a business code uploaded by a user is received, and the business code includes a log printing function, and the log printing function can be used to print the log in a preset log format. The detection of the business code is automatically triggered, and according to the log printing function, the character information located at the preset position in the business code is determined as the monitoring item to be added. By calling the preset interface, the monitoring item to be added is automatically added to the preset monitoring system, so that the preset monitoring system can monitor the content of the log according to the monitoring item. There is no need to manually sort out the monitoring items and add them to the monitoring system. By automatically determining the monitoring items and automatically adding them to the monitoring system, the efficiency of adding monitoring items can be improved, and the process of adding monitoring items can be reduced from the hour level to the second level, thereby improving the processing efficiency and accuracy of the monitoring items. It also avoids the problem of online anomalies that cannot be discovered due to manual omission of monitoring items, thereby improving the efficiency and accuracy of monitoring.

[0108] Figure 5 This is a structural block diagram of a log-based monitoring item processing device provided by an embodiment of the present disclosure. The monitoring item represents the items that need to be monitored in the log. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Figure 5 The log-based monitoring item processing device 500 includes: a code receiving unit 501, a monitoring item determining unit 502 and a monitoring item adding unit 503.

[0109] A code receiving unit 501 is configured to receive a service code uploaded by a user; wherein the service code is configured to generate a service log and output the service log in a preset log format; the service code includes a log printing function, and the log printing function represents the preset log format;

[0110] A monitoring item determination unit 502 is configured to determine, according to the log printing function, character information at a preset position in the business code as a monitoring item to be added;

[0111] The monitoring item adding unit 503 is used to add the monitoring item to be added to the preset monitoring system by calling the preset interface; wherein the preset interface is used to transmit data with the preset monitoring system, and the preset monitoring system is used to monitor the content of the log according to the monitoring item.

[0112] Figure 6 A structural block diagram of a log-based monitoring item processing device provided in an embodiment of the present disclosure, such as Figure 6 As shown, the log-based monitoring item processing device 600 includes a code receiving unit 601 , a monitoring item determining unit 602 and a monitoring item adding unit 603 , wherein the monitoring item determining unit 602 includes a level obtaining module 6021 and a monitoring item determining module 6022 .

[0113] The level acquisition module 6021 is used to obtain the log level in the business code; wherein the log level represents the abnormal level of the log;

[0114] The monitoring item determination module 6022 is used to determine the character information at the preset position in the business code as the monitoring item to be added based on the log printing function and the log level in the business code if the log level in the business code is the preset log level.

[0115] In one example, the monitoring item determination module 6022 includes:

[0116] A code line determination submodule is used to determine, from the business code, a code line corresponding to a log level in the business code as a target code line;

[0117] The monitoring item determination submodule is used to determine, according to the log printing function, character information located at a preset position from the target code line as the monitoring item to be added.

[0118] In one example, it also includes:

[0119] A storage unit is used to associate and store the monitoring item to be added with the log level in the business code.

[0120] In one example, it also includes:

[0121] A log generating unit, configured to generate a log in the preset log format according to the log printing function, as the log to be monitored;

[0122] The information extraction unit is used to extract information corresponding to the monitoring item to be added from the log to be monitored according to the preset log format.

[0123] In one example, the information extraction unit includes:

[0124] A level determination module, used to determine the log level of the log to be monitored;

[0125] A target determination module is used to determine a monitoring item to be added that is associated with the log level of the log to be monitored, as a target monitoring item;

[0126] The information determination module is used to extract information corresponding to the target monitoring item from the to-be-monitored log according to the preset log format.

[0127] In one example, the information determination module includes:

[0128] A position determination submodule is used to determine the position corresponding to the target monitoring item in the to-be-monitored log according to the preset log format, which is the target position;

[0129] The information extraction submodule is used to extract the information at the target location from the log to be monitored, which is the information corresponding to the target monitoring item.

[0130] In one example, it also includes:

[0131] The first prompt unit is used to not extract the monitoring items to be added from the business code if the log levels in the business code are not preset log levels, and to send a first prompt message to the user; wherein, the first prompt message is used to remind the user to check the log levels in the business code.

[0132] In one example, the monitoring item adding unit 603 includes:

[0133] A monitoring item transmission module, configured to transmit the monitoring item to be added to the preset monitoring system by calling a preset interface; wherein the preset monitoring system is configured with a visual interface;

[0134] The monitoring item display module is used to store the monitoring items to be added in the preset monitoring system and display them on the visual interface.

[0135] In one example, it also includes:

[0136] The second prompt unit is used to not extract the monitoring item to be added from the business code if the log printing function does not exist in the business code, and to send a second prompt message to the user; wherein, the second prompt message is used to remind the user to check the log printing function of the business code.

[0137] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device.

[0138] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of the present disclosure. The electronic device may be a terminal device, a processor or a server. Figure 7 As shown, the electronic device 70 includes: at least one processor 702; and a memory 701 communicatively connected to the at least one processor 702; wherein the memory stores instructions that can be executed by the at least one processor 702, and the instructions are executed by the at least one processor 702 to enable the at least one processor 702 to execute the log-based monitoring item processing method disclosed in the present invention.

[0139] The electronic device 70 further includes a receiver 703 and a transmitter 704. The receiver 703 is used to receive instructions and data sent by other devices, and the transmitter 704 is used to send instructions and data to external devices.

[0140] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0141] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0142] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0143] like Figure 8As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. Various programs and data required for the operation of the device 800 can also be stored in the RAM 803. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0144] Various components in device 800 are connected to I / O interface 805, including an input unit 806, such as a keyboard, mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, optical disk, etc.; and a communication unit 809, such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0145] The computing unit 801 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the processing method for monitoring items based on logs. For example, in some embodiments, the processing method for monitoring items based on logs can be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the processing method for monitoring items based on logs described above can be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the log-based monitoring item processing method in any other appropriate manner (for example, by means of firmware).

[0146] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0147] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0148] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0149] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0150] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0151] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. This client-server relationship is established by computer programs running on the respective computers, establishing a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosts and VPS services ("Virtual Private Servers" or simply "VPS"). The server may also be a server in a distributed system or a server integrated with blockchain.

[0152] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0153] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A method for processing log-based monitoring items, wherein the monitoring items represent items in the log that need to be monitored, the method comprising: Receive a business code uploaded by a user; wherein the business code is used to generate a business log and output the business log in a preset log format, the business code includes a log printing function, and the log printing function represents the preset log format; Perform static detection on the business code to determine the preset log level contained in the business code; According to the log printing function, character information located at a preset position is determined from a target code line in the business code, which is a monitoring item to be added; the target code line is a code line corresponding to a log level in the business code; the log level represents the abnormality level of the log; By calling a preset interface, the monitoring item to be added is added to a preset monitoring system; wherein, the preset interface is used to transmit data with the preset monitoring system, and the preset monitoring system is used to monitor the content of the log according to the monitoring item.

2. The method according to claim 1, wherein The method of determining, according to the log printing function, character information at a preset position from a target code line in the business code as a monitoring item to be added, includes: Get the log level in the business code; If the log level in the business code is a preset log level, then according to the log printing function and the log level in the business code, character information at a preset position is determined from the business code as a monitoring item to be added.

3. The method according to claim 2, wherein: The step of determining, based on the log printing function and the log level in the business code, character information at a preset position in the business code as a monitoring item to be added includes: Determine, from the business code, a code line corresponding to a log level in the business code as a target code line; According to the log printing function, character information located at a preset position is determined from the target code line as a monitoring item to be added.

4. The method according to claim 3, further comprising: The monitoring item to be added is associated with the log level in the business code and stored.

5. The method according to claim 4, further comprising: Generate a log in the preset log format according to the log printing function, as the log to be monitored; According to the preset log format, information corresponding to the monitoring item to be added is extracted from the log to be monitored.

6. The method according to claim 5, wherein: The extracting information corresponding to the monitoring item to be added from the to-be-monitored log according to the preset log format includes: Determine the log level of the log to be monitored; Determine a monitoring item to be added that is associated with the log level of the log to be monitored as a target monitoring item; According to the preset log format, information corresponding to the target monitoring item is extracted from the log to be monitored.

7. The method according to claim 6, wherein: The extracting information corresponding to the target monitoring item from the to-be-monitored log according to the preset log format includes: According to the preset log format, determine the position corresponding to the target monitoring item in the log to be monitored as the target position; The information at the target location is extracted from the log to be monitored, which is the information corresponding to the target monitoring item.

8. The method according to any one of claims 2 to 7, further comprising: If the log levels in the business code are not the preset log levels, the monitoring items to be added will not be extracted from the business code, and a first prompt message will be sent to the user; wherein, the first prompt message is used to remind the user to check the log levels in the business code.

9. The method according to any one of claims 1 to 8, wherein The step of adding the monitoring item to be added to the preset monitoring system by calling the preset interface includes: By calling a preset interface, the monitoring item to be added is transmitted to the preset monitoring system; wherein the preset monitoring system is configured with a visual interface; The monitoring items to be added are stored in the preset monitoring system and displayed on the visual interface.

10. The method according to any one of claims 1 to 9, further comprising: If the log printing function does not exist in the business code, the monitoring item to be added will not be extracted from the business code, and a second prompt message will be sent to the user; wherein, the second prompt message is used to remind the user to check the log printing function of the business code.

11. A device for processing monitoring items based on logs, wherein the monitoring items represent items in the logs that need to be monitored, the device comprising: A code receiving unit, configured to receive a service code uploaded by a user; wherein the service code is used to generate a service log and output the service log in a preset log format, wherein the service code includes a log printing function, and the log printing function represents the preset log format; A monitoring item determination unit is configured to perform static detection on the business code to determine a preset log level contained in the business code; determine, according to the log printing function, character information at a preset position from a target code line in the business code as a monitoring item to be added; the target code line is a code line in the business code corresponding to the log level; the log level represents the abnormality level of the log; The monitoring item adding unit is used to add the monitoring item to be added to the preset monitoring system by calling the preset interface; wherein the preset interface is used to transmit data with the preset monitoring system, and the preset monitoring system is used to monitor the content of the log according to the monitoring item.

12. The device according to claim 11, wherein The monitoring item determination unit includes: A level acquisition module is used to obtain the log level in the business code; A monitoring item determination module is used to determine, if the log level in the business code is a preset log level, the character information located at a preset position in the business code according to the log printing function and the log level in the business code, as the monitoring item to be added.

13. The device according to claim 12, wherein The monitoring item determination module includes: A code line determination submodule is used to determine, from the business code, a code line corresponding to a log level in the business code as a target code line; The monitoring item determination submodule is used to determine, according to the log printing function, character information located at a preset position from the target code line as the monitoring item to be added.

14. The apparatus according to claim 13, further comprising: A storage unit is used to associate and store the monitoring item to be added with the log level in the business code.

15. The apparatus according to claim 14, further comprising: A log generating unit, configured to generate a log in the preset log format according to the log printing function, as the log to be monitored; The information extraction unit is used to extract information corresponding to the monitoring item to be added from the log to be monitored according to the preset log format.

16. The device according to claim 15, wherein The information extraction unit includes: A level determination module, used to determine the log level of the log to be monitored; A target determination module is used to determine a monitoring item to be added that is associated with the log level of the log to be monitored, as a target monitoring item; The information determination module is used to extract information corresponding to the target monitoring item from the to-be-monitored log according to the preset log format.

17. The device according to claim 16, wherein The information determination module includes: A position determination submodule is used to determine the position corresponding to the target monitoring item in the to-be-monitored log according to the preset log format, which is the target position; The information extraction submodule is used to extract the information at the target location from the log to be monitored, which is the information corresponding to the target monitoring item.

18. The apparatus according to any one of claims 12 to 17, further comprising: The first prompt unit is used to not extract the monitoring items to be added from the business code if the log levels in the business code are not preset log levels, and to send a first prompt message to the user; wherein, the first prompt message is used to remind the user to check the log levels in the business code.

19. The device according to any one of claims 11 to 18, wherein The monitoring item adding unit includes: A monitoring item transmission module, configured to transmit the monitoring item to be added to the preset monitoring system by calling a preset interface; wherein the preset monitoring system is configured with a visual interface; The monitoring item display module is used to store the monitoring items to be added in the preset monitoring system and display them on the visual interface.

20. The apparatus according to any one of claims 11 to 19, further comprising: The second prompt unit is used to not extract the monitoring item to be added from the business code if the log printing function does not exist in the business code, and to send a second prompt message to the user; wherein, the second prompt message is used to remind the user to check the log printing function of the business code.

21. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.

22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.

23. A computer program product, wherein The invention comprises a computer program, which implements the steps of the method according to any one of claims 1 to 10 when executed by a processor.

Citation Information

Patent Citations

  • Log generation method and device

    CN107193721A

  • Log monitoring adding method and device, computer equipment and storage medium

    CN111475369A

  • Log processing method and device

    CN113641523A