Server fault diagnosis method, product, computer equipment and storage medium
By aggregating, vectorizing and clustering server fault logs, determining labels and training diagnostic models, the problems of low log annotation efficiency and poor accuracy in the existing technology are solved, and efficient and accurate fault diagnosis is achieved.
Patent Information
- Application Number
- CN202410634960.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-05-22
AI Technical Summary
It is difficult to annotate abnormal information data in server logs efficiently and accurately with the existing technology, resulting in low efficiency and poor accuracy of server fault diagnosis results.
By obtaining server fault logs, aggregating them according to server addresses to form log groups, performing vectorization processing and clustering, determining the labels of the log groups, storing and training fault diagnosis models in a preset format, and setting labels for newly collected logs to achieve automation Exception information data annotation.
It reduces labor consumption costs, improves the quality and efficiency of log annotation, and improves the efficiency and accuracy of server fault diagnosis results.
Smart Images

Figure CN118211170B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of server fault detection, and in particular to a server fault diagnosis method, product, computer equipment and storage medium. Background Art
[0002] An important aspect of the machine learning process is data annotation, which is the process of labeling and classifying raw data so that it can be used to train machine learning (ML) models. Data annotation is a time-consuming and labor-intensive process that requires a lot of manpower to complete.
[0003] There are many types of server logs, and annotation requires various operation and maintenance experience and knowledge. It depends on the personnel's ability to distinguish logs, locate logs, and accurately capture fault information from multiple anomalies to achieve accurate log annotation. The annotation process requires the annotator to accurately identify fault logs, otherwise it will affect the annotation accuracy. In addition, as the scale of the server increases, the growth rate of logs shows an exponential upward trend. Abnormal logs are mixed in a large amount of basic log information, and the annotation of massive logs will consume a lot of manpower.
[0004] Currently, manual labeling takes a lot of time. Faced with large-scale operation and maintenance logs, labelers lack domain knowledge and the quality of log labeling varies. Rule-based log labeling has the problems of difficult rule writing and slow rule updates. It is difficult to update the regular parsing statements of log text in a short period of time. Clustering logs and other methods may lose important abnormal information, which may determine the type of labeling. Information loss will affect the accuracy of labeling. When a server failure occurs, a variety of log abnormal information will appear. The current AI algorithm cannot achieve effective and accurate fault location. Therefore, it is currently difficult to efficiently and accurately label abnormal information data for server logs, resulting in low efficiency and poor accuracy in server fault diagnosis results. Summary of the invention
[0005] Based on this, it is necessary to provide a server fault diagnosis method, device, computer equipment and storage medium to address the above-mentioned technical problems, so as to achieve efficient and accurate labeling of abnormal information data in the server log, thereby solving the technical problems of low efficiency and poor accuracy of server fault diagnosis results.
[0006] On the one hand, a server fault diagnosis method is provided, which includes: obtaining server fault logs, aggregating the server fault logs under each address according to the server address, and forming a log group corresponding to each server address; vectorizing and clustering the log groups, and obtaining labels of the log groups according to the clustering results; obtaining the server address and label corresponding to each log group, and storing the log groups in a first preset format; training a server fault diagnosis model using the log groups in the first preset format; inputting the newly collected server fault logs into the trained server fault diagnosis model to obtain server fault diagnosis results.
[0007] In one of the embodiments, the steps of obtaining server fault logs, aggregating the server fault logs under each address according to the server address, and forming a log group log corresponding to each server address include: obtaining the corresponding server fault log according to the server address; reading the number of log entries and the log generation time in the server fault log; sorting the server fault logs according to the log generation time; cutting the server fault log into multiple log segments limited to the log number limit range and the time span threshold range according to the number of log entries and the log generation time; reading the log information recorded in each log segment, and merging the log information to form a log group.
[0008] In one of the embodiments, the step of cutting the server fault log into multiple log segments limited to a log number limit range and a time span threshold range according to the number of log entries and the log generation time includes: setting a numerical value of the log number limit range and a numerical value of the time span threshold range; obtaining the log generation time of all log entries in the server fault log, calculating the log recording time span of the server fault log, determining whether the log recording time span is within the time span threshold range, and determining whether the number of log entries in the server fault log is within the log number limit range; in response to the log recording time span being within the time span threshold range and the number of log entries in the server fault log being within the log number limit range, not cutting the server fault log, and cutting the server fault log into multiple log segments. The server fault log is taken as a log segment; in response to the time span of the log recording being within the time span threshold range and the number of log items in the server fault log being not within the log item quota range, the server fault log is cut into multiple log segments according to the log item quota range; in response to the time span of the log recording being not within the time span threshold range and the number of log items in the server fault log being within the log item quota range, the server fault log is cut into multiple log segments according to the time span threshold range; in response to the time span of the log recording being not within the time span threshold range and the number of log items in the server fault log being not within the log item quota range, the server fault log is cut into multiple log segments according to the time span threshold range and the log item quota range.
[0009] In one of the embodiments, the step of cutting the server fault log into multiple log segments limited by the log number limit range and the time span threshold range according to the log number and the log generation time also includes: obtaining the length value of the server fault log when the log number is the maximum value of the log number limit range, and setting the length value as the standard length of the log segment; determining whether the length of each log segment is the standard length; if so, determining that the length of the log segment is qualified; otherwise, determining that the length of the log segment is unqualified, and padding the log segment with zeros to the standard length.
[0010] In one of the embodiments, the steps of vectorizing and clustering the log group and obtaining a label for the log group according to the clustering result include: vectorizing the hardware type and log information in the log group to form a vectorized log; clustering the vectorized log into multiple clusters, and outputting the hardware type corresponding to each cluster; obtaining the number of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; obtaining the labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and using the label corresponding to the cluster with the largest number of vector lists as the label of the log group.
[0011] In one of the embodiments, the step of vectorizing the hardware types and log information in the log group to form vectorized logs includes: extracting the hardware types and log information in the target server fault log as a corpus training set for training a language processing vectorization model; constructing a language processing vectorization model to be trained, using the corpus training set to train the language processing vectorization model to be trained, saving all hardware types after deduplication, and forming a trained language processing vectorization model based on constructing a hardware type key-value pair dictionary; obtaining the hardware types and log information in the server log set, and using the trained language processing vectorization model to vectorize the hardware types and log information in the log group to form a vectorized log.
[0012] In one of the embodiments, the step of extracting the hardware type and log information in the target server fault log as a corpus training set for training a language processing vectorization model includes: obtaining the word order of the hardware type and each word of the log information; obtaining the vector mapping of the hardware type and each word of the log information according to the word order; and summarizing the obtained vectors according to the word order to form a corpus training set.
[0013] In one of the embodiments, the step of clustering the vectorized log into a plurality of clusters by clustering includes: obtaining a hardware type of the vectorized log, and dividing the vectorized log into a plurality of arrays according to the hardware type;
[0014] The array is vectorized to form a vectorized array; all vectorized arrays under the same address number are clustered into multiple clusters by clustering, and the hardware type and number corresponding to each cluster are output.
[0015] In one of the embodiments, the step of outputting the hardware type and number corresponding to each cluster includes: obtaining a vector of the hardware type corresponding to each cluster, and calculating its similarity with the vector under each key of the hardware type key-value pair; for each cluster, initializing the count of the number of occurrences of each key of the hardware type key-value pair to zero, querying the vector under each key of the hardware type key-value pair in the cluster, and in response to the vector being queried, increasing the count of the corresponding key by one; based on the calculated count of the keys in the hardware type key-value pair, obtaining the hardware type and the corresponding count that appear in each cluster.
[0016] In one of the embodiments, the step of obtaining the number of types of hardware types in each cluster and determining the label of the corresponding cluster according to the number of types includes: extracting the hardware types in each cluster and obtaining the number of the hardware types; if the hardware type is one, marking the faulty hardware type as the label of the corresponding cluster; if the hardware type is multiple, counting the number corresponding to each hardware type; obtaining the two types of hardware types with the largest number, and determining whether the corresponding numbers of the two types of hardware types are the same; if the corresponding numbers of the two types of hardware types are different, using the hardware type with the largest number as the label of the cluster; if the corresponding numbers of the two types of hardware types are the same, obtaining all the hardware types with the largest number, constructing a hybrid association model, and outputting the faulty hardware type as the label of the corresponding cluster according to the hybrid association coefficient.
[0017] In one embodiment, the steps of obtaining all the hardware types with the largest number, constructing a hybrid association model, and outputting the faulty hardware type as a label of the corresponding cluster according to the hybrid association coefficient include: counting the total number N of the hardware types with the largest number, numbering the server fault logs corresponding to all hardware types as part_n; where part is the name of the faulty hardware, 1≤n≤N; counting the number of times each hardware type fails in the server fault log N part , count the total number of servers N num ; Calculate the mean number of failures in the server for each hardware type ; Calculate the failure variance for each hardware type ; Calculate the mixed association model coefficients for each hardware type based on the mean and variance ; Get the hybrid correlation model coefficients corresponding to all hardware types, where the hybrid correlation model coefficient of the server fault log numbered Part_n is ; Sort the obtained hybrid association model coefficients in descending order, and use the hardware type corresponding to the maximum value of the hybrid association model coefficient as the label of the cluster.
[0018] In one of the embodiments, the steps of obtaining labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group include: constructing each cluster into a second preset format, and constructing it into a two-dimensional array according to the log sequence in the log group; obtaining labels of all clusters in the log group of each server address, and forming a vector list with the vector array associated with each label; clustering the vector list to form multiple clusters; traversing the two-dimensional array, querying the cluster where each vector array is located, and counting the number of labels corresponding to the vector array in each cluster; calculating the weight of each label in each cluster, and calculating the weight of each label in the log group in a summation manner; sorting the labels according to their weights, and taking the label with the largest weight as the label of the log group.
[0019] On the other hand, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: obtaining server fault logs, aggregating the server fault logs under each address according to the server address, and forming a log group corresponding to each server address; vectorizing the hardware type and log information in the log group to form a vectorized log; clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; obtaining the number of types of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; obtaining the labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group; obtaining the server address and label corresponding to each log group, and storing the log group in a first preset format; training a server fault diagnosis model using the log group in the first preset format; inputting the newly collected server fault log into the trained server fault diagnosis model to obtain a server fault diagnosis result.
[0020] On the other hand, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: obtaining server fault logs, aggregating the server fault logs under each address according to the server address, and forming a log group corresponding to each server address; vectorizing the hardware type and log information in the log group to form a vectorized log; clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; obtaining the number of types of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; obtaining the labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group; obtaining the server address and label corresponding to each log group, and storing the log group in a first preset format; training a server fault diagnosis model using the log group in the first preset format; inputting the newly collected server fault log into the trained server fault diagnosis model to obtain a server fault diagnosis result.
[0021] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: obtaining server fault logs, aggregating the server fault logs under each address according to the server address, and forming a log group corresponding to each server address; vectorizing the hardware type and log information in the log group to form a vectorized log; clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; obtaining the number of types of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; obtaining the labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group; obtaining the server address and label corresponding to each log group, and storing the log group in a first preset format; training a server fault diagnosis model using the log group in the first preset format; inputting the newly collected server fault log into the trained server fault diagnosis model to obtain a server fault diagnosis result.
[0022] The above-mentioned server fault diagnosis method, product, computer equipment and storage medium first aggregate the acquired server fault logs according to the server address to form a log group, then vectorize and cluster the log group to determine the label of the log group, store the log group in a first preset format, and train the server fault diagnosis model to set labels for the newly collected server fault logs, thereby realizing automatic and efficient and accurate labeling of abnormal information data in the server logs, reducing manpower consumption costs, and improving the quality and efficiency of log labeling. The server fault diagnosis model is trained based on the log group with accurately labeled labels to perform label setting, thereby improving the efficiency and accuracy of the server fault diagnosis results. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 This is an application environment diagram of a server fault diagnosis method in one embodiment of the present application;
[0025] Figure 2 This is a flow chart of a server fault diagnosis method in one embodiment of the present application;
[0026] Figure 3 This is a judgment logic diagram of a server fault diagnosis method in one embodiment of the present application;
[0027] Figure 4 A flowchart of the steps of obtaining a server fault log in one embodiment of the present application, aggregating the server fault logs under each address according to the server address, and forming a log group log corresponding to each server address;
[0028] Figure 5 A schematic diagram of a process for performing vectorization and clustering processing on the log group and obtaining a label step of the log group according to the clustering result in one embodiment of the present application;
[0029] Figure 6 In one embodiment of the present application, vectorization is performed on the hardware type and log information in the log group to form a flow chart of the vectorized log step;
[0030] Figure 7 A flowchart of obtaining the number of types of hardware types in each cluster and determining the label of the corresponding cluster according to the number of types in one embodiment of the present application;
[0031] Figure 8 A flowchart of the steps of obtaining labels of all clusters in a log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and using the label corresponding to the cluster with the largest number of vector lists as the label of the log group in one embodiment of the present application;
[0032] Fig. 9 A schematic diagram of the steps of obtaining server fault logs in one embodiment of the present application, aggregating server fault logs under each address according to the server address, and forming a log group log corresponding to each server address;
[0033] Fig.10 This is a structural block diagram of a fault diagnosis unit in one embodiment of the present application;
[0034] Fig.11 This is a diagram of the internal structure of a computer device in one embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0036] As mentioned in the background technology, an important aspect of the machine learning process is data annotation, which is the process of labeling and classifying raw data so that it can be used to train machine learning (ML) models. Data annotation is a time-consuming and labor-intensive process, which usually requires a large team of manual annotation to accurately label a large amount of data. Currently, annotation is usually done in the form of crowdsourcing, using an annotation team to assign annotation tasks, reduce the time required, and meet the annotation needs of a large amount of data.
[0037] Server logs include SEL logs, audit logs, IDL logs, system logs, RAID card logs, and various operation data such as CPLD register logs, MCA register logs, etc. They also include various configurations such as user information, BMC network, and logs generated by various components, such as RAID card logs. There are many types of logs, and annotation requires various operation and maintenance experience and knowledge. It depends on the personnel's ability to distinguish logs, locate logs, and accurately capture fault information from multiple anomalies to achieve accurate log annotation. This process first requires annotators to locate abnormal log lines from massive logs, which is a high requirement. In addition, a large amount of abnormal information usually covers up the real fault logs, making it difficult to annotate faults and affecting the accuracy of annotation. In addition, with the increase in server scale, the log growth rate shows an exponential upward trend. Abnormal logs are mixed in a large amount of basic log information, and the annotation of massive logs will consume a lot of manpower.
[0038] The existing solutions for log data annotation required by the server fault diagnosis system are as follows: The first one is based on manual processing. The operation and maintenance personnel understand the logs through their experience and knowledge, and annotate the logs according to the log content and the fault category. Manual annotation takes a lot of time, especially when facing large-scale operation and maintenance logs. It requires a lot of human resources, and operation and maintenance log annotation requires a lot of domain knowledge. In the traditional crowdsourcing model, the annotation personnel lack domain knowledge, and the quality of log annotation varies. It is difficult for professional operation and maintenance personnel to complete the annotation task of massive logs.
[0039] The second method is rule-based, using regular parsing statements of log text to parse the logs, extract keywords, and manually annotate the parsed logs. Compared with the full log, the log volume after rule parsing is significantly reduced, and the keywords are more obvious, which can effectively improve the efficiency of log annotation. Rule-based log annotation has the problems of difficult rule writing and slow rule updating. With the rapid iteration of server models, continuous hardware updates, and the continuous addition of new hardware, the number and diversity of logs have increased sharply, making it difficult to update the regular parsing statements of log text in a short period of time.
[0040] The third method is to extract log events based on AI algorithms and use clustering algorithms, such as the Drain algorithm, to cluster logs with consistent structures based on frequent pattern mining. Further annotation is performed manually based on the clusters. Currently, common AI algorithms use methods such as log clustering based on frequent pattern mining, which may lose important abnormal information, and important abnormal information may determine the type of annotation. Information loss will affect the accuracy of annotation. When a server failure occurs, multiple log abnormal information will appear. Currently, AI algorithms cannot effectively and accurately locate the fault.
[0041] To solve the above problems, the present invention creatively proposes a server fault diagnosis method, which can be applied to Figure 1 In the application environment shown. Among them, the server includes a server hardware layer, a kernel and a fault diagnosis unit. The server hardware layer is provided with a baseboard management controller (BMC), server hardware and an input-output interface. The baseboard management controller manages the server hardware, and the server hardware interacts with the input-output interface. The kernel is provided with a server log extraction module and a server fault log collection module. The server log extraction module obtains the server log through the input-output interface, and the server fault log collection module filters out the fault log. The fault diagnosis unit is used to implement a server fault diagnosis method, identify the server hardware that has a fault by performing server fault diagnosis on the fault log, and then control the operation of the server hardware that has a fault through the input-output interface.
[0042] In one embodiment, Figure 2 , Figure 3 As shown, a server fault diagnosis method is provided, which is applied to Figure 1 The fault diagnosis unit in is taken as an example to illustrate, comprising the following steps: step S1, obtaining server fault logs, aggregating server fault logs under each address according to server addresses (IDs) to form log groups corresponding to each server address; step S2, vectorizing and clustering the log groups, and obtaining labels of the log groups according to the clustering results; step S3, obtaining the server addresses and labels corresponding to each log group, and storing the log groups in a first preset format; step S4, training a server fault diagnosis model using the log groups in the first preset format; step S5, inputting the newly collected server fault logs into the trained server fault diagnosis model to obtain server fault diagnosis results.
[0043] A decision tree model, a Lightgbm model, an Xgboost model or a neural network model is selected as the server fault diagnosis model. The newly collected server fault log is input into the trained server fault diagnosis model to obtain the server fault diagnosis result, that is, the trained server fault diagnosis model is used to set labels for the newly collected server fault log, the label setting result is output, and the label setting result is used as the server fault diagnosis result.
[0044] The first preset format is in the form of {server address: log group data: label}.
[0045] First, the acquired server fault logs are aggregated according to the server addresses to form log groups through step S1, and then the log groups are vectorized and clustered to determine the labels of the log groups through step S2, and the log groups are stored in a first preset format. The server fault diagnosis model is trained through steps S4-S5 to set labels for the newly collected server fault logs, thereby realizing automatic and efficient and accurate labeling of abnormal information data for server logs, reducing manpower consumption costs, and improving the quality and efficiency of log labeling.
[0046] The step of obtaining the server fault log includes: creating a log collection warehouse, in which the log information of the server log is stored in the format of timestamp | hardware type | hardware sensor name | log details | status code; obtaining the server log collected by the server, and classifying and storing them in the log collection warehouse according to the server address; and filtering out the server fault log from the server log by identifying the status code in the server log.
[0047] This application can collect the generated server logs in a timely manner by creating a log collection warehouse to avoid the server logs being rolled over, and the log information of the server logs is saved in a unified format, which can facilitate the identification of the recorded information. The status code in the server log can be used to quickly filter out the server fault log, thereby improving the speed of obtaining the server fault log.
[0048] It is worth noting that in the process of creating a log collection warehouse, the basic information of the system log is created and a basic information data model library of the log is established. The main table structure is shown in Table 1.
[0049] Table 1
[0050]
[0051] The log MSG structure is as follows: time | sensor_type | sensor_name | msg_info | status, that is, timestamp | hardware type | hardware sensor name | log details | status code format. Sensor types include: central processing unit, memory, hard disk, PCIe card, Raid card, backplane, motherboard, power supply, fan, graphics card, HBA card, temperature sensor and other server components. The hardware sensor name is in the form of "hardware type_number", marking the number of the hardware associated with the hardware log (such as cpu_0 means CPU No. 0). Log details include: 'Firmware or software change', 'Firmware or softwarechange detected' and other specific log information. The types include normal log information, abnormal log information, fault log information, etc.
[0052] When obtaining server fault logs, log data collection is also included. Specifically, data collection is started to collect log information of a large number of servers, and the log information is collected according to the server ID, where the ID is composed of the server ID number and the server IP, and the logs collected under each ID are stored in the cloud database system. The storage format is shown in Table 2.
[0053] Table 2
[0054]
[0055] That is, one server ID corresponds to multiple logs, and the subsequent intelligent labeling is to analyze the multiple logs under each ID. If there is no fault, it is marked as normal. If there is a fault, the specific category of the fault is obtained according to the log content.
[0056] like Figure 4 As shown, in this embodiment, the steps of obtaining the server fault log, aggregating the server fault log under each address according to the server address, and forming a log group log corresponding to each server address include: step S11, obtaining the corresponding server fault log according to the server address; step S12, reading the number of log entries and the log generation time in the server fault log; step S13, sorting the server fault log according to the log generation time; step S14, cutting the server fault log into multiple log segments limited to the log number limit range and the time span threshold range according to the number of log entries and the log generation time; step S15, reading the log information recorded in each log segment, and merging the log information to form a log group.
[0057] Server failures are highly time-sensitive. For the same server, the BMC storage capacity is limited, and the BMC system log can only store a certain number of logs. If the system has no abnormalities, the log storage time interval may span a large span. If the failure or abnormality persists, the log storage time interval may be shorter. In addition, the most recent abnormality and failure logs are usually collected by the BMC when the server fails, and then stored and saved in the log storage system.
[0058] like Figure 3As shown, in this embodiment, the step of cutting the server fault log into multiple log segments limited to the log number limit range and the time span threshold range according to the log number and the log generation time includes: setting the numerical value of the log number limit range and the numerical value of the time span threshold range; obtaining the log generation time of all log entries in the server fault log, calculating the log recording time span of the server fault log, judging whether the log recording time span is within the time span threshold range, and judging whether the number of log entries in the server fault log is within the log number limit range; in response to the log recording time span being within the time span threshold range and the number of log entries in the server fault log being within the log number limit range, not cutting the server fault log, and cutting the server fault log. The server fault log is taken as a log segment; in response to the time span of the log recording being within the time span threshold range and the number of log items in the server fault log being not within the log item quota range, the server fault log is cut into multiple log segments according to the log item quota range; in response to the time span of the log recording being not within the time span threshold range and the number of log items in the server fault log being within the log item quota range, the server fault log is cut into multiple log segments according to the time span threshold range; in response to the time span of the log recording being not within the time span threshold range and the number of log items in the server fault log being not within the log item quota range, the server fault log is cut into multiple log segments according to the time span threshold range and the log item quota range.
[0059] The BMC collects logs at inconsistent intervals, and window extraction or supplementation is required. The window size extraction mainly considers the time-span threshold T_limit and the log count limit N_limit. The window function is constructed to satisfy the following calculation logic: Case 1: When the time span T under the server ID is less than T_limit and N_log is less than N_limit, zero-padding is performed on the field length Text_log of the log segment; Case 2: When the time span under the server ID is greater than T_limit and N_log is less than N_limit, the logs for T_limit are intercepted, and then zero-padding is performed on the field length Text_log of the truncated log segment; Case 3: When the time span under the server ID is less than T_limit and N_log is greater than N_limit, the logs for N_limit are intercepted; Case 4: When the time span under the server ID is greater than T_limit and N_log is greater than N_limit, the logs for T_limit are intercepted. If the number of logs N_crop after truncation at this time is greater than N_limit, continue to intercept the logs to obtain the most recent N_limit logs. If the number of logs N_crop after truncation at this time is less than N_limit, then zero-padding is performed on the field length Text_log of the truncated log segment. The log information processed by the window is stored in the cloud database for use in subsequent steps of the calculation.
[0060] The logs are divided into multiple segments by window cropping, and zero-padding is performed to avoid the inconsistent lengths of server logs affecting the labeling results. The zero-padding method ensures that all log segments have the same length, facilitating the accurate determination of the hardware type with a fault.
[0061] In this embodiment, the step of cropping the server fault logs into multiple log segments limited within the log count limit range and the time-span threshold range according to the log count and the log generation time further includes: obtaining the length value of the server fault logs when the log count is the maximum value within the log count limit range, and setting this length value as the standard length of the log segment; determining whether the length of each log segment is the standard length; if so, determining that the length of the log segment is qualified; if not, determining that the length of the log segment is unqualified, and performing zero-padding on the log segment to the standard length.
[0062] As Figure 5As shown, in this embodiment, the step of vectorizing and clustering the log group and obtaining the label of the log group according to the clustering result includes: step S21, vectorizing the hardware type and log information in the log group to form a vectorized log; step S22, clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; step S23, obtaining the number of types of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; step S24, obtaining the labels of all clusters in the log group of each server address, obtaining the vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group; as shown in FIG. Figure 6 As shown, in this embodiment, the step of vectorizing the hardware type and log information in the log group to form a vectorized log includes: step S31, extracting the hardware type and log information in the target server fault log as a corpus training set for training a language processing vectorization model; step S32, constructing a language processing vectorization model to be trained, using the corpus training set to train the language processing vectorization model to be trained, saving all the hardware types after deduplication, and forming a trained language processing vectorization model based on constructing a hardware type key-value pair dictionary; step S33, obtaining the hardware type and log information in the server log set, and using the trained language processing vectorization model to vectorize the hardware type and log information in the log group to form a vectorized log.
[0063] The format of the hardware type key-value pair dictionary is {hardware type: vector}.
[0064] Construct vectorized features of server component categories. The server component categories come from the hardware type column of the log. The sensor location is represented by the hardware sensor name. The log details show the fault status or fault resolution status. The status code Assert indicates when a fault occurs, and Deassert indicates that the fault is resolved. For example, in "2023-01-29 17:19:20|Memory|CPU1F0_DIMM|Uncorrectable ECC|Assert", the second column "Memory" is the component category, CPU1F0_DIMM is the sensor name, Uncorrectable ECC indicates that a memory fault occurs, and Assert indicates confirmation.
[0065] Get all server log information processed by the above window in T days (T should not be too small), extract the hardware type column, filter and get the category of the server's components or assemblies that may fail, which is used to determine the type of failure, counted as N_class, and the number of categories obtained is used as the number of clusters for subsequent clustering. Extract all log detail columns that meet the status code of Assert, and preferably use Word2Vec to vectorize the category of the component or assembly and the log detail column.
[0066] Extract server fault logs for Word2Vec vectorization model training, obtain server logs, extract hardware types and log details in the logs, vectorize them, and train the Word2Vec model.
[0067] In this embodiment, the step of extracting the hardware type and log information in the target server fault log as a corpus training set for training a language processing vectorization model includes: obtaining the word order of the hardware type and each word of the log information; obtaining the vector mapping of the hardware type and each word of the log information according to the word order; and summarizing the obtained vectors according to the word order to form a corpus training set.
[0068] In this embodiment, the step of clustering the vectorized log into multiple clusters by clustering includes: obtaining the hardware type of the vectorized log, and dividing the vectorized log into multiple arrays according to the hardware type; performing vectorization processing on the array to form a vectorized array; clustering all vectorized arrays under the same address number into multiple clusters by clustering, and outputting the hardware type and number corresponding to each cluster.
[0069] In this embodiment, the step of outputting the hardware type and number corresponding to each cluster includes: obtaining the vector of the hardware type corresponding to each cluster, and calculating its similarity with the vector under each key of the hardware type key-value pair; for each cluster, initializing the count of the number of occurrences of each key of the hardware type key-value pair to zero, querying the vector under each key of the hardware type key-value pair in the cluster, and in response to the vector being queried, the count of the corresponding key is increased by one; based on the calculated count of the keys in the hardware type key-value pair, obtaining the hardware type and the corresponding count that appear in each cluster.
[0070] like Figure 7As shown, in this embodiment, the step of obtaining the number of types of hardware types in each cluster and determining the label of the corresponding cluster according to the number of types includes: step S41, extracting the hardware types in each cluster and obtaining the number of the hardware types; step S42, if the hardware type is one, marking the faulty hardware type as the label of the corresponding cluster; step S43, if the hardware type is multiple, counting the number corresponding to each hardware type; step S44, obtaining the two types of hardware types with the largest number, and determining whether the corresponding numbers of the two types of hardware types are the same; step S45, if the corresponding numbers of the two types of hardware types are different, using the hardware type with the largest number as the label of the cluster; step S46, if the corresponding numbers of the two types of hardware types are the same, obtaining all the hardware types with the largest number, constructing a hybrid association model, and outputting the faulty hardware type as the label of the corresponding cluster according to the hybrid association coefficient.
[0071] That is, if there is only one hardware type, directly mark this hardware type as the label of this cluster; if the number of hardware types in the cluster is > 1, count the total number of categories Ntotal and the number of each category {N 类别1 , N 类别2 ,...,N Ntotal}. When the number of hardware types in the cluster is greater than 1, the number corresponding to each category {N 类别1 , N 类别2 ,...,N Ntotal} Sort and get the two types of hardware with the largest number of corresponding numbers. If the corresponding numbers of the two types of hardware are inconsistent, the hardware type with the largest number is the category of the cluster. If the numbers of the first few bits are consistent according to the data sorting corresponding to the hardware type, then first count the total number of hardware types with the largest number of corresponding hardware N 一致 ,Then build a hybrid association model to achieve the correspondence between hardware types and clusters.
[0072] In this embodiment, the steps of obtaining all the hardware types with the largest number, constructing a hybrid association model, and outputting the faulty hardware type as a label of the corresponding cluster according to the hybrid association coefficient include: counting the total number N of the hardware types with the largest number, and numbering the server fault logs corresponding to all hardware types as part_n; wherein part is the name of the faulty hardware, 1≤n≤N, that is, the server fault logs corresponding to all hardware types are numbered as part_1, part_2, ..., part_n, ..., part_N; and counting the number of times N that each hardware type fails in the server fault log. part , count the total number of servers N num ; Calculate the mean number of failures in the server for each hardware type ; Calculate the failure variance for each hardware type ; Calculate the mixed association model coefficients for each hardware type based on the mean and variance ; Get the hybrid correlation model coefficients corresponding to all hardware types, where the hybrid correlation model coefficient of the server fault log numbered Part_n is ; Sort the obtained hybrid association model coefficients in descending order, and use the hardware type corresponding to the maximum value of the hybrid association model coefficient as the label of the cluster.
[0073] It can be understood that the hybrid correlation model is constructed as follows: for all log samples, for N consistent hardware items, numbered as Part1, Part2, ..., , count the frequency of these hardware failures and the total number of failures. If a certain hardware of the server fails, it is recorded as Epart=1. In the subscript, part is the name of the failed hardware, such as memory, CPU, hard disk, backplane, motherboard, Raid card, graphics card, etc. The total number of servers counted is Nnum. Calculate the number of failures belonging to different hardware names and the average number of failures in the server. The calculation formula is , .
[0074] like Figure 8 As shown, in this embodiment, the steps of obtaining the labels of all clusters in the log group of each server address, obtaining the vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group include: step S51, constructing each cluster into a second preset format, and constructing it into a two-dimensional array according to the log sequence in the log group; step S52, obtaining the labels of all clusters in the log group of each server address, and forming a vector list with the vector array associated with each label; step S53, clustering the vector list to form multiple clusters; step S54, traversing the two-dimensional array, querying the cluster where each vector array is located, and counting the number of labels corresponding to the vector array in each cluster; step S55, calculating the weight of each label in each cluster, and calculating the weight of each label in the log group in a summation manner; step S56, sorting the labels according to the weight values, and taking the label with the largest weight as the label of the log group.
[0075] To facilitate retrieval and query, the clusters are constructed in the second preset format, which is in the form of {label: vector array}. Each cluster is a label, corresponding to an array of size MxN_vec, where N_vec is the dimension of vectorization during Word2Vec, and M represents the number of vectors in the clusters formed by clustering. After vectorization, the log sequence under each server ID is constructed as a two-dimensional array with a dimension of NxN_vec, where N is the number of characters in the element array in the log after window extraction and completion. The two-dimensional array is traversed to query in which cluster each array element vector appears. If it appears in the cluster, the corresponding label is +1, and the size of the label value is counted after the traversal. If the label values are strictly decreasing after sorting, the label with the largest value is used as the label for all logs of the ID. If the values of the first two or more types of labels are consistent, the discriminant algorithm constructed is such as Fig. 9 shown.
[0076] In this embodiment, the step of calculating the weight of each label in each cluster and calculating the weight of each label in the log group in a summation manner includes: obtaining the count of the key composed of each hardware type of each cluster, using label ij Represented as the count of label j in cluster i; using Calculate the weight of each label in each cluster, where p ij is the weight of label j in cluster i, M is the number of vector lists corresponding to label j in cluster i;
[0077] use Calculate the weight of each tag in the log group, where P j is the weight of tag j in the log group.
[0078] Then the tags are sorted according to their weights, and the tag with the largest weight is taken as the tag of the log group.
[0079] After counting the total number N of the largest number of hardware types, if N is equal to 2, that is, there are two largest number of hardware types, then a mixed association model can be constructed in the following manner. Taking memory and CPU-related components as an example, the method is applicable to combinations of fans and other components, such as fans and CPUs, fans and motherboards, etc.
[0080] When obtaining the faults of the same model server, count the frequency and total number of faults of the memory and CPU components, and calculate their frequency and mean respectively. For the same model server, the total number of servers is N num If there is memory failure log information, Err memi If the CPU fault log information is 1, otherwise it is 0. cpui 1, otherwise 0, calculate the number of memory and CPU failures and their mean values respectively. , , , .
[0081] Calculate the variance of memory and CPU failures separately: , , calculate the variance of memory and CPU failures respectively: .
[0082] The above formula obtains the mixed correlation coefficient of the function-related components under the same model server. According to the above formula, the threshold of r is set, and the threshold size is set to 0.75. When r>threshold 0.75, it is marked as a CPU fault, otherwise it is marked as a memory fault label.
[0083] In the above-mentioned server fault diagnosis method, the acquired server fault logs are first aggregated according to the server addresses to form log groups, and then the log groups are vectorized and clustered to form multiple clusters, and then the labels of each cluster are determined, and then the labels of the multiple clusters are clustered to determine the labels of the log groups, the log groups are stored in a first preset format, and the server fault diagnosis model is trained to set labels for the newly collected server fault logs, thereby realizing automatic, efficient and accurate labeling of abnormal information data for server logs, reducing manpower consumption costs, and improving the quality and efficiency of log labeling.
[0084] The present application realizes server log collection, log storage, log preprocessing, intelligent log labeling and fault diagnosis artificial intelligence model training through log collection, log processing, intelligent labeling and model training modules, and diagnoses the newly extracted log information of the server through the trained artificial intelligence model, and outputs the diagnostic results of the logs generated during the operation of the server. The following are the beneficial effects brought by the present invention: 1) Save labeling time. Compared with the previous manual labeling of logs, the present invention can use clustering to realize the aggregation of corresponding clusters and the aggregation of similar logs. Combined with the hardware categories after aggregation, log labeling can be realized, which can save a lot of labeling time.
[0085] 2) Tag categories can be effectively removed from old hardware categories and added to new hardware categories based on the hardware categories in the logs. This can effectively update fault categories to cope with new server models, new hardware devices, etc.
[0086] It should be understood that although Figure 2-Figure 8 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 8At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0087] In one embodiment, Figure 1 , Fig.10 As shown, a fault diagnosis unit 10 is provided, including: a data collection module 1, a log processing module 2, a log automatic labeling module 3, a fault diagnosis module 4, and a fault decision module 5.
[0088] The data collection module 1 is used to obtain server fault logs, aggregate the server fault logs under each address according to the server address, and form a log group corresponding to each server address.
[0089] The log processing module 2 is used to vectorize and cluster the log group, and obtain the label of the log group according to the clustering result. Specifically, the log processing module 2 is used to vectorize the hardware type and log information in the log group to form a vectorized log; cluster the vectorized log into multiple clusters by clustering, and output the hardware type corresponding to each cluster; obtain the number of types of hardware types in each cluster, and determine the label of the corresponding cluster according to the number of types; obtain the labels of all clusters in the log group of each server address, obtain the vector list corresponding to the label of each cluster, cluster the vector list, and use the label corresponding to the cluster with the largest number of vector lists as the label of the log group.
[0090] The log automatic labeling module 3 is used to obtain the server address and label corresponding to each log group, and store the log group in a first preset format.
[0091] The fault diagnosis module 4 is used to train a server fault diagnosis model using a log group in a first preset format; a decision tree model, a Lightgbm model, an Xgboost model or a neural network model is selected as the server fault diagnosis model; the fault decision module 5 is used to input the newly collected server fault log into the trained server fault diagnosis model to obtain a server fault diagnosis result.
[0092] In this embodiment, the steps of obtaining server fault logs, aggregating the server fault logs under each address according to the server address, and forming a log group log corresponding to each server address include: obtaining the corresponding server fault log according to the server address; reading the number of log entries and the log generation time in the server fault log; sorting the server fault logs according to the log generation time; cutting the server fault log into multiple log segments limited to the log number limit range and the time span threshold range according to the number of log entries and the log generation time; reading the log information recorded in each log segment, and merging the log information to form a log group.
[0093] In this embodiment, the step of cutting the server fault log into multiple log segments limited to the log number limit range and the time span threshold range according to the log number and the log generation time includes: setting the numerical value of the log number limit range and the numerical value of the time span threshold range; obtaining the log generation time of all log entries in the server fault log, calculating the log recording time span of the server fault log, judging whether the log recording time span is within the time span threshold range, and judging whether the number of log entries in the server fault log is within the log number limit range; in response to the log recording time span being within the time span threshold range and the number of log entries in the server fault log being within the log number limit range, not cutting the server fault log, and cutting the server fault log. The log is taken as a log segment; in response to the time span of the log recording being within the time span threshold range and the number of log items in the server fault log being not within the log item limit range, the server fault log is cut into multiple log segments according to the log item limit range; in response to the time span of the log recording being not within the time span threshold range and the number of log items in the server fault log being within the log item limit range, the server fault log is cut into multiple log segments according to the time span threshold range; in response to the time span of the log recording being not within the time span threshold range and the number of log items in the server fault log being not within the log item limit range, the server fault log is cut into multiple log segments according to the time span threshold range and the log item limit range.
[0094] In this embodiment, the step of cutting the server fault log into multiple log segments limited by the log number limit range and the time span threshold range according to the log number and the log generation time also includes: obtaining the length value of the server fault log when the log number is the maximum value of the log number limit range, and setting the length value as the standard length of the log segment; determining whether the length of each log segment is the standard length; if so, determining that the length of the log segment is qualified; otherwise, determining that the length of the log segment is unqualified, and padding the log segment with zeros to the standard length.
[0095] In this embodiment, the step of vectorizing the hardware type and log information in the log group to form a vectorized log includes: extracting the hardware type and log information in the target server fault log as a corpus training set for training a language processing vectorization model; constructing a language processing vectorization model to be trained, using the corpus training set to train the language processing vectorization model to be trained, saving all hardware types after deduplication, and forming a trained language processing vectorization model based on constructing a hardware type key-value pair dictionary; obtaining the hardware type and log information in the server log set, and using the trained language processing vectorization model to vectorize the hardware type and log information in the log group to form a vectorized log.
[0096] In this embodiment, the step of extracting the hardware type and log information in the target server fault log as a corpus training set for training a language processing vectorization model includes: obtaining the word order of the hardware type and each word of the log information; obtaining the vector mapping of the hardware type and each word of the log information according to the word order; and summarizing the obtained vectors according to the word order to form a corpus training set.
[0097] In this embodiment, the step of clustering the vectorized log into multiple clusters by clustering includes: obtaining the hardware type of the vectorized log, and dividing the vectorized log into multiple arrays according to the hardware type; performing vectorization processing on the array to form a vectorized array; clustering all vectorized arrays under the same address number into multiple clusters by clustering, and outputting the hardware type and number corresponding to each cluster.
[0098] In this embodiment, the step of outputting the hardware type and number corresponding to each cluster includes: obtaining the vector of the hardware type corresponding to each cluster, and calculating its similarity with the vector under each key of the hardware type key-value pair; for each cluster, initializing the count of the number of occurrences of each key of the hardware type key-value pair to zero, querying the vector under each key of the hardware type key-value pair in the cluster, and in response to the vector being queried, the count of the corresponding key is increased by one; based on the calculated count of the keys in the hardware type key-value pair, obtaining the hardware type and the corresponding count that appear in each cluster.
[0099] In this embodiment, the step of obtaining the number of types of hardware types in each cluster and determining the label of the corresponding cluster according to the number of types includes: extracting the hardware types in each cluster and obtaining the number of the hardware types; if the hardware type is one, marking the faulty hardware type as the label of the corresponding cluster; if the hardware type is multiple, counting the number corresponding to each hardware type; obtaining the two types of hardware types with the largest number, and determining whether the corresponding numbers of the two types of hardware types are the same; if the corresponding numbers of the two types of hardware types are different, using the hardware type with the largest number as the label of the cluster; if the corresponding numbers of the two types of hardware types are the same, obtaining all the hardware types with the largest number, constructing a hybrid association model, and outputting the faulty hardware type as the label of the corresponding cluster according to the hybrid association coefficient.
[0100] In this embodiment, the steps of obtaining all the hardware types with the largest number, constructing a hybrid association model, and outputting the faulty hardware type as a label of the corresponding cluster according to the hybrid association coefficient include: counting the total number N of the hardware types with the largest number, and numbering the server fault logs corresponding to all hardware types as part_n; where part is the name of the faulty hardware, 1≤n≤N; counting the number of times N that each hardware type fails in the server fault log part , count the total number of servers N num; Calculate the average number of failures that occur in servers for each hardware type ; Calculate the failure variance for each hardware type ; Calculate the mixed association model coefficients for each hardware type based on the mean and variance ; Get the hybrid correlation model coefficients corresponding to all hardware types, where the hybrid correlation model coefficient of the server fault log numbered Part_n is ; Sort the obtained hybrid association model coefficients in descending order, and use the hardware type corresponding to the maximum value of the hybrid association model coefficient as the label of the cluster.
[0101] In this embodiment, the steps of obtaining labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group include: constructing each cluster into a second preset format, and constructing a two-dimensional array according to the log sequence in the log group; obtaining labels of all clusters in the log group of each server address, and forming a vector list with the vector array associated with each label; clustering the vector list to form multiple clusters; traversing the two-dimensional array, querying the cluster where each vector array is located, and counting the number of labels corresponding to the vector array in each cluster; calculating the weight of each label in each cluster, and calculating the weight of each label in the log group in a summation manner; sorting the labels according to their weights, and taking the label with the largest weight as the label of the log group.
[0102] In this embodiment, the step of calculating the weight of each label in each cluster and calculating the weight of each label in the log group in a summation manner includes: obtaining the count of the key composed of each hardware type of each cluster, using label ij Represented as the count of label j in cluster i; using Calculate the weight of each label in each cluster, where p ij is the weight of label j in cluster i, M is the number of vector lists corresponding to label j in cluster i; Calculate the weight of each tag in the log group, where P j is the weight of tag j in the log group.
[0103] In the above-mentioned fault diagnosis unit, the acquired server fault logs are first aggregated according to the server addresses to form log groups, and then the log groups are vectorized and clustered to form multiple clusters, and then the labels of each cluster are determined, and then the labels of the multiple clusters are clustered to determine the labels of the log groups, the log groups are stored in a first preset format, and the server fault diagnosis model is trained to set labels for the newly collected server fault logs, thereby realizing automatic, efficient and accurate labeling of abnormal information data for server logs, reducing manpower consumption costs, and improving the quality and efficiency of log labeling.
[0104] For the specific definition of the fault diagnosis unit, please refer to the definition of the server fault diagnosis method above, which will not be repeated here. Each module in the above fault diagnosis unit can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0105] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store server fault diagnosis data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a server fault diagnosis method is implemented.
[0106] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0107] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: obtaining server fault logs, aggregating server fault logs under each address according to server addresses, and forming a log group corresponding to each server address; vectorizing the hardware type and log information in the log group to form a vectorized log; clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; obtaining the number of types of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; obtaining the labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group; obtaining the server address and label corresponding to each log group, and storing the log group in a first preset format; using the log group in the first preset format to train a server fault diagnosis model; wherein a decision tree model, a Lightgbm model, an Xgboost model or a neural network model is selected as the server fault diagnosis model; inputting the newly collected server fault log into the trained server fault diagnosis model to obtain a server fault diagnosis result.
[0108] For specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method for diagnosing server faults above, which will not be repeated here.
[0109] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: obtaining server fault logs, aggregating server fault logs under each address according to the server address, and forming a log group corresponding to each server address; vectorizing the hardware type and log information in the log group to form a vectorized log; clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; obtaining the number of types of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; obtaining each The invention discloses a method for obtaining the labels of all clusters in a log group of a server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group; obtaining the server address and label corresponding to each log group, and storing the log group in a first preset format; using the log group in the first preset format to train a server fault diagnosis model; selecting a decision tree model, a Lightgbm model, an Xgboost model or a neural network model as the server fault diagnosis model; inputting the newly collected server fault log into the trained server fault diagnosis model to obtain a server fault diagnosis result.
[0110] For specific limitations on the steps implemented when the processor executes a computer program, please refer to the limitations on the server fault diagnosis method above, which will not be repeated here.
[0111] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining server fault logs, aggregating server fault logs under each address according to the server address to form a log group corresponding to each server address; vectorizing the hardware type and log information in the log group to form a vectorized log; clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; obtaining the number of types of hardware types in each cluster, and determining the label of the corresponding cluster according to the number of types; obtaining the labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group; obtaining the server address and label corresponding to each log group, and storing the log group in a first preset format; using the log group in the first preset format to train a server fault diagnosis model; wherein a decision tree model, a Lightgbm model, an Xgboost model or a neural network model is selected as the server fault diagnosis model; inputting the newly collected server fault log into the trained server fault diagnosis model to obtain a server fault diagnosis result.
[0112] For specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method for diagnosing server faults above, which will not be repeated here.
[0113] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0114] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0115] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A server fault diagnosis method, characterized in that: include: Get the server fault logs, aggregate the server fault logs under each address according to the server address, and form a log group corresponding to each server address; Performing vectorization processing and clustering processing on the log group, and obtaining a label of the log group according to the clustering result; Obtain the server address and label corresponding to each log group, and store the log group in a first preset format; wherein the first preset format is in the form of {server address: log group data: label}; Using the log group in the first preset format to train a server fault diagnosis model; Input the newly collected server fault log into the trained server fault diagnosis model to obtain the server fault diagnosis result; The step of obtaining the server fault log and aggregating the server fault logs under each address according to the server address to form a log group corresponding to each server address includes: Obtain the corresponding server fault log according to the server address; Read the number of log entries and log generation time in the server fault log; Sorting the server fault logs according to log generation time; Cutting the server fault log into a plurality of log segments limited to a log number limit range and a time span threshold range according to the number of log entries and the log generation time; Read the log information recorded in each log segment and merge the log information to form a log group; The step of cutting the server fault log into a plurality of log segments limited to a log number limit range and a time span threshold range according to the number of log entries and the log generation time also includes: Obtaining the length value of the server fault log when the number of log entries is the maximum value of the log entry limit range, and setting the length value as the standard length of the log segment; Determine whether the length of each log segment is the standard length; If yes, the length of the log segment is determined to be qualified; otherwise, the length of the log segment is determined to be unqualified, and the log segment is padded with zeros to the standard length; The steps of vectorizing and clustering the log group and obtaining a label of the log group according to the clustering result include: Vectorizing the hardware type and log information in the log group to form a vectorized log; Clustering the vectorized log into multiple clusters by clustering, and outputting the hardware type corresponding to each cluster; Obtain the number of hardware types in each cluster, and determine the label of the corresponding cluster according to the number of types; Obtain labels of all clusters in the log group of each server address, obtain a vector list corresponding to the label of each cluster, cluster the vector lists, and use the label corresponding to the cluster with the largest number of vector lists as the label of the log group; The step of clustering the vectorized logs into a plurality of clusters by clustering includes: Obtaining a hardware type of the vectorized log, and dividing the vectorized log into multiple arrays according to the hardware type; Performing vectorization processing on the array to form a vectorized array; All vectorized arrays under the same address number are clustered into multiple clusters, and the hardware type and number corresponding to each cluster are output; The step of obtaining the number of types of hardware in each cluster and determining the label of the corresponding cluster according to the number of types includes: Extracting the hardware type in each cluster and obtaining the number of the hardware type; If the hardware type is one, marking the faulty hardware type as a label of the corresponding cluster; If there are multiple hardware types, count the number corresponding to each hardware type; Get the two types of hardware with the largest number, and determine whether the corresponding numbers of the two types of hardware are the same; If the corresponding numbers of two hardware types are different, the hardware type with the largest number will be used as the label of the cluster; If the corresponding numbers of two types of hardware are the same, then all the hardware types with the largest number are obtained, a hybrid association model is constructed, and the faulty hardware type is output as the label of the corresponding cluster according to the hybrid association coefficient; The steps of obtaining all the hardware types with the largest number, constructing a hybrid association model, and outputting the faulty hardware type as a label of the corresponding cluster according to the hybrid association coefficient include: The total number of hardware types with the largest number of statistics is N, and the server fault log number corresponding to all hardware types is part_n; part is the name of the faulty hardware, 1≤n≤N; Count the number of times each hardware type fails in the server failure log N part , count the total number of servers N num ; Calculate the average number of failures that occur in servers for each hardware type ; Calculate the failure variance for each hardware type ; Calculate the mixed association model coefficients for each hardware type based on the mean and variance ; Get the hybrid correlation model coefficients corresponding to all hardware types, where the hybrid correlation model coefficient of the server fault log numbered Part_n is ; The obtained hybrid association model coefficients are sorted in descending order, and the hardware type corresponding to the maximum value of the hybrid association model coefficient is used as the label of the cluster.
2. The server fault diagnosis method according to claim 1, characterized in that: The step of cutting the server fault log into a plurality of log segments limited to a log number limit range and a time span threshold range according to the number of log entries and the log generation time includes: Set the value of the log number limit range and the value of the time span threshold range; Obtaining the log generation time of all log entries in the server fault log, calculating the log recording time span of the server fault log, determining whether the log recording time span is within the time span threshold range, and determining whether the number of log entries in the server fault log is within the log entry limit range; In response to the time span of the log recording being within the time span threshold and the number of log entries in the server fault log being within the log entry limit, the server fault log is not trimmed and the server fault log is regarded as a log segment; In response to the time span of the log recording being within the time span threshold range and the number of log entries in the server fault log being within the log entry limit range, cutting the server fault log into a plurality of log segments according to the log entry limit range; In response to the logging time span not being within the time span threshold range and the number of log entries in the server fault log being within the log entry limit range, cutting the server fault log into a plurality of log segments according to the time span threshold range; In response to the logging time span not being within the time span threshold range and the number of log entries in the server fault log not being within the log entry limit range, the server fault log is cut into multiple log segments according to the time span threshold range and the log entry limit range.
3. The server fault diagnosis method according to claim 1, characterized in that: The step of vectorizing the hardware type and log information in the log group to form a vectorized log includes: Extract the hardware type and log information from the target server fault log as a corpus training set for language processing vectorization model training; Constructing a language processing vectorized model to be trained, using the corpus training set to train the language processing vectorized model to be trained, saving all hardware types after deduplication, and forming a trained language processing vectorized model according to constructing a hardware type key-value pair dictionary; The hardware type and log information in the log group are obtained, and the hardware type and log information in the log group are vectorized using the trained language processing vectorization model to form a vectorized log.
4. The server fault diagnosis method according to claim 3, characterized in that: The step of extracting the hardware type and log information in the target server fault log as a corpus training set for language processing vectorization model training includes: Obtaining the hardware type and the word order of each word in the log information; Obtaining a vector mapping between the hardware type and each word of the log information according to word order; The obtained vectors are aggregated according to word order to form a corpus training set.
5. The server fault diagnosis method according to claim 1, characterized in that: The step of outputting the hardware type and number corresponding to each cluster includes: Get the vector of the hardware type corresponding to each cluster, and calculate its similarity with the vector under each key of the hardware type key-value pair; For each cluster, initialize the occurrence count of each key of the hardware type key-value pair to zero, query the vector under each key of the hardware type key-value pair in the cluster, and in response to the vector being queried, increase the count of the corresponding key by one; Based on the calculated count of the key in the hardware type key-value pair, get the hardware type and corresponding count that appear in each cluster.
6. The server fault diagnosis method according to claim 1, characterized in that: The steps of obtaining labels of all clusters in the log group of each server address, obtaining a vector list corresponding to the label of each cluster, clustering the vector list, and taking the label corresponding to the cluster with the largest number of vector lists as the label of the log group include: constructing each cluster into a second preset format, and constructing each cluster into a two-dimensional array according to the log sequence in the log group; Get the labels of all clusters in the log group of each server address, and form a vector list with the vector array associated with each label; Clustering the vector list to form a plurality of clusters; Traversing the two-dimensional array, querying the cluster where each vector array is located, and counting the number of labels corresponding to the vector array in each cluster; Calculate the weight of each label in each cluster, and calculate the weight of each label in the log group in a summation manner; Sort the tags according to their weights, and take the tag with the largest weight as the tag of the log group.
7. The server fault diagnosis method according to claim 6, characterized in that: The step of calculating the weight of each label in each cluster and calculating the weight of each label in the log group in a summation manner includes: Get the count of the keys for each hardware type in each cluster, using label ij Represented as the count of label j in cluster i; use Calculate the weight of each label in each cluster, where p ij is the weight of label j in cluster i, M is the number of vector lists corresponding to label j in cluster i; use Calculate the weight of each tag in the log group, where P j is the weight of tag j in the log group.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Server fault positioning method and device, equipment and medium
CN112698977A
Server fault diagnosis method and device, electronic equipment and storage medium
CN114691403A
Fault processing method and device, electronic equipment and computer readable storage medium
CN114706856A
Server fault positioning method and device
CN115580524A
Fault diagnosis method and device based on density clustering
CN116541728A
