Method, electronic device and computer program product for generating logs
Through the combination of the generator and the discriminator, the generator generates pseudo logs based on the generation conditions and random noise, and the discriminator determines their authenticity, solving the problem of insufficient or excessive log data sets, and improving the accuracy and accuracy of the log generation model. Authenticity, enabling the ability to quickly expand log data sets.
Patent Information
- Application Number
- CN202310200545.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2024-08-30
AI Technical Summary
When the number of log data sets is insufficient or excessive, it is difficult for existing technologies to effectively generate real log data, leading to deviations and low efficiency in log applications.
Use a combination of generator and discriminator to generate pseudo logs based on generation conditions and random noise, and determine the event categories and feature matrices of real logs and pseudo logs through the discriminator, and then train the generator and discriminator to improve the performance of the log generation model. accuracy.
It improves the accuracy of generating log training models that look like real ones, can quickly expand log data sets under specified conditions, and generate log data with good authenticity.
Smart Images

Figure CN118567936A
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and more particularly to a method for generating a log, an electronic device, and a computer program product. Background Art
[0002] Logs can be used to record the status and events of devices and systems. In academic research and industrial applications, large amounts of log data collected from devices can be analyzed to identify user behavior patterns or discover system failures. Therefore, log anomaly detection is an important source of information for device or system management, checking operation status, and troubleshooting.
[0003] However, in some cases, the small number of log data sets may lead to deviations in applications involving logs, such as the omission of very few abnormal logs in the log data set. Or, when a large number of logs are required, there are not enough real logs to support the usage requirements. Summary of the invention
[0004] According to an exemplary embodiment of the present disclosure, a technical solution for generating logs is provided, which is used to quickly expand the number of logs under specified conditions.
[0005] In a first aspect of the present disclosure, a method for generating logs is provided, which may include: a generator generates a pseudo log based on a generation condition and random noise, a discriminator determines the event category of the log message in the true log and the pseudo log, the discriminator determines the feature matrix of the log sequence in the true log and the pseudo log based on the event category, the discriminator determines the authenticity of the true log and the pseudo log based on the feature matrix, and trains the generator and the discriminator based on the authenticity. Implementing the method provided in the first aspect can improve the accuracy of the training model for generating logs that are indistinguishable from the real thing.
[0006] In a second aspect of the present disclosure, an electronic device for generating logs is provided. The electronic device includes: a processor, and a memory coupled to the processor, the memory having instructions stored therein, and the instructions, when executed by the electronic device, cause the electronic device to perform operations, including: a generator generates a pseudo log based on generation conditions and random noise, a discriminator determines the event category of log messages in true logs and pseudo logs, a discriminator determines a feature matrix of log sequences in true logs and pseudo logs based on the event category, a discriminator determines the authenticity of true logs and pseudo logs based on the feature matrix, and trains the generator and the discriminator based on the authenticity. Implementing the electronic device provided by the second aspect can improve the accuracy of the training model for generating logs that are indistinguishable from the real thing.
[0007] In a third aspect of the present disclosure, there is provided a computer program product, which is tangibly stored on a computer-readable medium and comprises machine-executable instructions, which when executed cause a machine to perform the method according to the first aspect of the present disclosure.
[0008] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a device, the device executes the method according to the first aspect of the present disclosure.
[0009] It can be seen from the above description that according to the solutions of the various embodiments of the present disclosure, the accuracy of the training model for generating logs that are indistinguishable from the real thing can be improved, and then the amount of logs under specified conditions can be quickly expanded when the model is used.
[0010] It should be understood that the summary is provided to introduce a selection of concepts in a simplified form, which will be further described in the detailed description below. The summary is not intended to identify key features or essential features of the disclosure, nor is it intended to limit the scope of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0012] Figure 1 A schematic diagram showing application scenarios according to some embodiments of the present disclosure is shown;
[0013] Figure 2 A flowchart of a method for generating a log according to some embodiments of the present disclosure is shown;
[0014] Figure 3 A schematic diagram of a framework for log training according to some embodiments of the present disclosure is shown;
[0015] Figure 4 A schematic diagram showing the architecture of a log training model according to some embodiments of the present disclosure;
[0016] Figure 5 A schematic diagram showing the structure of a generator according to some embodiments of the present disclosure;
[0017] Figure 6 A schematic diagram showing the structure of a discriminator according to some embodiments of the present disclosure;
[0018] Figure 7 A schematic diagram of a log parsing process according to some embodiments of the present disclosure is shown;
[0019] Figure 8 A schematic diagram showing a log feature extraction process according to some embodiments of the present disclosure is shown;
[0020] Fig. 9 A schematic diagram showing a pre-training strategy for event vectors according to some embodiments of the present disclosure; and
[0021] Fig.10 A schematic structural diagram of a device that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0022] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0023] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0024] Logs are used to record the status and events of devices and systems, which can help manage devices or systems, check operation status, and troubleshoot problems. For example, devices with data collection functions deployed in the Internet of Things (IoT) system can collect sensor data in real time and continuously provide it to the system. These devices are easily affected by the environment, so the devices can be monitored by checking and analyzing log messages to find abnormal conditions caused by sensor hardware failures, energy exhaustion, or the environment to ensure the safety and reliability of the devices. Based on the analysis of logs, IoT system solutions can also be updated and improved.
[0025] In application scenarios that require a large amount of log data, if the real log data is too little to support usage requirements, the framework and method of the enhanced log event dataset proposed in the present disclosure can be used to generate a lot of sufficiently real pseudo log data to meet usage requirements, such as using the generated logs for training new engineers or downstream tasks.
[0026] Some embodiments of the present disclosure provide a method for generating logs, related electronic devices, and computer program products. The method includes: a generator generates a pseudo log based on a generation condition and random noise, a discriminator determines the event category of the log message in the true log and the pseudo log, the discriminator determines the feature matrix of the log sequence in the true log and the pseudo log based on the event category, the discriminator determines the authenticity of the true log and the pseudo log based on the feature matrix, and trains the generator and the discriminator based on the authenticity. Implementing the method provided by the present disclosure can improve the accuracy of the training model for generating logs that are indistinguishable from the real thing, and then can quickly expand the log data set under specified conditions when using the model, and the generated log has very good authenticity.
[0027] Figure 1 FIG. 1 is a schematic diagram of an application scenario 100 provided according to some embodiments of the present disclosure. The application scenario 100 is a schematic diagram of log generation and application. Figure 1 As shown, when the required amount of log data exceeds the existing amount of log data, the log generator 101 can generate a sufficiently realistic large amount of logs 104 based on the input noise 102 to expand the log data set, and then these generated log 104 data sets can be used to provide to engineers 105 and downstream tasks 106. In some implementations, conditions can be added when training the log generator 101, so that when the log generator 101 is used to generate logs, the condition 103 is input, and the log generator 101 can output log data that meets the condition 103.
[0028] Some embodiments of the present disclosure provide a system for generating logs and a method for training a log generator, which can generate sufficiently realistic log data and quickly expand the log data set. The specific implementation can be combined with reference to the following embodiments.
[0029] Figure 2A flow chart of a method 200 according to some embodiments of the present disclosure is shown, and the method 200 can be performed by an electronic device. The electronic device may include, but is not limited to, a personal computer (PC), a server computer, a handheld or laptop device, a mobile terminal, a multiprocessor system, or a combination thereof. The embodiments of the present disclosure do not impose any restrictions on the device type of the electronic device implementing the method 200. It should be understood that in the embodiments of the present disclosure, the main body implementing the method 200 can be implemented by one entity device, or it can be implemented by multiple entity devices together. It can be understood that the main body implementing the method 200 can be a logical function module in a physical device, or it can be a logical function module composed of multiple entity devices. It should be understood that in the following embodiments of the present disclosure, each step in the method provided by the embodiment of the present disclosure can be performed by one entity device, or it can be performed by multiple entity devices in collaboration. The embodiments of the present disclosure do not impose any restrictions on this. It should be understood that the method 200 can also include additional frames not shown and / or the frames shown can be omitted, and the scope of the present disclosure is not limited in this respect.
[0030] In box 201, a generator generates a pseudo log based on a generation condition and random noise. In box 202, a discriminator determines the event category of the log message in the true log and the pseudo log. In box 203, a discriminator determines the feature matrix of the log sequence in the true log and the pseudo log based on the event category. In box 204, the discriminator determines the authenticity of the true log and the pseudo log based on the feature matrix. In box 205, the generator and the discriminator are trained based on the authenticity. Implementing this method 200 can improve the accuracy of the training model for generating logs that are indistinguishable from the real thing, and can quickly expand the log data set under specified conditions when using the model, and the generated log has very good authenticity.
[0031] Method 200 describes the training process of the log generation model, refer to Figure 3 , Figure 3A framework 300 for log training is shown. In the log training framework 300, true log 302 data and conditions 303 can be input into the log training model 301 for training, and the trained model can be used for log generation. In some embodiments, a generative adversarial network (GAN) can be used as the log training model 301. Furthermore, a conditional generative adversarial network (CGAN) can also be used. The conditions can generate log data with targeted conditions. The specific model type and specific training process of the training model are not limited in the embodiments of the present disclosure, and all those that can implement the inventive ideas of the present disclosure are within the scope of protection of the present disclosure. Regarding the process and architecture of using a GAN or CGAN model to train logs, reference can be made to the following. Figures 4 to 9 The embodiment shown.
[0032] Figure 4 The architecture 400 of the log training model is shown. In this implementation, the CGAN model can be used to implement the training of the log. Figure 4 , the architecture 400 includes a generator 401 and a discriminator 405. In combination with method 200, in some embodiments, the generator 401 can generate a pseudo log 404 based on a generation condition 403 and a random noise 402. The pseudo log 404, the true log 406, and the generation condition 407 are input into the discriminator 405, and the discriminator 405 determines the authenticity of the true log and the pseudo log. The generator 401 and the discriminator 406 are trained based on the judgment of authenticity. The generator or the discriminator can be a convolutional neural network model, a recurrent neural network model, a fully connected neural network model, etc., and the present disclosure is not limited to this.
[0033] In the GAN model, the generator 401 is used to capture the data distribution, and the discriminator 405 is used to estimate the probability that the sample comes from the real training data rather than the generator 401. Both the generator 401 and the discriminator 405 can be nonlinear mapping functions, such as multi-layer perceptrons. In order to learn the generator distribution p on the data x g , the generator G constructs a noise distribution from the prior z The mapping function G(z; θ) from (z) to data space g ). Discriminator D(x;θ d ), outputs a single scalar indicating that x came from the training data instead of p g The generator G and the discriminator D can be trained simultaneously, for example, by adjusting the parameters of G to minimize log(1-D(G(z)) and adjusting the parameters of D to minimize log D(X), referring to the objective function V(G,D) of the minimax game shown in formula (1):
[0034]
[0035] Generative adversarial networks can be extended to conditional models if both the generator G and the discriminator D are conditioned on some additional information y. y can be any type of auxiliary information, such as class labels or data from other modalities (such as audio or text information). Conditioning can be performed by feeding y into both the discriminator D and the generator G as an additional input layer. In the generator G, the prior input noise p z (z) and y are combined in a joint hidden representation, and the adversarial training framework allows considerable flexibility in how to compose the hidden representation. In the discriminator D, x and y are represented as the input of a discriminant function, whose objective function V(G,D) of the minimax game is shown in formula (2):
[0036]
[0037] In conjunction with method 200, in some embodiments, the process of training generator 401 and discriminator 405 may include first fixing discriminator 405, training generator 401 based on random noise 402 and generation condition 403, and then the trained generator 401 generates pseudo log 404 according to random noise 402 and generation condition 403. Then, pseudo log 404 generated by generator 401 is input into discriminator 405. Then generator 401 is fixed, and discriminator 405 is trained based on pseudo log 404, true log 406 and generation condition 407.
[0038] In combination with method 200, in some embodiments of the present disclosure, the discriminator 405 may output a discriminant probability based on determining whether the input log is a true log under the corresponding generation condition. Then, the loss is obtained according to the discriminant probability. The discriminator 405 and / or the generator 401 are penalized according to the loss. The discriminator 405 and the generator 401 adjust parameters according to the loss to obtain a training model with higher accuracy.
[0039] In combination with method 200, in some embodiments, training can be stopped when the discrimination probability meets a predetermined value. In some embodiments, when the predetermined value is 0.5, it means that the discriminator 405 cannot distinguish the authenticity of the pseudo log and the real log generated by the generator 401. At this time, it means that the generator 401 can generate log data that is good enough to be mistaken for the real thing.
[0040] In some embodiments, after the model has been trained, the trained generator can be used as the log generator 101. The target condition and random noise are input into the trained generator, and the trained generator generates logs corresponding to the target condition, and then provides these log data to downstream tasks or engineers for reference. Figure 1 Description.
[0041] Figure 5 The structure of the generator 401 in some embodiments of the present disclosure is shown. In this example, the generator 401 may include an encoder 501 and a decoder 502, and the encoder-decoder structure can be used to reconstruct the log sequence and convert the noise into qualified log data. The encoder 501 may include a self-attention layer 503 and a feedforward layer 504, etc. The decoder 502 may include a self-attention layer 505, an encoder-decoder attention layer 506, and a feedforward layer 507, etc. The noise data is input into the encoder 501, passes through each layer of the neural network, and finally the decoder 502 outputs the generated log data.
[0042] Figure 6 The structure of the discriminator 405 in some embodiments of the present disclosure is shown. In this example, the discriminator 405 may include a log encoder 601 and a decoder 602. The log encoder 601 is used to perform pre-training using a pre-training strategy designed specifically for log events before the GAN training process. The log encoder 601 may include a log parser 603 and a feature extractor 604, etc. The decoder 602 may include a self-attention layer 605, an encoder-decoder attention layer 606, and a feedforward layer 607, etc. The log data is input into the log encoder 601, passes through each layer of the neural network, and finally the decoder 602 outputs the discrimination probability and loss. The discriminator and / or the generator can adjust the parameters in the model according to the back propagation of the discrimination probability and the loss to further improve the accuracy of the training model.
[0043] In combination with the foregoing embodiments, in some embodiments, the discriminator can parse each log message to obtain the event category corresponding to each log message, and then the discriminator maps each log message to its corresponding event category. In combination with the foregoing embodiments, in some embodiments, the discriminator determines the feature matrix of the log sequence in the true log and the pseudo log based on the event category. Specifically, the discriminator can construct a log sequence according to the event category and the preset window corresponding to multiple log messages, and then determine the feature matrix of the log sequence according to the log sequence. Afterwards, the feature matrix of the log sequence is used as the input of the model for subsequent training process.
[0044] Logs are semi-structured text data, and unlike classification and detection in computer vision, digital time series, and graph data, the current standard methods for processing abnormal logs are inefficient. Operators usually manually check system logs using regular expression matching or keyword searches (such as "failure" or "kill") to find anomalies. However, this anomaly detection is not suitable for large-scale log data systems because the manual workload is too large. For a large number of log messages, an automated log processing strategy can be adopted. Log messages are unstructured text and semi-structured data, which can be converted into structured data for further analysis.
[0045] Log parsing involves extracting structured or constant parts from log messages. Constant parts are identified by log events or log templates. For example, "CE sym 2, at 0x0b85eee0, mask 0x05" is a log message. The log event associated with the log message is "CE sym<>, at<>, mask<>". Despite the formatting, log events are still text data. Most machine learning algorithms for anomaly detection cannot directly process text data. Therefore, deriving a digital representation of log events or extracting their features is a key step. Anomaly identification can be performed based on the results of feature extraction using some machine learning models, such as regression, random forest, clustering, principal component analysis (PCA) and independent component analysis (ICA). First, retrieve some statistical features related to log events, such as sequence, frequency, surge, seasonality, event ratio, mean inter-arrival time, mean inter-arrival distance, propagation severity and propagation time interval. Then identify its log events based on these statistical features.
[0046] Since the identified log events and features are still text, directly processing text is not suitable for detecting large-scale log anomalies. In an embodiment of the present disclosure, log events can be vectorized, for example, a log event vector is constructed based on the frequency and weight of each word. Then the message sequence of the log is constructed, and the log event vector is converted into a log sequence vector as the input of the subsequent training model. That is, before identifying true logs and false logs, the word vectors in the log are first converted into log event vectors, and then the log event vectors are converted into log sequence vectors. Therefore, the number of log events is much lower than the number of words, the length of the vector is determined by the number of words or the number of log events, and the dimension of the vector is reduced, which further reduces the computational cost, and the reasoning and feature extraction processes become more efficient due to fewer parameters.
[0047] In some embodiments, log parsing is extracted from raw logs, log templates, or log events. Log templates are log events that record system execution related events. For example, as a log template, FT-tree detects the longest combination of frequently occurring words. Using hierarchical clustering, after separating the raw logs into constant and variable logs, the same log events are placed in the same cluster group.
[0048] Figure 7 Schematic diagram 700 shows the process of log parser 603 parsing log data. Figure 7 As shown in FIG. 7 , box 701 contains log data, including 9 original log messages, each of which may contain timestamp, date, node, time, node repetition, message type, component (message generation location), level, and content. For example, the third log message is “-1117848119 2005.06.03R16-MI-N2-C:J17-U01
[0049] 2005-06-0318.21.59.871925R16-MI-N2-C:J17-U01 RAS KERNEL INFO CE sym2,at 0x0b85eee0,mask 0x05”, where 1117848119 is the timestamp, 2005.06.03 is the data, R16-M1-N2-C:J17-U01 is the node, 2005-06-03-18.21.59.871925 is the time, R16-M1-N2-C:J17-U01 is the node duplication, RAS is the message type, KERNEL is the component, INFO is the level, and CE sym2,at 0x0b85eee0,mask 0x05 is the content. After parsing the log message, the log event log can be referred to the representation in block 702. The event is displayed in the last line of box 702, namely "CE sym<*>,at<*>,mask<*>". The semi-structured raw log message is converted into structured information. The variable part in the log message is replaced with a wildcard, and the constant part remains unchanged. Each log event has a unique log event and event template. The event template of the third log message is "CE sym<>,at<>,mask<>", corresponding to log event E3. Figure 7In the example, in box 703, 5 log events E1, E2, E3, E4, and E5 can be obtained based on the 9 original log messages in box 701. Each original log message can be mapped to a log event. For example, the first log message is mapped to log event E1, the second log message is mapped to log event E2, and so on. Regarding the algorithm used to parse the log, the embodiments of the present disclosure do not limit this. In one example, the Drain algorithm for online log parsing based on a fixed depth tree can be used for log parsing.
[0050] In order to obtain the log sequence vector, firstly, the log event vector can be obtained by pre-training, and the log event is represented by the log event vector. The matrix from log event to log sequence is generated by the feature extractor 604.
[0051] Combination Figure 8 , the following describes the process of feature extraction of log data by the feature extractor 604. In combination with the foregoing embodiment, in some embodiments, based on the event vector and the log sequence, determining the feature matrix of the log sequence may specifically include performing weighted average processing on the event vectors in the log sequence to obtain the feature matrix. In combination with the foregoing embodiment, in some embodiments, the weight of the event vector depends on the frequency of occurrence of the event category of the corresponding log.
[0052] Figure 8 A schematic diagram 800 is shown of a process in which a feature extractor generates a log sequence feature matrix based on a log vector. A fixed window is used to divide multiple log messages into multiple log sequences. For example, Figure 8 As shown, Figure 7 The 9 log messages in are divided into sequence 1 lse1 = [E1, E2, E3], sequence 2 lse2 = [E3, E4, E4], sequence 3 lse3 = [E1, E2, E3], and the window size is 3. Each event vector is uniquely encoded, and then learned according to the divided sequence to obtain the learned event vector 801. Then, based on the learned log event vector 801 and the log sequence, the feature matrix 802 of the log sequence is obtained as the input of the subsequent training model. For the process of learning event vector 801, please refer to Fig. 9 Described embodiment.
[0053] In some embodiments, the log event vector 801 can be converted into a log sequence vector 802 by using a Bary algorithm or a term frequency-inverse document frequency (tf-idf) algorithm. In some examples, the Bary algorithm can define the vector of a log sequence as the average value of all its log events, as shown in formula (3):
[0054]
[0055] In other examples, the Tf-idf algorithm can define the vector of a log sequence as a weighted average of all its log events, where the weight depends on the frequency of occurrence of the log events, for example, rare log events have a higher weight than frequent log events.
[0056] In an example, according to the Bary algorithm, the vector of the first log sequence lse1 is the average of the event vectors E1, E2, and E3, that is, lse1 = ([1, 2, 1, 0, 1] + [2, 1, 3, 0, 0] + [1, 2, 2, 3, 1]) / 3 = (1.33, 1.67, 2, 1, 0.6). Similarly, the vectors of lse2 and lse3 are calculated in this way, respectively, lse2 = [0.33, 0.67, 1.33, 2.33, 2.33] and lse3 = [1, 1.33, 1.67, 1, 1.67]. Figure 8 As shown in . After the above transformation, we can get the vector of all log sequences, which is a matrix of N / W×dim(T), where N is the number of logs, W is the window size, and dim(T) is the dimension of the vector space T, which is 5 in this example.
[0057] refer to Fig. 9 , Fig. 9 A schematic diagram 900 of a pre-training strategy for event vectors is shown. In combination with the foregoing embodiments, in some embodiments, each event category can be represented by a one-hot encoding. Then, based on the one-hot encoding of the event category and the log sequence, an event vector is obtained. Based on the event vector and the log sequence, a feature matrix of the log sequence is determined.
[0058] In some implementations, log events can be trained as word vectors to obtain log event vectors. For example, in some embodiments, a target word of a log sequence can be selected, and the context word vector of the target word can be used as a training input, and the target word vector can be used as a training output. Alternatively, in other embodiments, the input can be a word vector of the target word, and the output can be a context word vector of the target word. This embodiment does not limit the training method. In general, the training model includes at least an input layer, a hidden layer, and an output layer.
[0059] refer to Fig. 9 , we can first represent the log events E1 to E5 with one-hot encoding for training. Here, considering that there are 5 event vectors, the one-hot encoding can be represented by a 5-dimensional vector, |E|=5. Fig. 9In the example, assuming that the fixed window size is 3, the 9 log messages are divided into three sequences (lse1, lse2, lse3): [E1, E2, E3], [E3, E4, E4], [E5, E3, E1]. The middle word in each log sequence is used as the target word, the context word vector is used as the training input, and the target word vector is used as the training output. That is, log events E1 and E3 in lse1 are used as input, and log event E2 is used as output; log events E3 and E4 in lse2 are used as input, and log event E4 is used as output; log events E5 and E3 in lse3 are used as input, and log event E1 is used as output. The hidden layer size is vague. After training the model, we can obtain the embedding vector WMR of the log event by multiplying the one-hot vector of the log event with the weight matrix |E|dimT In this example, assuming that the dimension is set to 5, the embedding vectors of log events E1 to E5 obtained by training are [1,2,1,0,1], [2,1,3,0,0], [1,2,2,3,1], [0,0,1,2,3], [1,0,2,0,3], as shown in Figure 8 Event vector 801 is shown.
[0060] According to the various embodiments of the present disclosure described above and their combined embodiments, the accuracy of the training model for generating logs that are indistinguishable from real ones can be improved, and thus the amount of logs under specified conditions can be quickly expanded when the model is used.
[0061] It should be understood that the above Figures 3 to 9 The implementation method shown in the figure is only for reference. Figures 3 to 9 The architecture or process illustrated in the figure may have other different forms, and may also include more or fewer functional modules and / or units. These modules and / or units may be partially or fully implemented as hardware modules, software modules, firmware modules or any combination thereof, and the embodiments of the present disclosure are not limited to this.
[0062] Fig.10 1 shows a schematic structural diagram of an example device 1000 that can be used to implement some embodiments of the present disclosure. The device 1000 can be implemented as a server or a PC, etc. The embodiments of the present disclosure do not limit the specific implementation type of the device 1000. Fig.10As shown, the device 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 1002 or computer program instructions loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0063] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0064] The processing unit 1001 may perform the various methods and / or processes described above, such as the method 200. For example, in some embodiments, the method 200 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the CPU 1001, one or more steps of the method 200 described above may be performed. Alternatively, in other embodiments, the CPU 1001 may be configured to perform the method 200 in any other suitable manner (e.g., by means of firmware).
[0065] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip systems (SOCs), load programmable logic devices (CPLDs), and the like.
[0066] In some embodiments, the methods and processes described above may be implemented as a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0067] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0068] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0069] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, and conventional procedural programming languages. The computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server.
[0070] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer or other programmable data processing device, thereby producing a machine so that when these instructions are executed by the processing unit of a computer or other programmable data processing device, a device for realizing the functions / actions specified in one or more boxes in the flow chart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions make the computer, programmable data processing device and / or other equipment work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for realizing various aspects of the functions / actions specified in one or more boxes in the flow chart and / or block diagram. Computer-readable program instructions can also be loaded onto a computer, other programmable data processing device, or other device, so that a series of operating steps are performed on the computer, other programmable data processing device or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing device, or other device realize the functions / actions specified in one or more boxes in the flow chart and / or block diagram.
[0071] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0072] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the equipment, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous frames can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the functions involved. It should also be noted that each frame in the block diagram and / or flow chart, and the combination of frames in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0073] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.
[0074] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
[0075] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for generating a log, the method comprising: The generator generates pseudo logs based on the generation conditions and random noise; Determining, by a discriminator, event categories of log messages in the true log and the pseudo log; The discriminator determines a feature matrix of log sequences in the true log and the pseudo log based on the event category; The discriminator determines the authenticity of the true log and the false log based on the feature matrix; as well as The generator and the discriminator are trained based on the authenticity.
2. The method according to claim 1, further comprising: The discriminator parses each log message to obtain an event category corresponding to each log message; The discriminator maps each log message to the corresponding event category.
3. The method according to claim 2, further comprising: The discriminator constructs the log sequence according to the event categories and preset windows corresponding to the plurality of log messages; The characteristic matrix of the log sequence is determined according to the log sequence.
4. The method according to claim 3, further comprising: Represent each of the event categories by a one-hot encoding; Obtaining an event vector based on the one-hot encoding of the event category and the log sequence; The feature matrix of the log sequence is determined based on the event vector and the log sequence.
5. The method according to claim 4, wherein determining the feature matrix of the log sequence based on the event vector and the log sequence comprises: The event vectors in the log sequence are subjected to weighted averaging processing to obtain the feature matrix.
6. The method according to claim 5, wherein: The weight of the event vector depends on the frequency of occurrence of the event category of the corresponding log.
7. The method according to claim 1, wherein the training of the generator and the discriminator comprises: The discriminator is fixed, and the generator is trained based on the random noise and the generation condition; The trained generator generates the pseudo log according to the random noise and the generation condition; Inputting the pseudo log generated by the generator into the discriminator; The generator is fixed, and the discriminator is trained based on the pseudo log, the true log, and the generation condition.
8. The method according to claim 7, wherein the training further comprises: The discriminator outputs a discrimination probability based on judging whether the input log is a true log corresponding to the generation condition; Obtaining a loss according to the discrimination probability; The discriminator and / or the generator are penalized according to the loss.
9. The method according to claim 8, further comprising: The training is stopped when the discrimination probability meets a predetermined value, wherein when the predetermined value is 0.5, it indicates that the discriminator cannot distinguish the authenticity of the pseudo log and the true log generated by the generator.
10. The method according to claim 1, further comprising: Inputting the target condition and random noise into the trained generator; The trained generator generates logs corresponding to the target conditions.
11. An electronic device, comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, the instructions causing the electronic device to perform operations when executed by the processor, the operations comprising: The generator generates pseudo logs based on the generation conditions and random noise; Determining, by a discriminator, event categories of log messages in the true log and the pseudo log; The discriminator determines a feature matrix of log sequences in the true log and the pseudo log based on the event category; The discriminator determines the authenticity of the true log and the false log based on the feature matrix; and The generator and the discriminator are trained based on the authenticity.
12. The electronic device of claim 11, the operations further comprising: The discriminator parses each log message to obtain an event category corresponding to each log message; The discriminator maps each log message to the corresponding event category.
13. The electronic device of claim 12, the operations further comprising: The discriminator constructs the log sequence according to the event categories and preset windows corresponding to the plurality of log messages; The characteristic matrix of the log sequence is determined according to the log sequence.
14. The electronic device of claim 13, the operations further comprising: Represent each of the event categories by a one-hot encoding; Obtaining an event vector based on the one-hot encoding of the event category and the log sequence; The feature matrix of the log sequence is determined based on the event vector and the log sequence.
15. The electronic device according to claim 14, wherein the operation of determining the feature matrix of the log sequence based on the event vector and the log sequence comprises: The event vectors in the log sequence are subjected to weighted averaging processing to obtain the feature matrix.
16. The electronic device according to claim 15, wherein: The weight of the event vector depends on the frequency of occurrence of the event category of the corresponding log.
17. The electronic device according to claim 11, wherein the operation of training the generator and the discriminator comprises: The discriminator is fixed, and the generator is trained based on the random noise and the generation condition; The trained generator generates the pseudo log according to the random noise and the generation condition; Inputting the pseudo log generated by the generator into the discriminator; The generator is fixed, and the discriminator is trained based on the pseudo log, the true log, and the generation condition.
18. The electronic device according to claim 17, wherein the training operation further comprises: The discriminator outputs a discrimination probability based on judging whether the input log is a true log corresponding to the generation condition; Obtaining a loss according to the discrimination probability; The discriminator and / or the generator are penalized according to the loss.
19. The electronic device of claim 18, the operations further comprising: The training is stopped when the discrimination probability meets a predetermined value, wherein when the predetermined value is 0.5, it indicates that the discriminator cannot distinguish the authenticity of the pseudo log and the true log generated by the generator.
20. A computer program product tangibly stored on a non-transitory computer readable medium and comprising computer executable instructions that when executed cause a computer to: The generator generates pseudo logs based on the generation conditions and random noise; Determining, by a discriminator, event categories of log messages in the true log and the pseudo log; The discriminator determines a feature matrix of log sequences in the true log and the pseudo log based on the event category; The discriminator determines the authenticity of the true log and the false log based on the feature matrix; as well as The generator and the discriminator are trained based on the authenticity.
Citation Information
Cited By
Method and apparatus for processing log, device, and product
WO2026118073A1
