Log analysis method and system based on natural language processing
Through the log parsing method based on natural language processing, the problem of low efficiency of server log analysis is solved, efficient and accurate log analysis is achieved, and more in-depth support is provided for operation and maintenance work.
Patent Information
- Application Number
- CN202410694677.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-27
AI Technical Summary
In the existing technology, the analysis of server logs relies on manual inspection, which is inefficient and error-prone, and cannot meet the log analysis needs of large-scale and complex systems.
Adopt a log parsing method based on natural language processing, including collecting and preprocessing log data, using natural language processing algorithms to identify hidden relationships, creating in-depth analysis models, and triggering early warning notifications based on the analysis results.
It achieves efficient and accurate analysis of server logs, provides strong support for operation and maintenance work, provides more comprehensive and in-depth analysis results, and improves the efficiency and accuracy of log analysis.
Smart Images

Figure CN118550809A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and specifically to a log parsing method and system based on natural language processing. Background Art
[0002] Server logs are files that record important data such as server operating status, user access, error messages, etc. Analyzing server logs can help administrators understand the server's operating status, identify problems in a timely manner, and handle them.
[0003] Since servers are the core component of network systems, the number of their logs has also exploded. In order to ensure the stable operation of the system, log files need to be processed and analyzed to determine the status of the device, faults, and network security. In some related technologies, log analysis usually relies on manual inspection, which is inefficient and prone to errors, and cannot meet the log analysis needs of large-scale and complex systems. Summary of the Invention
[0004] In order to solve at least one of the problems mentioned in the above background technology, the present application provides a log parsing method and system based on natural language processing, which can efficiently and accurately analyze server logs, provide strong support for server operation and maintenance work, and provide administrators with more comprehensive and in-depth analysis results.
[0005] The specific technical solutions provided in the embodiments of this application are as follows:
[0006] In a first aspect, a log parsing method based on natural language processing is provided, which is applied to log data of a server, and the method comprises:
[0007] Collecting log data from the server and preprocessing the log data;
[0008] Use natural language processing to parse the pre-processed log data to obtain parsed data;
[0009] Creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results;
[0010] In response to an abnormality in the in-depth analysis result, an early warning notification is triggered.
[0011] In a specific embodiment, the preprocessing of the log data specifically includes:
[0012] The method includes removing redundant data in the log data, wherein the redundant data includes duplicate data, invalid data, and temporary data; filtering data not related to the business of the log data, and processing abnormal data in the log data; setting the timestamp of the log data to a standard format and unifying the log level of the log data; setting the fields in the log data to standard fields and using regular expressions to parse the log data to extract key information; obtaining fixed-format log entries in the log data and using a template recognition algorithm to preliminarily analyze the fixed-format log entries; converting text data in the log data into numerical data and setting the character encoding of all the text data to a preset character encoding; summarizing the key information and generating statistical information.
[0013] In a specific embodiment, the method further comprises:
[0014] A log fixed structure in the log data is identified; and an algorithm in the natural language processing is used to extract the log data according to the log fixed structure to obtain a universal log template.
[0015] In a specific embodiment, natural language processing is used to parse the pre-processed log data, specifically including:
[0016] Obtain log text in the processed log data, divide the log text into vocabulary units; identify the variable part in the universal log template; obtain new log data, match the new log data to the universal log template, and fill the variable part in the universal log template of the new log data to obtain filled log data; convert the filled log data into structured data.
[0017] In a specific embodiment, the method further comprises:
[0018] Identify key entities in the log data and extract the association relationships between the key entities; use the natural language processing to extract event information from the log data and analyze the causal relationship between the event information; combine the association relationships between the key entities and the causal relationship between the event information to obtain analysis results.
[0019] In a specific embodiment, the method further comprises:
[0020] Select a sequential pattern mining algorithm, obtain key parameters, and build a deep analysis model by combining the key parameters and the sequential pattern mining algorithm; obtain preprocessed log data, and use the preprocessed log data to train the deep analysis model to obtain a trained deep analysis model.
[0021] In a specific embodiment, the method further comprises:
[0022] After the log data in the server is collected, the log data is stored and backed up in a database; and index information of the log data is established to enable querying corresponding log data according to the index information.
[0023] In a second aspect, a log parsing system based on natural language processing is provided, the system comprising:
[0024] A data collection and processing module, used to collect log data of the server and pre-process the log data;
[0025] The log parsing module is used to parse the pre-processed log data using natural language processing to obtain parsed data;
[0026] A deep analysis module, configured to create a deep analysis model, use the deep analysis model to identify hidden associations in the parsed data, and generate deep analysis results;
[0027] The early warning module is used to trigger an early warning notification in response to an abnormality in the deep analysis result.
[0028] According to a third aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0029] Step A: collecting log data from the server and preprocessing the log data;
[0030] Step B: using natural language processing to parse the pre-processed log data to obtain parsed data;
[0031] Step C: creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results;
[0032] Step D: In response to an abnormality in the in-depth analysis result, triggering an early warning notification.
[0033] In a fourth aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are performed:
[0034] Step A: collecting log data from the server and preprocessing the log data;
[0035] Step B: using natural language processing to parse the pre-processed log data to obtain parsed data;
[0036] Step C: creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results;
[0037] Step D: In response to an abnormality in the in-depth analysis result, triggering an early warning notification.
[0038] In a fifth aspect, 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:
[0039] Step A: collecting log data from the server and preprocessing the log data;
[0040] Step B: using natural language processing to parse the pre-processed log data to obtain parsed data;
[0041] Step C: creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results;
[0042] Step D: In response to an abnormality in the in-depth analysis result, triggering an early warning notification.
[0043] The embodiments of the present application have the following beneficial effects:
[0044] 1. The solution provided in the embodiment of the present application collects log data generated during server operation, first pre-processes the log data, uses natural language processing to parse the processed log data, and then uses a deep analysis model to further analyze the hidden correlation relationships in the parsed data. Based on the deep analysis results, it is decided whether to trigger an early warning notification. Through the above solution, the server log can be analyzed efficiently and accurately, providing strong support for the operation and maintenance of the server, while providing administrators with more comprehensive and in-depth analysis results.
[0045] 2. Through the visualization program, the obtained in-depth analysis results are displayed to present the in-depth analysis results to the user in an intuitive manner, making it easier for the user to understand and deal with problems that arise in the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0047] Figure 1 A schematic diagram showing a log parsing method based on natural language processing according to the present application;
[0048] Figure 2 A schematic diagram showing the process of creating and using a depth analysis model according to the present application is shown;
[0049] Figure 3 A schematic diagram of a log parsing system based on natural language processing according to the present application is shown;
[0050] Figure 4 A schematic diagram showing a computer device according to the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0052] This application provides a log parsing method based on natural language processing, such as Figure 1 As shown, the process for processing server log data includes the following steps:
[0053] Step 1: Collecting log data of the server and preprocessing the log data;
[0054] The monitoring system monitors and collects log data in real time to ensure that all log data during server operation can be collected, and then pre-processes the log data, including:
[0055] The method includes removing redundant data in the log data, wherein the redundant data includes duplicate data, invalid data, and temporary data; filtering data not related to the business of the log data, and processing abnormal data in the log data; setting the timestamp of the log data to a standard format and unifying the log level of the log data; setting the fields in the log data to standard fields and using regular expressions to parse the log data to extract key information; obtaining fixed-format log entries in the log data and using a template recognition algorithm to preliminarily analyze the fixed-format log entries; converting text data in the log data into numerical data and setting the character encoding of all the text data to a preset character encoding; summarizing the key information and generating statistical information.
[0056] The redundant data in the log data is removed, including deleting duplicate data, invalid data, and temporary log entries. Data not related to the business of the log data is filtered, and abnormal data in the log data is processed. In this embodiment, log entries unrelated to the business to be analyzed, such as debugging information or content communication of the server system, are excluded before filtering. Then, log entries with format errors, inconsistent encoding, or containing sensitive information are repaired or deleted.
[0057] It should be noted that the timestamp of the log data is set to a standard format, that is, timestamps in different formats are converted to a unified format to facilitate subsequent time series analysis; the log levels of different applications or systems are mapped to a unified level system, including DEBUG, INFO, WARN, and ERROR logs.
[0058] The fields in the log data are set as standard fields to ensure the accuracy of subsequent analysis of the log data; the log data is parsed using regular expressions to extract key information, wherein the key information includes user ID, operation type, and error code.
[0059] It should be noted that for fixed-format log entries in the log data, a template recognition algorithm is used to preliminarily analyze the content of the fixed-format log entries to reduce the pressure of subsequent log parsing. The text data in the log data is converted into numerical data to facilitate subsequent model analysis and model training. The character encoding of all the text data is set to a preset character encoding to ensure that all text data uses a unified character encoding to avoid errors caused by inconsistent encoding, where the character encoding can be UTF-8.
[0060] In this embodiment, the parsed log data is aggregated and summarized according to the business type to be analyzed to generate higher-level statistical information or summary data. After collecting the log data in the server, the log data is stored and backed up in the database; index information of the log data is established to enable querying the corresponding log data based on the index information, wherein the database can also be a data warehouse or a distributed file system, and the query efficiency is improved by establishing index information.
[0061] Step 2: Use natural language processing to parse the processed log data to obtain parsed data.
[0062] Before using natural language processing to parse the processed log data, it also includes building a general log module, specifically including identifying the log fixed structure in the log data; using the algorithm in the natural language processing to extract the log data according to the log fixed structure to obtain a general log template.
[0063] It should be noted that when building a universal log template, it is necessary to analyze a large amount of log data to identify fixed structures or patterns in the logs, such as date, time, user ID, operation type, etc., and then use sequence alignment or clustering algorithms in natural language processing (NLP) to extract the universal log template from the log data.
[0064] In a specific embodiment, natural language processing is used in this embodiment to parse the processed log data, specifically including: obtaining log text in the preprocessed log data, dividing the log text into vocabulary units; identifying the variable part in the log template; obtaining new log data, matching the new log data to the log template, and filling the variable part in the log template of the new log data to obtain filled log data; converting the filled log data into structured data.
[0065] The log text in the preprocessed log data is segmented into independent lexical units, with English logs separated by spaces. Part-of-speech tagging is performed on each lexical unit, including nouns, verbs, and homophones, to facilitate subsequent log parsing. Based on the universal log template, the variable portion of the universal log template, such as dynamic data and other parameters, is identified. For new log data, the corresponding content is matched according to the universal log template and the corresponding variable values are filled in. This filled-in log data is converted into structured data to facilitate subsequent analysis and querying.
[0066] In a specific embodiment, it also includes identifying key entities in the log data and extracting the association relationships between the key entities; using the natural language processing to extract event information from the log data and analyze the causal relationship between the event information; combining the association relationships between the key entities and the causal relationship between the event information to obtain analysis results.
[0067] It should be noted that the key entities in the new log data, such as user ID, IP address, file path, and error code, are identified, and then the natural language processing technology is used to analyze the relationship between the entities to obtain the association relationship between the entities, and then obtain the event information. At the same time, the causal relationship between the time information is analyzed, and then the analysis results are obtained, such as a user performed a certain operation, and a certain operation caused a certain error.
[0068] In this embodiment, natural language processing is also used to identify the user's operation intention or the server system's behavior intention based on the content of the log data, and event information is extracted from the log data, and the causal relationship between the event information is analyzed to obtain the user's operation intention or the server system's behavior intention, where the event information includes login events, request events, and error events.
[0069] Step 3: Create a deep analysis model, use the deep analysis model to identify hidden associations in the parsed data, and generate deep analysis results.
[0070] like Figure 2As shown, in this embodiment, a sequence pattern mining algorithm is selected, key parameters are set, and a deep analysis model is created based on the set key parameters, where the key parameters include support, confidence, lift, large sequence, and maximum sequence.
[0071] Specifically, a sequential pattern mining algorithm is selected to obtain key parameters, and a deep analysis model is constructed by combining the key parameters and the sequential pattern mining algorithm; preprocessed log data is obtained, and the deep analysis model is trained using the preprocessed log data to obtain a trained deep analysis model.
[0072] The support is used to measure the probability of a specific event sequence or behavior pattern appearing in the log data. The higher the support value, the higher the frequency of the specific event sequence or behavior pattern appearing in the log data, that is, the specific event sequence or behavior pattern is associated with a user behavior pattern or a system event pattern.
[0073] The calculation formula (1) of support is as follows:
[0074]
[0075] Where S represents the support of a specific event sequence; count(S\text{in logs}) represents the number of occurrences of the specific event sequence S in the log data; and |logs| represents the total number of events in the log data.
[0076] Specifically, confidence is used to measure the probability of a specific event sequence occurring under given preconditions. Item sets X and Y are used to represent a series of user behaviors, system events, or log entries. By calculating the confidence, we can obtain the probability of observing item set Y when item set X is observed, thereby discovering the association relationship in the log data, which is then helpful for determining the causal relationship between various event sequences. Its calculation formula (2) is as follows:
[0077]
[0078] Among them, Confidence(X→Y) represents the confidence that Y occurs when the precondition X exists; Support(X, Y) represents the support of the simultaneous occurrence of item sets X and item sets Y, that is, the probability that item sets X and item sets Y appear at the same time; Support(x) represents the support of item set X.
[0079] Specifically, lift is used to measure whether a specific event sequence occurs more frequently than in a random situation. If the lift exceeds the random frequency, it means that a non-random and meaningful pattern has appeared. That is, lift can be used to identify non-random event sequences, which is conducive to discovering related event information. Its calculation formula (3) is as follows:
[0080]
[0081] Among them, Lift(X→Y) represents the association rule between item sets X and item sets Y; Confidence(X→Y) represents the confidence that Y appears under the precondition X; Support(Y) represents the support of item set Y.
[0082] It should be noted that large sequences refer to event sequences with support above a preset threshold and contain key information about users or server systems. A maximum sequence is a large sequence that is not contained in any other large sequence. In other words, a maximum sequence is the longest sequence in a large sequence.
[0083] By configuring the above key parameters, the creation of the deep analysis model is completed. After the deep analysis model is created, it also includes: dividing the preprocessed log data into a training set, a validation set and a test set, using the data in the training set to train the deep analysis model to obtain an initial model, and then using the data in the validation set to adjust the key parameters in the deep analysis model so that the key parameter values in the deep analysis model are the optimal parameter combination; using the data in the validation set to evaluate the deep analysis model to obtain an evaluation result, so as to judge the performance of the deep analysis model through the evaluation result and improve the accuracy of the model calculation.
[0084] Step 4: In response to obtaining the in-depth analysis result, trigger an early warning notification.
[0085] The method in this embodiment also includes: obtaining an event sequence in the analysis data identified by the deep analysis model, the support of which is higher than a first preset threshold, obtaining the support of the event sequence at a first moment to obtain a first support, obtaining the support of the event sequence at a second moment with a preset time interval to obtain a second support, if the second support is higher than the first support, the deep analysis result is abnormal, and in response to the abnormality in the deep analysis result, the association relationship corresponding to the event sequence is obtained, and an early warning is issued.
[0086] Furthermore, when an abnormality is found in the deep analysis result, and the correlation relationship corresponding to the event sequence is obtained, the server system is triggered to obtain other event sequences that have a correlation relationship with the event sequence, and to issue an early warning for the other event sequences.
[0087] In one specific embodiment, the system further includes obtaining historical logs and analyzing them through natural language processing to predict the future state or trend of the server system. Specifically, when the server monitoring system detects that the value of an assessment item in the deep analysis model exceeds a second preset threshold, it determines that a specific event sequence will occur in the server system in the future, allowing management personnel to prepare countermeasures in advance.
[0088] This embodiment also includes a visualization program that displays the in-depth analysis results obtained, presenting them to users in an intuitive manner, making it easier for them to understand and address system issues. This presentation includes charts, instrumentation, and other methods. This embodiment enables efficient and accurate analysis of server logs, providing strong support for server operation and maintenance, while also providing administrators with more comprehensive and in-depth analysis results.
[0089] It should be understood that although Figure 1 and Figure 2 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. In addition, Figure 1 and Figure 2 At 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.
[0090] In one embodiment, Figure 3 As shown, a log parsing system based on natural language processing is provided, the system comprising:
[0091] A data collection and processing module, used to collect log data of the server and pre-process the log data;
[0092] The log parsing module is used to parse the pre-processed log data using natural language processing to obtain parsed data;
[0093] A deep analysis module, configured to create a deep analysis model, use the deep analysis model to identify hidden associations in the parsed data, and generate deep analysis results;
[0094] The early warning module is used to trigger an early warning notification in response to an abnormality in the deep analysis result.
[0095] In a specific embodiment, the data acquisition and processing module is specifically used to remove redundant data in the log data, wherein the redundant data includes duplicate data, invalid data and temporary data; filter data that is not related to the business of the log data, and process abnormal data in the log data; set the timestamp of the log data to a standard format and unify the log level of the log data; set the fields in the log data to standard fields and use regular expressions to parse the log data to extract key information; obtain fixed-format log entries in the log data and use a template recognition algorithm to preliminarily analyze the fixed-format log entries; convert the text data in the log data into numerical data and set the character encoding of all the text data to a preset character encoding; summarize the key information and generate statistical information.
[0096] In a specific embodiment, the log parsing module is further configured to identify a fixed log structure in the log data; and extract the log data according to the fixed log structure using an algorithm in the natural language processing to obtain a general log template.
[0097] In a specific embodiment, the log parsing module is also used to obtain log text in the preprocessed log data, divide the log text into vocabulary units; identify the variable part in the universal log template; obtain new log data, match the new log data to the universal log template, and fill the variable part in the universal log template of the new log data to obtain filled log data; convert the filled log data into structured data.
[0098] In a specific embodiment, the log parsing module is also used to identify key entities in the log data and extract the association relationships between the key entities; use the natural language processing to extract event information from the log data and analyze the causal relationship between the event information; combine the association relationships between the key entities and the causal relationship between the event information to obtain analysis results.
[0099] In a specific embodiment, the deep analysis module is also used to select a sequential pattern mining algorithm, obtain key parameters, and construct a deep analysis model by combining the key parameters and the sequential pattern mining algorithm; obtain preprocessed log data, and use the preprocessed log data to train the deep analysis model to obtain a trained deep analysis model.
[0100] In a specific embodiment, a storage module is further included for collecting the log data in the server, storing and backing up the log data in a database; and establishing index information of the log data to enable querying corresponding log data according to the index information.
[0101] For the specific definition of the log parsing system based on natural language processing, please refer to the definition of the log parsing method based on natural language processing above, which will not be repeated here. The various modules in the above-mentioned log parsing system based on natural language processing can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned 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 of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0102] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0103] Step 101: Collecting log data from the server and preprocessing the log data;
[0104] Step 102: parsing the pre-processed log data using natural language processing to obtain parsed data;
[0105] Step 103: creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results;
[0106] Step 104: In response to an abnormality in the in-depth analysis result, trigger an early warning notification.
[0107] In a specific embodiment, when the computer program is executed by a processor, the following steps are implemented:
[0108] The method includes removing redundant data in the log data, wherein the redundant data includes duplicate data, invalid data, and temporary data; filtering data not related to the business of the log data, and processing abnormal data in the log data; setting the timestamp of the log data to a standard format and unifying the log level of the log data; setting the fields in the log data to standard fields and using regular expressions to parse the log data to extract key information; obtaining fixed-format log entries in the log data and using a template recognition algorithm to preliminarily analyze the fixed-format log entries; converting text data in the log data into numerical data and setting the character encoding of all the text data to a preset character encoding; summarizing the key information and generating statistical information.
[0109] In a specific embodiment, when the computer program is executed by a processor, the following steps are implemented:
[0110] A log fixed structure in the log data is identified; and an algorithm in the natural language processing is used to extract the log data according to the log fixed structure to obtain a universal log template.
[0111] In a specific embodiment, when the computer program is executed by a processor, the following steps are implemented:
[0112] Obtain log text in the processed log data, divide the log text into vocabulary units; identify the variable part in the universal log template; obtain new log data, match the new log data to the universal log template, and fill the variable part in the universal log template of the new log data to obtain filled log data; convert the filled log data into structured data.
[0113] In a specific embodiment, when the computer program is executed by a processor, the following steps are implemented:
[0114] Identify key entities in the log data and extract the association relationships between the key entities; use the natural language processing to extract event information from the log data and analyze the causal relationship between the event information; combine the association relationships between the key entities and the causal relationship between the event information to obtain analysis results.
[0115] In a specific embodiment, when the computer program is executed by a processor, the following steps are implemented:
[0116] Select a sequential pattern mining algorithm, obtain key parameters, and build a deep analysis model by combining the key parameters and the sequential pattern mining algorithm; obtain preprocessed log data, and use the preprocessed log data to train the deep analysis model to obtain a trained deep analysis model.
[0117] In a specific embodiment, when the computer program is executed by a processor, the following steps are implemented:
[0118] After the log data in the server is collected, the log data is stored and backed up in a database; and index information of the log data is established to enable querying corresponding log data according to the index information.
[0119] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a 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 computer program in the non-volatile storage medium. The database of the computer device is used to store log data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a log parsing method based on natural language processing is implemented.
[0120] Those skilled in the art will understand that Figure 4 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 shown in the figure, or combine certain components, or have a different component arrangement.
[0121] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are performed:
[0122] Step 201: Collecting log data of the server and preprocessing the log data;
[0123] Step 202: parsing the pre-processed log data using natural language processing to obtain parsed data;
[0124] Step 203: creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results;
[0125] Step 204: In response to an abnormality in the in-depth analysis result, trigger an early warning notification.
[0126] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0127] The method includes removing redundant data in the log data, wherein the redundant data includes duplicate data, invalid data, and temporary data; filtering data not related to the business of the log data, and processing abnormal data in the log data; setting the timestamp of the log data to a standard format and unifying the log level of the log data; setting the fields in the log data to standard fields and using regular expressions to parse the log data to extract key information; obtaining fixed-format log entries in the log data and using a template recognition algorithm to preliminarily analyze the fixed-format log entries; converting text data in the log data into numerical data and setting the character encoding of all the text data to a preset character encoding; summarizing the key information and generating statistical information.
[0128] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0129] A log fixed structure in the log data is identified; and an algorithm in the natural language processing is used to extract the log data according to the log fixed structure to obtain a universal log template.
[0130] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0131] Obtain log text in preprocessed log data, divide the log text into vocabulary units; identify the variable part in the universal log template; obtain new log data, match the new log data to the universal log template, and fill the variable part in the universal log template of the new log data to obtain filled log data; convert the filled log data into structured data.
[0132] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0133] Identify key entities in the log data and extract the association relationships between the key entities; use the natural language processing to extract event information from the log data and analyze the causal relationship between the event information; combine the association relationships between the key entities and the causal relationship between the event information to obtain analysis results.
[0134] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0135] Select a sequential pattern mining algorithm, obtain key parameters, and build a deep analysis model by combining the key parameters and the sequential pattern mining algorithm; obtain preprocessed log data, and use the preprocessed log data to train the deep analysis model to obtain a trained deep analysis model.
[0136] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0137] After the log data in the server is collected, the log data is stored and backed up in a database; and index information of the log data is established to enable querying corresponding log data according to the index information.
[0138] 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:
[0139] Step 301: Collecting log data of the server and preprocessing the log data;
[0140] Step 302: parsing the pre-processed log data using natural language processing to obtain parsed data;
[0141] Step 303: creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results;
[0142] Step 304: In response to an abnormality in the in-depth analysis result, trigger an early warning notification.
[0143] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0144] The method includes removing redundant data in the log data, wherein the redundant data includes duplicate data, invalid data, and temporary data; filtering data not related to the business of the log data, and processing abnormal data in the log data; setting the timestamp of the log data to a standard format and unifying the log level of the log data; setting the fields in the log data to standard fields and using regular expressions to parse the log data to extract key information; obtaining fixed-format log entries in the log data and using a template recognition algorithm to preliminarily analyze the fixed-format log entries; converting text data in the log data into numerical data and setting the character encoding of all the text data to a preset character encoding; summarizing the key information and generating statistical information.
[0145] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0146] A log fixed structure in the log data is identified; and an algorithm in the natural language processing is used to extract the log data according to the log fixed structure to obtain a universal log template.
[0147] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0148] Obtain log text in preprocessed log data, divide the log text into vocabulary units; identify the variable part in the universal log template; obtain new log data, match the new log data to the universal log template, and fill the variable part in the universal log template of the new log data to obtain filled log data; convert the filled log data into structured data.
[0149] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0150] Identify key entities in the log data and extract the association relationships between the key entities; use the natural language processing to extract event information from the log data and analyze the causal relationship between the event information; combine the association relationships between the key entities and the causal relationship between the event information to obtain analysis results.
[0151] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0152] Select a sequential pattern mining algorithm, obtain key parameters, and build a deep analysis model by combining the key parameters and the sequential pattern mining algorithm; obtain preprocessed log data, and use the preprocessed log data to train the deep analysis model to obtain a trained deep analysis model.
[0153] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0154] After the log data in the server is collected, the log data is stored and backed up in a database; and index information of the log data is established to enable querying corresponding log data according to the index information.
[0155] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0156] The technical features of the above embodiments can 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.
[0157] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A log parsing method based on natural language processing, characterized in that: Applied to processing log data of a server, the method comprises: Collecting log data of the server and preprocessing the log data; The pre-processed log data is parsed using natural language processing to obtain parsed data; Creating a deep analysis model, using the deep analysis model to identify hidden associations in the parsed data, and generating deep analysis results; In response to an abnormality in the deep analysis result, an early warning notification is triggered.
2. The log parsing method based on natural language processing according to claim 1 is characterized in that: The preprocessing of the log data specifically includes: Removing redundant data from the log data, wherein the redundant data includes duplicate data, invalid data, and temporary data; Filtering data not related to the business of the log data, and processing abnormal data in the log data; Setting the timestamp of the log data to a standard format and unifying the log level of the log data; Setting fields in the log data as standard fields, and parsing the log data using regular expressions to extract key information; Obtaining fixed-format log entries in the log data, and preliminarily analyzing the fixed-format log entries using a template recognition algorithm; Converting the text data in the log data into numerical data, and setting the character encoding of all the text data to a preset character encoding; The key information is aggregated to generate statistical information.
3. The log parsing method based on natural language processing according to claim 1 or 2, characterized in that: The method further comprises: identifying a log fixed structure in the log data; The algorithm in the natural language processing is adopted to extract the log data according to the log fixed structure to obtain a general log template.
4. The log parsing method based on natural language processing according to claim 3 is characterized in that: Natural language processing is used to parse the preprocessed log data, including: Obtaining log text in the preprocessed log data, and dividing the log text into vocabulary units; Identifying a variable portion in the general log template; Acquire new log data, match the new log data to the universal log template, and fill in the variable part of the universal log template of the new log data to obtain the filled log data; The filled log data is converted into structured data.
5. The log parsing method based on natural language processing according to claim 3 is characterized in that: The method further comprises: Identify key entities in the log data, and extract association relationships between the key entities; extracting event information from the log data using the natural language processing, and analyzing the cause-effect relationship between the event information; The analysis result is obtained by combining the association relationship between the key entities and the causal relationship between the event information.
6. The log parsing method based on natural language processing according to claim 1 or 2, characterized in that: The method further comprises: Select a sequential pattern mining algorithm, obtain key parameters, and build a deep analysis model by combining the key parameters and the sequential pattern mining algorithm; The preprocessed log data is obtained, and the deep analysis model is trained using the preprocessed log data to obtain a trained deep analysis model.
7. The log parsing method based on natural language processing according to claim 1 or 2, characterized in that: The method further comprises: After collecting the log data in the server, storing and backing up the log data in a database; Index information of the log data is established to enable querying corresponding log data according to the index information.
8. A log parsing system based on natural language processing, based on the method according to any one of claims 1 to 7, characterized in that: The system comprises: A data collection and processing module, used to collect the log data of the server and pre-process the log data; The log parsing module is used to parse the pre-processed log data using natural language processing to obtain parsed data; A deep analysis module, used to create a deep analysis model, use the deep analysis model to identify hidden associations in the parsed data, and generate deep analysis results; The early warning module is used to trigger an early warning notification in response to an abnormality in the deep analysis result.
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
Cited By
Log analysis and identification method and system
CN120179520A
