A cluster-based log warning method and related equipment
By using target variables and target tags to generate monitoring and alarm resources in a cluster environment, and filtering and processing log error information, the problem of low efficiency of log error monitoring and early warning in the existing technology is solved, and more efficient log alarm processing is achieved.
Patent Information
- Application Number
- CN202210834294.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-14
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2042-07-14
AI Technical Summary
The monitoring and early warning efficiency of log error reports in the existing technology is insufficient, resulting in low real-time processing of error information, a long API interface development cycle, and some information being missed.
The cluster-based log warning method is used to obtain the target variables and target tags in the monitoring instructions, generate monitoring resources and alarm resources, filter the cluster logs, determine the primary log and its alarm information, and send the alarm information to the pre-connected alarm terminal.
It improves the efficiency and real-time nature of log alarms, separates the filtering and alarm processes, and improves the work efficiency of processing personnel.
Smart Images

Figure CN115333929B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data monitoring, and in particular to a cluster-based log early warning method and related equipment. Background Art
[0002] In a cluster environment, application programs often encounter runtime errors during operation. These runtime errors may affect the operation of the application and may even cause the application to freeze or fail to run.
[0003] There are three main popular monitoring methods:
[0004] 1. Collect the application logs to the visual interface, and use keywords such as "error" to find error logs that may contain error information in these logs on the visual interface, and send these error logs to the processing personnel for processing. It takes some time for such error logs to be sent to the processing personnel, and the processing personnel generally process the error logs in the order in which they arrive after receiving them. The latest error log needs to wait for a while before being processed, but during this period of time, the error corresponding to the error log still exists, and the real-time resolution of the error is low.
[0005] 2. Use API interfaces to collect error information and alarm components. Although this method can obtain error information quickly, different applications have different API interfaces, so the development cycle is long. In addition, the use of API interfaces also needs to be considered during the product iteration process, and the product development and iteration time is long.
[0006] 3. Only data information such as processes and ports are monitored. Although this data information can cover most operating errors, some information is still missed, which is not conducive to the collection of error-related information by processing personnel. Summary of the invention
[0007] The technical problem to be solved by the present invention is that the current monitoring and early warning efficiency of log errors is insufficient. Aiming at the shortcomings of the prior art, a cluster-based log early warning method and related equipment are provided.
[0008] In order to solve the above technical problems, the technical solution adopted by the present invention is as follows:
[0009] A cluster-based log early warning method, the method comprising:
[0010] Obtaining a monitoring instruction, wherein the monitoring instruction includes a target variable and a target label;
[0011] Generate a first monitoring resource and a first alarm resource according to the target variable and the target tag;
[0012] When a cluster log is detected, the cluster log is screened based on the first monitoring resource to determine a preliminary selected log in the cluster log and a metric tag corresponding to the preliminary selected log;
[0013] Determine, based on the first alarm resource and the metric tag, a target log in the preliminary selected logs and alarm information corresponding to the target log;
[0014] The alarm information is sent to a pre-connected alarm terminal.
[0015] The cluster-based log warning method, wherein the target variable includes a monitoring variable and an alarm variable, and the target tag includes a monitoring tag and an alarm tag; and generating a first monitoring resource and a first alarm resource according to the target variable and the target tag includes:
[0016] Initialize the preset operating environment based on the preset deployment file to obtain the monitoring environment and the alarm environment;
[0017] According to the monitoring variable and the monitoring tag, the monitoring environment is configured with monitoring parameters to obtain a first monitoring resource; and
[0018] According to the alarm variable and the alarm tag, alarm parameters are configured for the alarm environment to obtain a first alarm resource.
[0019] The cluster-based log warning method, wherein, after generating the first monitoring resource and the first alarm resource according to the monitoring instruction, further comprises:
[0020] When the monitoring parameter configuration fails or the alarm parameter configuration fails, generating prompt information according to the target scalar and the target tag;
[0021] The prompt information is sent to the pre-connected deployment terminal.
[0022] The cluster-based log early warning method, wherein the step of determining the target log in the preliminary selected log and the alarm information corresponding to the target log based on the first alarm resource and the metric tag comprises:
[0023] Determine, according to the metric label, the monitoring indicator corresponding to the primary selected log and the monitoring value corresponding to each of the monitoring indicators;
[0024] Based on the first alarm resource, calculating the risk indicator and risk value corresponding to the monitoring value;
[0025] Determining a target log in the preliminary selected logs according to the risk value;
[0026] Generate warning information according to the target log.
[0027] The cluster-based log early warning method, wherein the sending of the alarm information to a pre-connected alarm terminal comprises:
[0028] Determining, according to the alarm rule in the first alarm resource, the alarm terminal and the target terminal corresponding to the alarm information;
[0029] The alarm file is sent to the target terminal.
[0030] The cluster-based log warning method, wherein, before obtaining the monitoring instruction, the method further includes:
[0031] Obtaining a deployment file, wherein the deployment file includes variable information, and the variable information includes variable fields and a label value corresponding to each variable field;
[0032] Optionally convert the variable information to obtain variable options;
[0033] When the determination information for the variable option is detected, a monitoring instruction is generated according to the determination information.
[0034] The cluster-based log early warning method, wherein the method further comprises:
[0035] When a change instruction for the variable option is detected, determining a change field and a change label in the variable field according to the change instruction;
[0036] A second monitoring resource and a second alarm resource are generated according to the change field and the change tag.
[0037] A cluster-based log warning device, comprising:
[0038] An acquisition module, used for acquiring a monitoring instruction, wherein the monitoring instruction includes a target variable and a target label;
[0039] A generating module, configured to generate a first monitoring resource and a first alarm resource according to the target variable and the target tag;
[0040] A first determination module is used to, when a cluster log is detected, screen the cluster log based on the first monitoring resource to determine a preliminary selected log in the cluster log and a metric tag corresponding to the preliminary selected log;
[0041] A second determination module is used to determine a target log in the preliminary selected logs and alarm information corresponding to the target log based on the first alarm resource and the metric tag;
[0042] The sending module is used to send the alarm information to a pre-connected alarm terminal.
[0043] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in any of the above-mentioned cluster-based log warning methods.
[0044] A terminal device comprises: a processor, a memory and a communication bus; the memory stores a computer-readable program executable by the processor;
[0045] The communication bus realizes the connection and communication between the processor and the memory;
[0046] When the processor executes the computer-readable program, the steps in any of the above-mentioned cluster-based log warning methods are implemented.
[0047] Beneficial effect: First, a monitoring instruction for monitoring the log of the cluster is obtained, and the monitoring instruction contains a target variable and a target label, so as to determine the object to be monitored subsequently, so as to generate a first monitoring resource for monitoring and a first alarm resource for alarming. When the cluster log is detected, the first monitoring resource can screen the log to determine the object to be monitored, that is, the preliminary log, and the first monitoring resource is generated according to the target variable and the target label. Therefore, after screening, the nature and quantity of the target variable and the target label in the preliminary log can also be determined, and the metric label corresponding to the preliminary log can be determined. Then, based on the first alarm resource and the metric label, the target log of the preliminary log and the alarm information corresponding to the target log can be further determined. The alarm information can include the form of an alarm report and the like, and it is sent to the alarm terminal. Compared with the previous method of displaying the log first and then screening, this method performs screening and determines the alarm content when the log is displayed, which improves the efficiency of the alarm. In addition, screening and alarming are performed separately, and the division of labor can improve the efficiency of alarming. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A flow chart of the cluster-based log early warning method provided by the present invention.
[0049] Figure 2 This is an overall flow chart of the cluster-based log early warning method provided by the present invention.
[0050] Figure 3 The present invention provides a flow chart for configuring parameters in the cluster-based log early warning method.
[0051] Figure 4 A schematic diagram of alarm information of the cluster-based log early warning method provided by the present invention.
[0052] Figure 5 A flow chart of updating configuration parameters of the cluster-based log early warning method provided by the present invention.
[0053] Figure 6 A schematic diagram of the structure of a cluster-based log early warning device provided by the present invention.
[0054] Figure 7 This is a structural principle diagram of the terminal device provided by the present invention. DETAILED DESCRIPTION
[0055] The present invention provides a cluster-based log early warning method. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0056] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0057] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.
[0058] like Figure 1 As shown, this implementation provides a cluster-based log warning method. For the convenience of description, a common server is used as the execution subject for description. The server here can be replaced by a device with data processing function such as a tablet or a computer. The cluster-based log warning method includes the following steps:
[0059] S10: Get monitoring instructions.
[0060] Specifically, the monitoring instruction is an instruction for starting the monitoring program and issuing the information of the object to be monitored. In order to determine the monitored object, the monitoring instruction includes a target variable and a target tag. The target variable refers to the variable that may exist during the operation, such as different server sources of the log, different application sources, and different functions. The target tag refers to the label on the log, which is used to distinguish the content expressed in the log. For example, the target variable in a monitoring instruction is "server" and the target tag is "server 1", which means that the object to be monitored is the log from server 1.
[0061] Since the application has updates and iterations during the service process, in each update and iteration process, the target variables and target tags are re-set according to the environment settings and purposes, which takes a lot of time and increases the update time. Therefore, in this embodiment, a visual way is used to generate the monitoring instructions. The specific process is:
[0062] A10. Get the deployment file.
[0063] First, obtain the deployment file used to deploy the cluster environment, such as Figure 2 As shown, the deployment file can be written in Helm. Helm is a Kubernetes tool with the ability of a package manager. It can package a group of K8S resources for unified management, and realize the search, sharing and use of software built for Kubernetes. The deployment file can include configuration files (value.yaml) and template files (templates). The deployment file contains variable information, which includes variable fields and label values corresponding to each variable field. For example, if the variable field is "server", the label values include "server 1", "server 2" and "server 3".
[0064] A20. Optionally convert the variable information into variable options to obtain variable options.
[0065] Specifically, although the deployment file contains a lot of variable information, not all variable information needs to be monitored or alarmed. At this time, the variable information is optional and displayed in the form of options. For example, it can be displayed on the display screen as "Server-Server 1" or "Server-Service Area 2".
[0066] A30. When confirmation information for the variable option is detected, a monitoring instruction is generated according to the confirmation information.
[0067] Specifically, when the user needs to issue a monitoring instruction, the user can use methods such as clicking, inputting, and keyword matching to determine the variable fields and label values required in the variable options. For example, the variable options are displayed in the form of a selection box, and the user can click the selection box to select the required variable fields and label values; the user enters a keyword in the input box, such as "Server 1", and the variable options related to "Server 1" will pop up automatically. The user can complete the input or click the variable option to complete the confirmation and obtain the confirmed information. Then, the monitoring instruction is generated according to the variable fields and label values corresponding to the confirmed information. In addition, if Figures 2-3 As shown, optionization can be implemented using Jenkins.
[0068] S20. Generate a first monitoring resource and a first alarm resource according to the target variable and the target tag.
[0069] Specifically, Figure 2 As shown, after obtaining the monitoring instruction, it is necessary to generate a first monitoring resource for monitoring and a second monitoring resource for alarming.
[0070] Before generating the first monitoring resource and the first alarm resource, the current cluster environment needs to be deployed so as to install and configure the first monitoring resource and the first alarm resource.
[0071] When or before obtaining the monitoring instruction, you can first write the deployment file corresponding to the cluster according to Helm based on the actual scenario of the cluster. Taking the deployment files value.yaml and templates as an example, after obtaining the deployment file, you can first initialize the preset environment to obtain the environment that can subsequently monitor and alarm, that is, the monitoring environment and the alarm environment. However, at this time, the objects to be monitored and alarmed are not known, so after obtaining the target variables and target labels, you need to configure the parameters of the monitoring environment and the alarm environment.
[0072] like Figure 2 As shown, taking the subsequent monitoring using Loggie as an example, Loggie is a lightweight, high-performance, cloud-native log collection Agent and transfer processing Aggregator based on Golang, which supports log transfer, filtering, parsing and other functions, and has production-level features. Loggie is configured with monitoring parameters using target variables and target tags to obtain a first monitoring resource that can monitor target variables and target tags. Since this embodiment is based on cluster monitoring, the first monitoring resource is also a LogConfig CRD resource.
[0073] Taking the use of Prometheus for alarm as an example, Prometheus is an open source system monitoring and alarm system for collecting and aggregating indicators as time series data. It has joined the CNCF Foundation and has become the second project hosted by CNCF after k8s. In the kubernetes container management system, Prometheus is usually used for monitoring, and it also supports multiple exporters to collect data. It includes Prometheus Server (server) and PrometheusClient (client). Prometheus also includes Alerts configmap, which uses target variables and target labels to configure alarm parameters for Alerts configmap, thereby obtaining the first alarm resource that can analyze the target variables and target labels and implement alarms. Since it is deployed for Alerts configmap, the first alarm resource can also be called Alerts configmap resource.
[0074] It is worth noting that, in one implementation, the monitoring object of the first monitoring resource and the alarm object of the first alarm resource are the same. In another implementation, the target variable includes a monitoring variable and an alarm variable, the target tag includes a monitoring tag and an alarm tag, the first monitoring resource is generated according to the monitoring variable and the monitoring tag, and the first alarm resource is generated according to the alarm variable and the alarm tag.
[0075] In addition, when the monitoring parameter configuration fails or the alarm parameter configuration fails, a prompt message is generated according to the target scalar and the target tag. The prompt message includes the type of deployment failure, the location of the error, etc. The prompt message can be in the form of a log, that is, a prompt log, which can be sent to a pre-connected deployment terminal so that the user can identify the problem in the deployment process through the prompt log.
[0076] S30: When a cluster log is detected, the cluster log is screened based on the first monitoring resource to determine a preliminary selected log in the cluster log and a metric tag corresponding to the preliminary selected log.
[0077] Specifically, when the cluster is working, different logs will be continuously generated. The logs generated during the operation of the service programs in the cluster are called cluster logs. Figure 2 As shown, the first monitoring resource collects and monitors the cluster logs. Since the first monitoring resource is generated according to the target variable and the target tag, during the collection process, the first monitoring resource can collect the cluster logs, filter the cluster logs, and determine the primary selected logs in the cluster logs.
[0078] Taking the monitoring variable as an example, when a cluster log is detected, the cluster log with the same variable information as the monitoring variable is determined as the preliminary log based on the monitoring variable. For example, if the monitoring variable is "operation and maintenance server", the log from the operation and maintenance server in the cluster log is the preliminary log. Taking the monitoring tag as an example, when the cluster log is detected, the cluster log is traversed by the regular expression or keyword corresponding to the monitoring tag. When the regular expression can filter out the results, or there is a word corresponding to the keyword, the cluster log is used as the preliminary log. For example, if the monitoring tag is "error", in the first monitoring resource, the keywords corresponding to the monitoring tag include "error". When the cluster log contains "error", the cluster log is affixed with the monitoring tag of "error" and is determined to be the preliminary log. In this embodiment, the determination of the preliminary log can be achieved through the LogConfigCRD resource.
[0079] At the same time, there may be multiple corresponding monitoring tags and / or monitoring variables on a preliminary log. According to the type of one or more monitoring tags and / or monitoring variables corresponding to the preliminary log, the metric tag corresponding to the preliminary log can be determined. Metric tags refer to tags used to distinguish preliminary logs. For example, if the monitoring tags corresponding to the preliminary log are "error" and "access error", and the corresponding monitoring variable is "server", then the corresponding metric tag can be "server has access error".
[0080] In one implementation, the user may pre-set label determination rules and metric labels for determining metric labels in the deployment file, for example, first determine the initial label based on the monitoring variable corresponding to the preliminary log, and then determine the metric label in the initial label based on the monitoring label.
[0081] In another implementation, clustering can be used to determine the metric label corresponding to the initial log. For example, the monitoring variables or monitoring labels corresponding to the preliminary logs of a time period are selected for clustering to obtain multiple preliminary log groups, and then different metric labels are attached to different preliminary log groups. Alternatively, several metric labels are set in advance, and then clustering is performed based on the corresponding monitoring labels and monitoring variables, with the metric labels as the target, so as to determine the cluster log corresponding to each metric label. In this embodiment, the metric label can use the metrics indicator.
[0082] S40: Determine a target log in the preliminarily selected logs and alarm information corresponding to the target log based on the first alarm resource and the metric tag.
[0083] Specifically, just as not all logs record error information, the metric tag is for all logs, not logs with abnormal content. Therefore, firstly, based on the first alarm resource and the metric tag, the target log in the preliminary log is determined. For example, the metric tag is similar to the alarm tag and / or the alarm variable, so as to determine that the metric tag whose similarity with the alarm tag and / or the alarm variable exceeds the preset similarity threshold is the monitoring indicator. For each monitoring indicator, the number of the corresponding preliminary logs is its corresponding monitoring value.
[0084] Based on the first alarm resource, the monitoring indicators corresponding to the same alarm label and / or alarm variable are integrated to obtain the risk indicator. Relatively speaking, the sum of the monitoring values is the risk value. According to the risk value, the target log in the preliminary log can be determined. For example, the number of pushes is pre-set, and the preliminary log corresponding to the risk indicator with the highest risk value is used as the target log. For another example, different risk thresholds are set for different risk indicators. For example, the risk threshold is set to 10 for risk indicator A. When the risk value corresponding to the risk indicator is 13, the preliminary log corresponding to the risk indicator is used as the target log. In this way, occasional errors can be excluded from the situation sent to maintenance personnel, thereby improving the effectiveness of problem solving. In addition, an alarm callback can also be set in the first alarm resource. When the risk value exceeds the risk threshold, the callback interface is used to make the business or service corresponding to the risk indicator return to the state before the error report, restore to normal, shorten the fault recovery time, and improve the error processing efficiency.
[0085] After the target log is determined, an alarm message is generated based on the content of the target log, the corresponding monitoring variables, monitoring tags, alarm variables, alarm tags, timestamps, and other contents related to the error. Figure 4 As shown, an alarm template can be pre-set, and the above content can be written into the alarm template to obtain the alarm information. The alarm information can include the description of the error, the corresponding variable field and label value (detail content), the risk description (description), the graph corresponding to the risk indicator (Graph), etc.
[0086] For different risk indicators and their corresponding risk values, Prometheus can push them to graphical display software for graphical display, so as to facilitate the back-end to monitor the specific situation in real time. Granfa can be used as graphical display software.
[0087] S50: Send the alarm information to a pre-connected alarm terminal.
[0088] Specifically, it is pre-connected with multiple alarm terminals to receive the pushed alarm information later. The alarm terminals may include email, phone, text message, instant messaging software, etc.
[0089] In this embodiment, the determination of the target log and the generation of the alarm information can be implemented by the Alerts configmap resource. In addition, the Prometheus server includes a client and a server. The client is responsible for pulling and receiving metrics, while the server is used to expose metrics to the client or push metrics to the client. In this embodiment, after the Alerts configmap determines the target log and the production alarm information, it can actively push the alarm information to the pre-connected alarm terminal. During the push process, it can be implemented through the AlertsManager component of Prometheus.
[0090] Different errors have different impacts on the cluster. Although different alarm terminals can be used for alarms, the main methods of notifying maintenance personnel are different in different time periods, and different maintenance personnel may have different main maintenance objects. In order to improve the timeliness of post-alarm processing, alarm rules are set in the first alarm resource in advance. When the alarm information is generated, the corresponding target terminal is determined according to the alarm rules. For example, for the same alarm information, the appropriate target terminal in the alarm terminal can be determined according to the current time, risk indicators and other information.
[0091] In addition, in this embodiment, since the monitoring instruction is generated by options, the user can also quickly update the monitoring resources and alarm resources by options in the subsequent update iteration process. Figure 5 As shown, the method also includes:
[0092] B10. When a change instruction for the variable option is detected, determine a change field and a change label in the variable field according to the change instruction.
[0093] Specifically, when the user needs to change the object monitored by the first monitoring resource and the object alarmed by the first alarm resource, the user can directly modify the variable options. For example, if the target variable and target label originally determined are "server" and "server 1", the change instruction can change the target variable to "application" and the target label to "application 1". The variable field in the change instruction is used as the change field, and the label value in the change instruction is used as the change label.
[0094] B20. Generate a second monitoring resource and a second alarm resource according to the change field and the change tag.
[0095] Specifically, after obtaining the change field and the change tag, the monitoring parameter configuration and the alarm resource configuration are performed according to the two, so as to obtain the second monitoring resource and the second alarm resource. As it has been described in detail above, it will not be repeated here.
[0096] Based on the above cluster-based log warning method, such as Figure 6 As shown, the present invention also provides a cluster-based log early warning device, comprising:
[0097] An acquisition module 110 is used to acquire a monitoring instruction, wherein the monitoring instruction includes a target variable and a target label;
[0098] A generating module 120, configured to generate a first monitoring resource and a first alarm resource according to the target variable and the target tag;
[0099] A first determination module 130 is configured to, when a cluster log is detected, filter the cluster log based on the first monitoring resource to determine a preliminary selected log in the cluster log and a metric tag corresponding to the preliminary selected log;
[0100] A second determination module 140 is used to determine a target log in the preliminary selected logs and alarm information corresponding to the target log based on the first alarm resource and the metric tag;
[0101] The sending module 150 is used to send the alarm information to a pre-connected alarm terminal.
[0102] The target variable includes a monitoring variable and an alarm variable, and the target tag includes a monitoring tag and an alarm tag; the generating module 120 is specifically applied to:
[0103] Initialize the preset operating environment based on the preset deployment file to obtain the monitoring environment and the alarm environment;
[0104] According to the monitoring variable and the monitoring tag, the monitoring environment is configured with monitoring parameters to obtain a first monitoring resource; and
[0105] According to the alarm variable and the alarm tag, alarm parameters are configured for the alarm environment to obtain a first alarm resource.
[0106] The device further comprises a prompt module, and the prompt module is used for:
[0107] When the monitoring parameter configuration fails or the alarm parameter configuration fails, generating prompt information according to the target scalar and the target tag;
[0108] The prompt information is sent to the pre-connected deployment terminal.
[0109] Wherein, the second determining module 140 includes:
[0110] A first determining unit, configured to determine, according to the metric label, a monitoring indicator corresponding to the primary selected log and a monitoring value corresponding to each of the monitoring indicators;
[0111] a calculation unit, configured to calculate a risk indicator and a risk value corresponding to the monitoring value based on the first alarm resource;
[0112] A second calculation unit, configured to determine a target log in the preliminary selected logs according to the risk value;
[0113] A generating unit is used to generate alarm information according to the target log.
[0114] Wherein, the sending module is specifically used for:
[0115] Determining, according to the alarm rule in the first alarm resource, the alarm terminal and the target terminal corresponding to the alarm information;
[0116] The alarm file is sent to the target terminal.
[0117] The cluster-based log warning method, wherein a module is selected before obtaining the monitoring instruction, and the selection module is specifically used for:
[0118] Obtaining a deployment file, wherein the deployment file includes variable information, and the variable information includes variable fields and a label value corresponding to each variable field;
[0119] Optionally convert the variable information to obtain variable options;
[0120] When the determination information for the variable option is detected, a monitoring instruction is generated according to the determination information.
[0121] The device further comprises a change module, and the change module is used for:
[0122] When a change instruction for the variable option is detected, determining a change field and a change label in the variable field according to the change instruction;
[0123] A second monitoring resource and a second alarm resource are generated according to the change field and the change tag.
[0124] Based on the above cluster-based log warning method, the present invention also provides a terminal device, such as Figure 7As shown, it includes at least one processor 20; a display screen 21; and a memory 22, and may also include a communications interface 23 and a bus 24. The processor 20, the display screen 21, the memory 22, and the communications interface 23 may communicate with each other through the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setting mode. The communications interface 23 may transmit information. The processor 20 may call the logic commands in the memory 22 to execute the method in the above embodiment.
[0125] In addition, the logic commands in the memory 22 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0126] The memory 22, as a computer-readable storage medium, can be configured to store software programs, computer executable programs, such as program commands or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, commands or modules stored in the memory 22, that is, implementing the methods in the above embodiments.
[0127] The memory 22 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, may also be a transient computer-readable storage medium.
[0128] In addition, the specific process of loading and executing the above-mentioned computer-readable storage medium and the multiple command processors in the terminal device has been described in detail in the above-mentioned method, and will not be described one by one here.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. 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. However, 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 embodiments of the present invention.
Claims
1. A cluster-based log warning method, characterized in that: The method comprises: Obtaining a monitoring instruction, wherein the monitoring instruction includes a target variable and a target label; Generate a first monitoring resource and a first alarm resource according to the target variable and the target tag; When a cluster log is detected, the cluster log is screened based on the first monitoring resource to determine a preliminary selected log in the cluster log and a metric tag corresponding to the preliminary selected log; Determine, based on the first alarm resource and the metric tag, a target log in the preliminary selected logs and alarm information corresponding to the target log; Sending the alarm information to a pre-connected alarm terminal; The target variable includes a monitoring variable and an alarm variable, and the target tag includes a monitoring tag and an alarm tag; and generating a first monitoring resource and a first alarm resource according to the target variable and the target tag includes: Based on the preset deployment file, the preset operating environment is initialized to obtain the monitoring environment and the alarm environment; According to the monitoring variable and the monitoring tag, the monitoring environment is configured with monitoring parameters to obtain a first monitoring resource; and According to the alarm variable and the alarm label, an alarm parameter is configured for the alarm environment to obtain a first alarm resource; There are multiple numbers of the monitoring tags and the monitoring variables corresponding to the preliminary selection log, and according to the types of the monitoring tags and the monitoring variables corresponding to the preliminary selection log, determining the metric tag corresponding to the preliminary selection log, wherein the metric tag refers to a tag used to distinguish the preliminary selection log; Among them, the metric label corresponding to the preliminary log is determined by clustering, the monitoring variables or the monitoring labels corresponding to the preliminary logs in a preset time period are selected for clustering to obtain multiple preliminary log groups, and then different metric labels are attached to different preliminary log groups; or a number of metric labels are pre-set, and then clustering is performed based on the corresponding monitoring labels and the monitoring variables, with the metric labels as the target, so as to determine the cluster log corresponding to each metric label.
2. According to the cluster-based log early warning method of claim 1, it is characterized in that: After generating the first monitoring resource and the first alarm resource according to the monitoring instruction, the method further includes: When the monitoring parameter configuration fails or the alarm parameter configuration fails, a prompt message is generated according to the target variable and the target tag; The prompt information is sent to the pre-connected deployment terminal.
3. According to the cluster-based log early warning method of claim 1, it is characterized in that: The determining, based on the first alarm resource and the metric tag, a target log in the preliminary selected log and alarm information corresponding to the target log includes: Determine, according to the metric label, the monitoring indicator corresponding to the primary selected log and the monitoring value corresponding to each of the monitoring indicators; Based on the first alarm resource, calculating the risk indicator and risk value corresponding to the monitoring value; Determining a target log in the preliminary selected logs according to the risk value; Generate warning information according to the target log.
4. The cluster-based log early warning method according to claim 3 is characterized in that: The sending of the alarm information to a pre-connected alarm terminal comprises: Determining, according to the alarm rule in the first alarm resource, the alarm terminal and the target terminal corresponding to the alarm information; The alarm file is sent to the target terminal.
5. The cluster-based log warning method according to any one of claims 1 to 4, characterized in that: The obtaining of the monitoring instruction also includes: Obtaining a deployment file, wherein the deployment file includes variable information, wherein the variable information includes variable fields and a label value corresponding to each variable field; Optionally convert the variable information to obtain variable options; When the determination information for the variable option is detected, a monitoring instruction is generated according to the determination information.
6. The cluster-based log early warning method according to claim 5 is characterized in that: The method further comprises: When a change instruction for the variable option is detected, determining a change field and a change label in the variable field according to the change instruction; A second monitoring resource and a second alarm resource are generated according to the change field and the change tag.
7. A cluster-based log warning device, characterized in that: The cluster-based log early warning device includes: An acquisition module, used for acquiring a monitoring instruction, wherein the monitoring instruction includes a target variable and a target label; A generating module, configured to generate a first monitoring resource and a first alarm resource according to the target variable and the target tag; A first determination module is used to, when a cluster log is detected, screen the cluster log based on the first monitoring resource to determine a preliminary selected log in the cluster log and a metric tag corresponding to the preliminary selected log; A second determination module is used to determine a target log in the preliminary selected logs and alarm information corresponding to the target log based on the first alarm resource and the metric tag; A sending module, used for sending the alarm information to a pre-connected alarm terminal; The target variable includes a monitoring variable and an alarm variable, and the target tag includes a monitoring tag and an alarm tag; the generating module is specifically applied to: Based on the preset deployment file, the preset operating environment is initialized to obtain the monitoring environment and the alarm environment; According to the monitoring variable and the monitoring tag, the monitoring environment is configured with monitoring parameters to obtain a first monitoring resource; and According to the alarm variable and the alarm label, an alarm parameter is configured for the alarm environment to obtain a first alarm resource; There are multiple numbers of the monitoring tags and the monitoring variables corresponding to the preliminary selection log, and according to the types of the monitoring tags and the monitoring variables corresponding to the preliminary selection log, determining the metric tag corresponding to the preliminary selection log, wherein the metric tag refers to a tag used to distinguish the preliminary selection log; Among them, the metric label corresponding to the preliminary log is determined by clustering, the monitoring variables or the monitoring labels corresponding to the preliminary logs in a preset time period are selected for clustering to obtain multiple preliminary log groups, and then different metric labels are attached to different preliminary log groups; or a number of metric labels are pre-set, and then clustering is performed based on the corresponding monitoring labels and the monitoring variables, with the metric labels as the target, so as to determine the cluster log corresponding to each metric label.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the cluster-based log warning method according to any one of claims 1 to 6.
9. A terminal device, characterized in that: include: Processor, memory and communication bus; The memory stores a computer-readable program executable by the processor; The communication bus realizes the connection and communication between the processor and the memory; When the processor executes the computer-readable program, the processor implements the steps of the cluster-based log warning method according to any one of claims 1 to 6.
