Fast coding method and device for cloud log fine-grained unit
By performing fine-grained unit coding and feature-aware coding processing on cloud log data, the problems of low cloud log data compression efficiency and high latency are solved, and efficient cloud log data compression and fast retrieval are achieved.
Patent Information
- Application Number
- CN202410637097.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-08-30
AI Technical Summary
The existing technology has low compression efficiency and high compression delay for cloud log data, which cannot meet the needs of real-time scenarios. Especially when processing PB-level log data, the compression rate and delay bottleneck problems of traditional methods are difficult to solve.
This paper proposes a fast coding method for fine-grained units of cloud logs. It performs secondary pattern analysis on semi-structured cloud log data through log parsing trees, obtains the optimal threshold of the sliding window of integer data, extracts local feature interval data, and uses VLQ encoding and feature-aware fast encoding algorithms are used for encoding processing, and finally the GZIP compression algorithm is used for data compression.
It significantly improves the compression efficiency and compression delay of cloud log data, achieves higher compression rate and lower encoding delay, adapts to the local characteristics of log data, and meets the needs of huge log storage and real-time retrieval.
Smart Images

Figure CN118573209A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a fast encoding method and device for fine-grained units of cloud logs. Background Art
[0002] With the widespread application of digitalization and intelligence in various industries, these industries not only have higher requirements on the compression effect of log data, but also require the compression delay to be as low as possible during the compression process.
[0003] The traditional compression method is to encode the log data using a lightweight encoding method and then compress it using a heavyweight compression algorithm. Since the traditional method does not deeply explore the distribution pattern of log data, the encoding method used to encode log data has poor compression performance. The compression rate of log data by traditional compression methods is generally low, and the compression delay during the compression process is too high. The new dedicated log compression method uses the data pattern in the cloud log data, extracts the pattern of the log data through the log parsing tree, splits the log data into fine-grained unit data, and then encodes and compresses it to achieve a better compression ratio.
[0004] For traditional general compression methods, on the one hand, high compression rate algorithms can achieve high compression rates, but these methods have high compression delay problems during the compression process. Especially for some real-time scenarios, excessive compression delay will seriously affect the normal operation efficiency of the system. On the other hand, high-speed compression algorithms can obviously improve compression efficiency, but at the expense of some compression rates. For the current log system, a maximum of PB-level log data can be generated every day, and the compression effect of these high-speed compression algorithms cannot meet the huge log storage needs.
[0005] Among them, LogReducer uses the data model of log data to achieve high-density compression of log data. However, LogReducer does not take log retrieval into consideration. Due to the use of elastic encoding method, it takes a lot of time to decode layer by layer during retrieval, resulting in a long retrieval time.
[0006] Compressed Log Processing (CLP) uses a set data model when parsing logs. This method requires a lot of manpower to determine the data model during parsing, and this method may result in missing data model types and reduced compression effect.
[0007] LogGrep still has a bottleneck of high compression delay in the compression process. The main reason is that after the secondary pattern is extracted, most of the variables are numeric data. The data pattern of this method is determined by the developer when designing the log format of the log data, and the variable data is decimal and hexadecimal numbers generated by the system, most of which are decimal. LogGrep does not encode the distribution of these numerical data, which leads to a large retrieval delay when searching for integer values. LogReducer and CLP both store integer variable data in fine-grained units by parsing logs, and neither of them encodes the distribution of these values, resulting in a certain bottleneck in the compression rate during the compression process. For LogGrep, the main performance problem is that the fine-grained storage after the secondary pattern extraction of log data is directly compressed using a heavyweight compression algorithm, resulting in too high compression delay.
[0008] In the prior art, there is a lack of an efficient and fast encoding method for cloud log data based on fine-grained units. Summary of the invention
[0009] In order to solve the technical problems of low cloud log data compression efficiency and high compression delay in the prior art, the embodiment of the present invention provides a fast encoding method and device for fine-grained units of cloud logs. The technical solution is as follows:
[0010] On the one hand, a fast encoding method for fine-grained units of cloud logs is provided, the method is implemented by a fast encoding device, and the method includes:
[0011] S1, obtain semi-structured cloud log data;
[0012] S2. Using a log parsing tree, performing secondary pattern parsing on the semi-structured cloud log data to obtain first fine-grained unit data;
[0013] S3, obtaining a multi-system log sample data set; performing experimental analysis on the multi-system log sample data set to obtain an optimal threshold value for the sliding window;
[0014] S4. Based on the cloud log data features and the optimal threshold of the sliding window, feature extraction is performed on the integer data in the first fine-grained unit to obtain local feature interval data;
[0015] S5, recording metadata of the local feature interval data; encoding the metadata using a VLQ encoding algorithm to obtain encoded metadata;
[0016] S6. According to the encoded metadata, a feature-aware fast encoding algorithm is used to locally encode the first fine-grained unit data to obtain second fine-grained unit data;
[0017] S7. Use the GZIP compression algorithm to compress the second fine-grained unit data to obtain cloud log compressed data.
[0018] On the other hand, a fast encoding device for cloud log fine-grained units is provided, and the device is applied to a fast encoding method for cloud log fine-grained units, and the device includes:
[0019] A cloud log data acquisition module is used to acquire semi-structured cloud log data;
[0020] A unit data acquisition module, configured to perform secondary pattern parsing on the semi-structured cloud log data using a log parsing tree to obtain first fine-grained unit data;
[0021] The optimal threshold acquisition module is used to obtain a multi-system log sample data set; perform experimental analysis on the multi-system log sample data set to obtain the optimal threshold of the sliding window;
[0022] A feature interval data extraction module, configured to extract features of the integer data in the first fine-grained unit based on the cloud log data features and the optimal threshold of the sliding window to obtain local feature interval data;
[0023] A metadata encoding module, used for recording metadata of the local feature interval data; encoding the metadata using a VLQ encoding algorithm to obtain encoded metadata;
[0024] A unit data local encoding module, configured to locally encode the first fine-grained unit data using a feature-aware fast encoding algorithm according to the encoded metadata to obtain second fine-grained unit data;
[0025] The data compression module is used to compress the second fine-grained unit data using the GZIP compression algorithm to obtain cloud log compressed data.
[0026] On the other hand, a fast encoding device is provided, which includes: a processor; a memory, wherein computer-readable instructions are stored in the memory, and when the computer-readable instructions are executed by the processor, any one of the above-mentioned fast encoding methods for fine-grained units of cloud logs is implemented.
[0027] On the other hand, a computer-readable storage medium is provided, in which at least one instruction is stored. The at least one instruction is loaded and executed by a processor to implement any one of the above-mentioned fast encoding methods for fine-grained units of cloud logs.
[0028] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0029] The present invention proposes a fast encoding method for fine-grained units of cloud logs, based on two data distribution characteristics of fine-grained unit data, namely local repetition and local increment. According to these two distribution characteristics, a coding and compression method using the local characteristics of the data is proposed. Two local feature interval data corresponding to the distribution characteristics in the data are identified, and Delta coding is used to encode the local repetitive feature interval; RLE coding is used to encode the local incremental feature interval. This data feature-aware local encoding method can better adapt to the local characteristics of log data, greatly improve compression efficiency, and significantly reduce coding compression delay. The present invention is an efficient and fast encoding method for cloud log data based on fine-grained units. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] 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.
[0031] Figure 1 It is a flow chart of a fast encoding method for cloud log fine-grained units provided by an embodiment of the present invention;
[0032] Figure 2 This is a schematic diagram of the effect of a window size on the size of encoded data and metadata provided by an embodiment of the present invention;
[0033] Figure 3 It is a schematic diagram of fine-grained unit analysis of Entry and Svar classes provided by an embodiment of the present invention;
[0034] Figure 4 1 is a schematic diagram comparing the compression performance and latency of LogGrep and LogGrep+ provided by an embodiment of the present invention;
[0035] Figure 5 It is a block diagram of a fast encoding device for cloud log fine-grained units provided by an embodiment of the present invention;
[0036] Figure 6It is a structural schematic diagram of a fast encoding device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] The technical solution of the present invention is described below in conjunction with the accompanying drawings.
[0038] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.
[0039] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same. "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same.
[0040] In the embodiments of the present invention, sometimes a subscript such as W1 may be written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are the same.
[0041] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0042] The embodiment of the present invention provides a fast encoding method for fine-grained units of cloud logs, which can be implemented by a fast encoding device, which can be a terminal or a server. Figure 1 The flowchart of the fast encoding method for fine-grained units of cloud logs is shown. The processing flow of the method may include the following steps:
[0043] S1. Obtain semi-structured cloud log data.
[0044] In a feasible implementation, the present invention proposes a new fast encoding method for semi-structured cloud log data, wherein the semi-structured cloud log data may be cloud log data of various operating systems, including Android, Mac, Linux, Windows, etc.
[0045] S2. Use the log parsing tree to perform secondary pattern parsing on the semi-structured cloud log data to obtain first fine-grained unit data.
[0046] Optionally, a log parsing tree is used to perform secondary pattern parsing on the semi-structured cloud log data to obtain first fine-grained unit data, including:
[0047] S21, randomly sampling the semi-structured cloud log data to obtain cloud log sample data;
[0048] S22, statically parse the cloud log sample data to obtain cloud log variable data;
[0049] S23. According to the cloud log variable data, the preset fine-grained template is trained to obtain a dynamic parsing template;
[0050] S24. Match the cloud log sample data according to the dynamic parsing template to obtain first fine-grained unit data.
[0051] In a feasible implementation manner, the present invention uses the secondary mode of LogGrep to extract the first fine-grained unit data from the log data.
[0052] Secondary pattern analysis is divided into static pattern and dynamic pattern. Static pattern extraction is a common technical method in log analysis. Common log analysis methods can be divided into three categories: frequent pattern-based methods, clustering-based methods, and heuristic structure-based methods. Among them, the heuristic structure-based method has the best analysis effect at present.
[0053] Log parsing tree is widely used in the field of data parsing technology. The separated log entries are classified according to their lengths. For example, the lengths of "Write chunk 3242513_B Offset:339911 Length:11" and "Read chunk3242514_C Offset 339910 Lengths:10" are both 7. Parse them according to their lengths until only a string consisting of numbers and characters can be left. In this invention, it is marked as a variable with a placeholder' ' instead.
[0054] The parsing method based on heuristic structure divides the log data into fine-grained log data by using separators, and constructs a log parsing tree for different fine-grained log data according to their lengths. In this process, log parsing is divided into two processes: training and extraction. The training phase is to sample the original log data and parse the sample data to obtain the corresponding parsing template; the extraction phase uses the parsing template in the training process to parse all log data.
[0055] The fine-grained unit extraction process based on data patterns collects some log samples and uses the parse tree to parse them to obtain the log template and variables. The log is parsed into the first fine-grained unit using the template. The fine-grained units are divided into two categories: Entry class and Svar class.
[0056] Existing methods usually set a repetition threshold to determine whether a variable belongs to a dictionary variable. When the number of repetitions of a variable value exceeds the preset threshold, the variable is identified as a dictionary variable. For example, for the "Write chunk Offset " and "Read chunk Offset "The first variable ( ) can be identified as a dictionary variable, and the fine-grained unit composed of the index value corresponding to the dictionary variable is used as the Entry class. For non-dictionary variables, the existing method directly uses its original value sequence to organize it in the form of Svar class.
[0057] S3. Obtain a multi-system log sample data set; perform experimental analysis on the multi-system log sample data set to obtain an optimal threshold for the sliding window.
[0058] Optionally, experimental analysis is performed on multiple system log sample data sets to obtain the optimal threshold of the sliding window, including:
[0059] S31, extracting data from a multi-system log sample data set to obtain a multi-system metadata data set;
[0060] S32, processing the multi-system metadata data set using a preset parsing method to obtain a multi-system fine-grained unit data set;
[0061] S33, according to the multi-system fine-grained unit data set, using multiple sliding window thresholds, processing by a preset encoding method, to obtain a multi-system encoding result data set;
[0062] S34. Screen multiple sliding window thresholds according to the multi-system metadata data set and the multi-system encoding result data set to obtain an optimal sliding window threshold.
[0063] In a feasible implementation manner, the multi-system log sample data used in the present invention includes 37 log data set samples, specifically 21 production log data set samples and 16 public log data set samples. Multiple windows are used to scan the log data information, and the length of the feature interval is determined by the threshold size of the set sliding window.
[0064] The window threshold size affects the recognition of feature intervals. If the sliding window threshold is too large, some feature intervals may not be accurately recognized, which in turn affects the effect of encoding and compression using feature intervals. On the contrary, if the sliding window threshold is too small, it may introduce too much metadata and take up more storage space.
[0065] By using sliding windows with set threshold sizes to scan the original log data, a multi-system encoding result dataset is obtained. Figure 2 As shown in the figure, as the window size continues to increase, the metadata size continues to decrease. As the window size increases, the feature intervals that meet the window size are fewer, and the metadata information that needs to be stored is reduced. As the window size increases, the encoded data continues to increase. Since more feature intervals cannot be obtained, the effect of local encoding gradually decreases.
[0066] When the sliding window size is in the range of [5, 7], the total amount of metadata and encoded data is minimized. When the window size is set to 7, the size of metadata is minimized and the time required to read metadata is the shortest. Therefore, 7 is selected as the approximate optimal threshold of the sliding window.
[0067] In order to further verify the rationality of the optimal threshold size of the sliding window, the metadata size, the metadata reading time, the metadata size after using a long encoding method (Variable Length Quantity, VLQ), and the metadata reading time after encoding are tested in the present invention. The specific basic information is shown in Table 1 (metadata size and reading time table under different size thresholds). From the data in the table, it can be seen that when the threshold size is 7, the metadata reading time is relatively small, which is conducive to reducing the compression delay in the entire encoding compression process.
[0068] Table 1
[0069]
[0070] After the threshold size of the sliding window is determined, the sliding window of the threshold size is used to scan the integer data to obtain metadata about the feature interval. The size of the metadata will also affect the overall encoding effect.
[0071] S4. Based on the cloud log data features and according to the optimal threshold of the sliding window, feature extraction is performed on the integer data in the first fine-grained unit to obtain local feature interval data.
[0072] In a feasible implementation, the present invention starts scanning the integer data in sequence by setting a sliding window with a threshold size of 7, identifies the local increasing feature intervals and local repeating feature intervals in the integer data, and uses the local feature interval recognition algorithm to traverse the scan log data set to find the metadata information of the local feature interval data, including the type of feature interval (Type, Type=1 indicates a local increasing feature interval, Type=0 indicates a local repeating feature interval), the starting position, and the length of the feature interval. Only when the length of the feature interval meets the established threshold size will the metadata of the feature interval be recorded. The process of the local feature interval recognition algorithm is as follows.
[0073]
[0074] Among them, the cloud log data features are obtained by analyzing the semi-structured cloud log data.
[0075] In a feasible implementation, the Entry class and the Svar class are two different types of fine-grained units generated by parsing semi-structured cloud log data, which reflect the characteristics of cloud log data. The Entry class is composed of the values identified as dictionary variables in the original log sample, reflecting the actual order of appearance of the dictionary variables in the log sample, and retaining the repetition pattern of the dictionary variable values . The Entry class is represented by integers, and the values are small. The Svar class is composed of the original variable values that are not identified as dictionary variables, and stores the original value sequence of the variable in the log sample. The distribution of these variable sequences is relatively random, and there is no significant repetition pattern to be extracted, and the Svar class contains large values.
[0076] The local feature interval data includes local feature incremental interval data and local feature repeated interval data.
[0077] In a feasible implementation, Figure 3 As shown in the figure, based on the multi-system log sample data, the local feature interval data of the multi-system log sample data is analyzed. The proportion of the local incremental feature interval data and the local repeated feature interval data in the overall data is analyzed for the fine-grained units of the Entry class and Svar class of each log.
[0078] In the Svar class, the feature interval lengths of more than 8 types of system log data account for more than 40%, among which the local incremental feature interval lengths of LogS class logs account for 91.94%. The local repeated feature intervals account for a small proportion. In the Entry class, the local repeated feature intervals of 32 types of system log data account for more than 40%.
[0079] S5. Record metadata of the local feature interval data; use a VLQ encoding algorithm to encode the metadata to obtain encoded metadata.
[0080] The encoded metadata includes the characteristic interval type, the starting index and the characteristic interval length of the encoded metadata.
[0081] In a feasible implementation, feature pair intervals in log data are identified by sliding windows, and after local feature intervals are extracted from data in fine-grained storage units, metadata information about the local feature intervals is obtained. The metadata consists of three parts: interval type, start index, and interval length.
[0082] The metadata is stored in the form of triples, and during the encoding and decoding process, each part of the information in the metadata triple is used to perform effective encoding and decoding.
[0083] The size and storage method of metadata affect the encoding efficiency. In order to reduce the size of metadata and improve the access speed to metadata, the VLQ encoding method is used to encode and store metadata information. Through observation, it is found that in the three parts of metadata information, the fluctuation range of the index value is large, while the numerical changes of the interval type and interval length are small. Based on the above conclusions, the present invention adopts the VLQ encoding method for the three parts of data information in the metadata.
[0084] Comparing the metadata size before and after VLQ encoding, the average size of metadata after VLQ encoding in sliding windows of different threshold sizes is reduced by 55.8%. This means that VLQ encoding can significantly reduce the size of metadata. Comparing the metadata reading time before and after VLQ encoding, the average time to read metadata is reduced by 86%. This shows that after VLQ encoding, metadata can not only reduce the size of data, but also speed up the access process to metadata, thereby improving the efficiency of the entire encoding process. When the metadata reading efficiency is improved, it will also speed up the entire local encoding process.
[0085] S6. According to the encoded metadata, a feature-aware fast encoding algorithm is used to locally encode the first fine-grained unit data to obtain second fine-grained unit data.
[0086] In a feasible implementation, in order to better utilize the two types of local feature information in the log data, the present invention combines two different encoding methods according to the type of feature interval, realizes a fast encoding method of data feature perception, and can fully and effectively combine data features for local encoding. As shown in Algorithm 2 Hybrid encoding algorithm, the local feature interval identification algorithm (Algorithm 1) is used to find the local feature intervals existing in the log data set. Local encoding is performed according to the metadata information of the local feature interval. If the scanned data belongs to the local incremental feature interval, Delta encoding is performed on the data within this interval; if the scanned data belongs to the local repeated feature interval, RLE encoding is performed on the data within this interval. Data in non-local feature intervals is not encoded, and encoding these values without obvious features will have a worse effect.
[0087]
[0088] Optionally, according to the encoded metadata, a feature-aware fast encoding algorithm is used to locally encode the first fine-grained unit data to obtain the second fine-grained unit data, including:
[0089] S61, according to the first fine-grained unit data, obtain the integer data length L of the first fine-grained unit; the current data position is i, let i=1;
[0090] S62, determine whether i is greater than L, if i is greater than L, then go to step S68, if i is less than or equal to L, then go to step S63;
[0091] S63, obtaining a first index number of a current data position i according to the first fine-grained unit data; obtaining a second index number of the current position i according to the encoded metadata;
[0092] S64, determine whether the first index number is greater than the second index number, if the first index number is greater than the second index number, then go to step S65, if the first index number is less than or equal to the second index number, then go to step S67;
[0093] S65, obtaining the data type value of the current position i according to the encoded metadata;
[0094] S66, judging whether the data type value is 0; if the data type value is 0, performing RLE encoding on the integer data at the current data position i to obtain local repeated encoded data; if the data type value is not 0, performing Delta encoding on the integer data at the current data position i to obtain local incremental encoded data;
[0095] S67, save the local repeated coding data and the local incremental coding data as fine-grained unit coding data; let i=i+1; execute step S63;
[0096] S68. Determine the fine-grained unit encoded data as second fine-grained unit data; and output the second fine-grained unit data.
[0097] In a feasible implementation, since traditional encoding strategies do not deeply consider the characteristic distribution of integer data, in most cases the overall distribution of integer data is observed to select the corresponding encoding method. However, the distribution characteristics of log data in an actual generation environment are not obvious.
[0098] In order to give full play to the role of local feature intervals in the encoding method, the present invention proposes Hyencode encoding of mixed feature interval encoding. Hyencode encoding can fully utilize the two different local feature intervals in the data for encoding, thereby improving the compression rate of log data.
[0099] Read the log data to be encoded and record the index number of each read data. Compare the index number of the current integer data with the index number in the metadata. When the index number is greater than the index number in the metadata, it means that the value is within the local feature interval and can be encoded.
[0100] Check the value of the interval type in the metadata. If the value is '0', it means that the interval is a local repeated feature interval, and RLE encoding is performed according to the interval length (Lengths); if the Type value is '1', Delta encoding is performed.
[0101] When the index number of the read data does not belong to the index number range in the metadata, it indicates that the data does not need to be encoded and is directly written in. Continue to read the next data until all the data is encoded.
[0102] Compared with the log data before encoding, the compression rate of Hyencode encoding using metadata information of feature intervals to encode log data increased by 44.9%. This means that Hyencode encoding can significantly reduce the size of log data, thereby saving storage space.
[0103] S7. Use the GZIP compression algorithm to compress the second fine-grained unit data to obtain cloud log compressed data.
[0104] In a feasible implementation, the GZIP compression algorithm is a method of representing a byte sequence as a shorter bit sequence. It compresses each block by using a combination of the LZ77 algorithm and Huffman coding. The second fine-grained unit data is compressed to further improve the final compression effect of the cloud log data.
[0105] The GZIP compression algorithm can be replaced by a high-compression data compression algorithm (Lempel-Ziv-Markov chain algorithm, LZMA) or a Z standard compression algorithm (Zstandard, Zstd) according to the application environment.
[0106] In a feasible implementation, in order to verify the reliability of the method proposed in the present invention, the method proposed in the present invention is integrated into the LogGrep compression storage system. The LogGrep compression storage system improves the compression rate and compression time performance of various log data. The method of the present invention integrated into LogGrep is called LogGrep+. Figure 4 The following table shows the log sizes after compression for 9 different log data sets. The basic information of the test log data set is shown in Table 2 (Basic Information of the Test Data Set).
[0107] Table 2
[0108]
[0109] from Figure 4 It can be seen that the compression effect of LogGrep+ on these 9 types of log data is better than that of the LogGrep compression system. The compression effect of the log data in the SSH system is improved to 11%, with the highest compression rate.
[0110] From the analysis of the compression delay performance of log data, the compression delay of LogGrep+ is lower than that of LogGrep. The compression delay of Apache system log data is the lowest. In comparison, the compression delay of LogGrep+ is reduced by 77.2%, while the compression delay of SSH system log data, Linux system log data and Spark system log data are all reduced by about 40%. Among these 9 types of log data, the average compression delay of LogGrep+ is reduced by 40.74%.
[0111] From the test results, it can be seen that the compression delay of LogGrep+ is significantly lower than that of LogGrep. On the other hand, the compression rate of LogGrep+ is also better than that of LogGrep. The compression rate of LogGrep+ based on the method proposed by the present invention is basically consistent with that of LogGrep, and the compression delay of LogGrep+ is significantly lower than that of LogGrep.
[0112] The present invention proposes a fast encoding method for fine-grained units of cloud logs, based on two data distribution characteristics of fine-grained unit data, namely local repetition and local increment. According to these two distribution characteristics, a coding and compression method using the local characteristics of the data is proposed. Two local feature interval data corresponding to the distribution characteristics in the data are identified, and Delta coding is used to encode the local repetitive feature interval; RLE coding is used to encode the local incremental feature interval. This data feature-aware local encoding method can better adapt to the local characteristics of log data, greatly improve compression efficiency, and significantly reduce coding compression delay. The present invention is an efficient and fast encoding method for cloud log data based on fine-grained units.
[0113] Figure 5 The block diagram of a fast encoding device for cloud log fine-grained units according to an exemplary embodiment is shown, and the device is used for a fast encoding method for cloud log fine-grained units. Figure 5 The device includes a cloud log data acquisition module 510, a unit data acquisition module 520, an optimal threshold acquisition module 530, a feature interval data extraction module 540, a metadata encoding module 550, a unit data local encoding module 560 and a data compression module 570. Among them:
[0114] A cloud log data acquisition module 510, used to acquire semi-structured cloud log data;
[0115] The unit data acquisition module 520 is used to perform secondary pattern parsing on the semi-structured cloud log data using the log parsing tree to obtain first fine-grained unit data;
[0116] The optimal threshold acquisition module 530 is used to acquire a multi-system log sample data set; perform experimental analysis on the multi-system log sample data set to obtain the optimal threshold of the sliding window;
[0117] The feature interval data extraction module 540 is used to extract features of the integer data in the first fine-grained unit based on the cloud log data features and according to the optimal threshold of the sliding window to obtain local feature interval data;
[0118] The metadata encoding module 550 is used to record the metadata of the local feature interval data; the metadata is encoded using a VLQ encoding algorithm to obtain the encoded metadata;
[0119] The unit data local encoding module 560 is used to locally encode the first fine-grained unit data according to the encoded metadata by adopting a feature-aware fast encoding algorithm to obtain second fine-grained unit data;
[0120] The data compression module 570 is used to use the GZIP compression algorithm to compress the second fine-grained unit data to obtain cloud log compressed data.
[0121] Optionally, the unit data acquisition module 520 is further used to:
[0122] S21, randomly sampling the semi-structured cloud log data to obtain cloud log sample data;
[0123] S22, statically parse the cloud log sample data to obtain cloud log variable data;
[0124] S23. According to the cloud log variable data, the preset fine-grained template is trained to obtain a dynamic parsing template;
[0125] S24. Match the cloud log sample data according to the dynamic parsing template to obtain first fine-grained unit data.
[0126] Optionally, the optimal threshold acquisition module 530 is further used to:
[0127] S31, extracting data from a multi-system log sample data set to obtain a multi-system metadata data set;
[0128] S32, processing the multi-system metadata data set using a preset parsing method to obtain a multi-system fine-grained unit data set;
[0129] S33, according to the multi-system fine-grained unit data set, using multiple sliding window thresholds, processing by a preset encoding method, to obtain a multi-system encoding result data set;
[0130] S34. Screen multiple sliding window thresholds according to the multi-system metadata data set and the multi-system encoding result data set to obtain an optimal sliding window threshold.
[0131] Among them, the cloud log data features are obtained by analyzing the semi-structured cloud log data.
[0132] The local feature interval data includes local feature incremental interval data and local feature repeated interval data.
[0133] The encoded metadata includes the characteristic interval type, the starting index and the characteristic interval length of the encoded metadata.
[0134] Optionally, the unit data local encoding module 560 is further used to:
[0135] S61, according to the first fine-grained unit data, obtain the integer data length L of the first fine-grained unit; the current data position is i, let i=1;
[0136] S62, determine whether i is greater than L, if i is greater than L, then go to step S68, if i is less than or equal to L, then go to step S63;
[0137] S63, obtaining a first index number of a current data position i according to the first fine-grained unit data; obtaining a second index number of the current position i according to the encoded metadata;
[0138] S64, determine whether the first index number is greater than the second index number, if the first index number is greater than the second index number, then go to step S65, if the first index number is less than or equal to the second index number, then go to step S67;
[0139] S65, obtaining the data type value of the current position i according to the encoded metadata;
[0140] S66, judging whether the data type value is 0; if the data type value is 0, performing RLE encoding on the integer data at the current data position i to obtain local repeated encoded data; if the data type value is not 0, performing Delta encoding on the integer data at the current data position i to obtain local incremental encoded data;
[0141] S67, save the local repeated coding data and the local incremental coding data as fine-grained unit coding data; let i=i+1; execute step S63;
[0142] S68. Determine the fine-grained unit encoded data as second fine-grained unit data; and output the second fine-grained unit data.
[0143] The present invention proposes a fast encoding method for fine-grained units of cloud logs, based on two data distribution characteristics of fine-grained unit data, namely local repetition and local increment. According to these two distribution characteristics, a coding and compression method using the local characteristics of the data is proposed. Two local feature interval data corresponding to the distribution characteristics in the data are identified, and Delta coding is used to encode the local repetitive feature interval; RLE coding is used to encode the local incremental feature interval. This data feature-aware local encoding method can better adapt to the local characteristics of log data, greatly improve compression efficiency, and significantly reduce coding compression delay. The present invention is an efficient and fast encoding method for cloud log data based on fine-grained units.
[0144] Figure 6 is a schematic diagram of the structure of a fast encoding device provided by an embodiment of the present invention, such as Figure 6 As shown, the fast encoding device may include the above Figure 5 The fast encoding device for fine-grained units of cloud logs is shown. Optionally, the fast encoding device 610 may include a first processor 2001 .
[0145] Optionally, the fast encoding device 610 may further include a memory 2002 and a transceiver 2003 .
[0146] The first processor 2001, the memory 2002 and the transceiver 2003 may be connected via a communication bus.
[0147] Combine the following Figure 6 The components of the fast encoding device 610 are specifically introduced as follows:
[0148] The first processor 2001 is the control center of the fast encoding device 610, and can be a processor or a general term for multiple processing elements. For example, the first processor 2001 is one or more central processing units (CPUs), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention, such as one or more microprocessors (digital signal processors, DSPs), or one or more field programmable gate arrays (field programmable gate arrays, FPGAs).
[0149] Optionally, the first processor 2001 can perform various functions of the fast encoding device 610 by running or executing a software program stored in the memory 2002 and calling data stored in the memory 2002.
[0150] In a specific implementation, as an embodiment, the first processor 2001 may include one or more CPUs, such as Figure 6 CPU0 and CPU1 are shown in FIG.
[0151] In a specific implementation, as an embodiment, the fast encoding device 610 may also include multiple processors, such as Figure 6 The first processor 2001 and the second processor 2004 are shown in FIG. Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0152] The memory 2002 is used to store the software program for executing the solution of the present invention, and is controlled to be executed by the first processor 2001. The specific implementation method can refer to the above method embodiment, which will not be repeated here.
[0153] Optionally, the memory 2002 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2002 may be integrated with the first processor 2001, or may exist independently and access the first processor 2001 through the interface circuit ( Figure 6 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.
[0154] The transceiver 2003 is used to communicate with a network device or a terminal device.
[0155] Optionally, the transceiver 2003 may include a receiver and a transmitter ( Figure 6 The receiver is used to implement a receiving function, and the transmitter is used to implement a sending function.
[0156] Optionally, the transceiver 2003 may be integrated with the first processor 2001, or may exist independently and communicate with the first processor 2001 through the interface circuit ( Figure 6 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.
[0157] It should be noted that Figure 6 The structure of the fast encoding device 610 shown in the figure does not constitute a limitation on the router. The actual knowledge structure recognition device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0158] In addition, the technical effects of the fast encoding device 610 can refer to the technical effects of the fast encoding method for fine-grained units of cloud logs described in the above method embodiment, and will not be repeated here.
[0159] It should be understood that the first processor 2001 in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0160] It should also be understood that the memory in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0161] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0162] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.
[0163] In the present invention, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0164] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0165] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0166] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0167] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0168] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0169] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0170] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0171] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A fast encoding method for fine-grained units of cloud logs, characterized in that: The method comprises: S1, obtain semi-structured cloud log data; S2. Using a log parsing tree, performing secondary pattern parsing on the semi-structured cloud log data to obtain first fine-grained unit data; S3, obtaining a multi-system log sample data set; performing experimental analysis on the multi-system log sample data set to obtain an optimal threshold value for the sliding window; S4. Based on the cloud log data features and the optimal threshold of the sliding window, feature extraction is performed on the integer data in the first fine-grained unit to obtain local feature interval data; S5, recording metadata of the local feature interval data; encoding the metadata using a VLQ encoding algorithm to obtain encoded metadata; S6. According to the encoded metadata, a feature-aware fast encoding algorithm is used to locally encode the first fine-grained unit data to obtain second fine-grained unit data; S7. Use the GZIP compression algorithm to compress the second fine-grained unit data to obtain cloud log compressed data.
2. The fast encoding method for cloud log fine-grained units according to claim 1 is characterized in that: The using log parsing tree to perform secondary pattern parsing on the semi-structured cloud log data to obtain first fine-grained unit data includes: S21, randomly sampling the semi-structured cloud log data to obtain cloud log sample data; S22, statically analyzing the cloud log sample data to obtain cloud log variable data; S23. According to the cloud log variable data, a preset fine-grained template is trained to obtain a dynamic parsing template; S24. Match the cloud log sample data according to the dynamic parsing template to obtain first fine-grained unit data.
3. The fast encoding method for cloud log fine-grained units according to claim 1 is characterized in that: The performing experimental analysis on the multi-system log sample data set to obtain the optimal threshold of the sliding window includes: S31, extracting data from the multi-system log sample data set to obtain a multi-system metadata data set; S32, processing the multi-system metadata data set using a preset parsing method to obtain a multi-system fine-grained unit data set; S33, according to the multi-system fine-grained unit data set, using multiple sliding window thresholds, processing by a preset encoding method to obtain a multi-system encoding result data set; S34. Screen the multiple sliding window thresholds according to the multi-system metadata data set and the multi-system encoding result data set to obtain an optimal sliding window threshold.
4. The fast encoding method for cloud log fine-grained units according to claim 1 is characterized in that: The cloud log data features are obtained by analyzing the semi-structured cloud log data.
5. The fast encoding method for cloud log fine-grained units according to claim 1 is characterized in that: The local feature interval data includes local feature incremental interval data and local feature repeated interval data.
6. The fast encoding method for cloud log fine-grained units according to claim 1 is characterized in that: The encoded metadata includes a characteristic interval type, a start index and a characteristic interval length of the encoded metadata.
7. The fast encoding method for cloud log fine-grained units according to claim 1 is characterized in that: The method of locally encoding the first fine-grained unit data according to the encoded metadata using a feature-aware fast encoding algorithm to obtain second fine-grained unit data includes: S61, according to the first fine-grained unit data, obtain the integer data length L of the first fine-grained unit; the current data position is i, let i=1; S62, determine whether i is greater than L, if i is greater than L, then go to step S68, if i is less than or equal to L, then go to step S63; S63, obtaining a first index number of a current data position i according to the first fine-grained unit data; obtaining a second index number of the current position i according to the encoded metadata; S64, determine whether the first index number is greater than the second index number, if the first index number is greater than the second index number, then go to step S65, if the first index number is less than or equal to the second index number, then go to step S67; S65, obtaining a data type value of a current position i according to the encoded metadata; S66, judging whether the data type value is 0; if the data type value is 0, performing RLE encoding on the integer data at the current data position i to obtain local repeated encoded data; if the data type value is not 0, performing Delta encoding on the integer data at the current data position i to obtain local incremental encoded data; S67, save the local repeated coding data and the local incremental coding data as fine-grained unit coding data; let i=i+1; execute step S63; S68. Determine the fine-grained unit encoded data as second fine-grained unit data; and output the second fine-grained unit data.
8. A fast encoding device for cloud log fine-grained units, the fast encoding device for cloud log fine-grained units is used to implement the fast encoding method for cloud log fine-grained units as claimed in any one of claims 1 to 7, characterized in that: The device comprises: A cloud log data acquisition module is used to acquire semi-structured cloud log data; A unit data acquisition module, configured to perform secondary pattern parsing on the semi-structured cloud log data using a log parsing tree to obtain first fine-grained unit data; The optimal threshold acquisition module is used to obtain a multi-system log sample data set; perform experimental analysis on the multi-system log sample data set to obtain an optimal threshold for the sliding window; A feature interval data extraction module, configured to extract features of the integer data in the first fine-grained unit based on the cloud log data features and the optimal threshold of the sliding window to obtain local feature interval data; A metadata encoding module, used for recording metadata of the local feature interval data; encoding the metadata using a VLQ encoding algorithm to obtain encoded metadata; A unit data local encoding module, configured to locally encode the first fine-grained unit data using a feature-aware fast encoding algorithm according to the encoded metadata to obtain second fine-grained unit data; The data compression module is used to compress the second fine-grained unit data using the GZIP compression algorithm to obtain cloud log compressed data.
9. A fast encoding device, characterized in that: The fast encoding device comprises: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 7.
