Log file processing method and device, computer equipment and storage medium
Through machine learning algorithm and principal component analysis method, key text features in log files are extracted, which solves the problems of ununiversality and high labor cost of log file processing in the production environment in the existing technology, and realizes intelligent and automated processing. Log file processing improves processing efficiency and applicability.
Patent Information
- Application Number
- CN202410853841.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-15
AI Technical Summary
Existing log file processing methods are not universal in production environments, and log parsing requires a lot of labor costs and is not universal, making it difficult to adapt to the software testing and operation and maintenance needs of the industry.
Using an intelligent method based on machine learning algorithms, by obtaining log files of program running links, extracting target text and program behavior characteristics, determining key texts that affect program behavior, and using principal component analysis to establish the relationship between text characteristics and program behavior characteristics. corresponding relationship to realize automated log file processing.
It improves the efficiency of log file processing, reduces labor costs, realizes rapid processing and universality of log files, and is suitable for log analysis in different environments.
Smart Images

Figure CN118779294A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a log file processing method, device, computer equipment and storage medium. Background Art
[0002] There are two common methods for processing traffic log files: log.parse (console command tool) instrumentation processing and log post-processing analysis. However, the two methods are not universally adaptable. Specifically: 1. log.parse instrumentation processing is not suitable for production environments (there are production safety issues); 2. Log analysis is a commonly used software testing and operation and maintenance method in the industry, which is suitable for production, pre-release, and development environments. However, log analysis requires personnel to be very familiar with the business and to associate objects. This method consumes huge manpower costs and is not universal.
[0003] Therefore, there is an urgent need to propose an intelligent and universal log file processing method, device, computer equipment and storage medium. Summary of the invention
[0004] Based on this, it is necessary to provide an intelligent and universal log file processing method, device, computer equipment and storage medium to address the above technical problems.
[0005] In one aspect, a log file processing method is provided, the method comprising:
[0006] Get the log file of the program running link;
[0007] Extracting target text and program behavior features corresponding to the target text based on the log file of the program running link;
[0008] Determine, based on a machine learning algorithm, a correspondence between the target text and a program behavior feature corresponding to the target text;
[0009] Based on the corresponding relationship, key text affecting program behavior is determined.
[0010] Optionally, the method for obtaining the log file of the program running link includes:
[0011] Get user request;
[0012] Based on the user request, determining a target program running link corresponding to the user request;
[0013] Based on the target program running link, a program running log file corresponding to the user request is obtained.
[0014] Optionally, based on the log file of the program running link, extracting the target text and the program behavior feature corresponding to the target text includes:
[0015] Based on the program running log file corresponding to the user request, extract the n text features {x1, x2, …, x n} composed of the target text logk, where k represents the text identifier;
[0016] Based on the target text, extract the target program behavior feature corresponding to the target text, and determine the hash value v by using an array object constructed based on the target program behavior feature. a , where a represents the program behavior feature identifier;
[0017] Based on the target text and its corresponding hash value, the target array is generated as (logk,v a ).
[0018] Optionally, based on a machine learning algorithm, determining the correspondence between the target text and the program behavior feature corresponding to the target text includes:
[0019] Get the target array (logk,v a );
[0020] Defining a principal component analysis method as the machine learning algorithm, and determining the correspondence between the text features in the target text and the program behavior features corresponding to the target text based on the principal component analysis method includes:
[0021] v a =∑p i x i
[0022] Among them, p i represents the weight, x i Represents the i-th text feature in the target text logk.
[0023] Optionally, based on the corresponding relationship, determining the key text affecting the program behavior includes:
[0024] Get multiple target arrays;
[0025] Based on the multiple target arrays, obtaining a correspondence between text features in multiple target texts and program behavior features corresponding to the target texts;
[0026] A plurality of correspondences are compared, and based on the comparison results, key texts affecting program behavior are determined.
[0027] Optionally, multiple corresponding relationships are compared, and based on the comparison result, key texts that affect program behavior are determined to include:
[0028] In response to detecting that the first corresponding relationship v1 is equal to the second corresponding relationship v2, ∑p i (d i -s i )=0~(d i ≠s i =>p i =0), indicating the text feature d in the first correspondence i and the text feature s in the second correspondence i The corresponding text is not critical text that affects the behavior of the program;
[0029] In response to detecting that the first corresponding relationship v1 is not equal to the second corresponding relationship v2, the p of the text features in the multiple corresponding relationships is obtained based on the principal component analysis strategy. i value, the largest p i The text corresponding to the value corresponding to the text feature is determined as the key text that affects the program behavior.
[0030] Optionally, after determining the key text affecting the program behavior based on the corresponding relationship, the method further includes:
[0031] A target text feature is extracted from the key text, the target text feature is defined as a key influencing variable that affects program behavior, and the key influencing variable is sent to a user terminal.
[0032] In another aspect, a log file processing device is provided, the device comprising:
[0033] The log file acquisition module is used to obtain the log file of the program running link;
[0034] A feature extraction module, used to extract a target text and program behavior features corresponding to the target text based on a log file of the program running link;
[0035] A corresponding relationship determination module, used to determine the corresponding relationship between the target text and the program behavior feature corresponding to the target text based on a machine learning algorithm;
[0036] The key text determination module is used to determine the key text that affects the program behavior based on the corresponding relationship.
[0037] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0038] Get the log file of the program running link;
[0039] Extracting target text and program behavior features corresponding to the target text based on the log file of the program running link;
[0040] Determine, based on a machine learning algorithm, a correspondence between the target text and a program behavior feature corresponding to the target text;
[0041] Based on the corresponding relationship, key text affecting program behavior is determined.
[0042] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0043] Get the log file of the program running link;
[0044] Extracting target text and program behavior features corresponding to the target text based on the log file of the program running link;
[0045] Determine, based on a machine learning algorithm, a correspondence between the target text and a program behavior feature corresponding to the target text;
[0046] Based on the corresponding relationship, key text affecting program behavior is determined.
[0047] The above-mentioned log file processing method, device, computer equipment and storage medium, the method includes: obtaining the log file of the program running link; based on the log file of the program running link, extracting the target text and the program behavior features corresponding to the target text; based on the machine learning algorithm, determining the correspondence between the target text and the program behavior features corresponding to the target text; based on the correspondence, determining the key text that affects the program behavior. The present application is based on an intelligent and universal key feature extraction method for quickly processing log files, improving data processing efficiency and reducing labor costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 An application environment diagram of a log file processing method in an embodiment;
[0049] Figure 2 A flow chart of a log file processing method in one embodiment;
[0050] Figure 3 A schematic diagram of event names of a log file processing method in one embodiment;
[0051] Figure 4 is a structural block diagram of a log file processing device in an embodiment;
[0052] Figure 5FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as including but not limited to.
[0055] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0056] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0057] The log file processing method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the data processing platform set on the server 104 through the network, wherein the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0058] In one embodiment, Figure 2 As shown, a log file processing method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0059] S1: Get the log file of the program running link.
[0060] It should be noted that a log file (log) is a record file that records events and activities that occur when a system or application is running for future reference. It does not have a fixed format and is usually a text file that can be opened with Notepad to view the content, or in other formats. The log file of the program running link can refer to the log files generated by different threads when the server is running.
[0061] In some specific implementations, the method for obtaining the log file of the program running link includes:
[0062] Obtaining a user request, wherein the user request includes an identifier for identifying a specific program running link and a specific text in a log file generated based on the program running link;
[0063] Based on the user request, determining a target program running link corresponding to the user request, wherein the specific target program running link can be matched by the above identifier;
[0064] Based on the target program running link, a program running log file corresponding to the user request is obtained, wherein after matching a specific running link, log data generated based on the running link can be obtained.
[0065] S2: Based on the log file of the program running link, extract the target text and the program behavior features corresponding to the target text.
[0066] It should be noted that the target text is the log text, which can be described by text as the input data of the pseudo code generation tool. The program behavior feature is the program behavior corresponding to the log text, and the behavior is recorded by trace, such as Figure 3 In the example shown, trace can be defined as the hash value of the array object composed of eventName{'JoinChatGroup', 'INFO', 'CacheService', ....}, that is, trace Hash. The trace hash can be described by value as input data for the pseudo-code generation tool, where the tool input is specifically:
[0067]
[0068] In some specific implementations, based on the log file of the program running link, extracting the target text and the program behavior features corresponding to the target text includes:
[0069] Based on the program running log file corresponding to the user request, extract the n text features {x1, x2, …, x n}, where k represents the text identifier. For example, when k = 1, 2, ..., the corresponding text is log1, log2, ...;
[0070] Based on the target text, extract the target program behavior feature corresponding to the target text, and determine the hash value v by using an array object constructed based on the target program behavior feature. a , i.e. the trace Hash mentioned above, where the array object refers to the array of log events corresponding to the current trace, such as {event1, event2, ... eventn}, event refers to the program behavior feature in the log file (i.e. log event), a represents the program behavior feature identifier, such as a = 1, 2, ..., its corresponding hash value is v1, v2, ..., the hash value is a function that maps input data of any length (called message or plaintext) to output data of fixed length (called hash value or ciphertext), usually represented by a short string of random letters and numbers, and its specific conversion method is a common method, which will not be repeated here;
[0071] Based on the target text and its corresponding hash value, the target array is generated as (logk,v a ), that is, (log(x1,x2,…,x n ),trace(hash value)).
[0072] S3: Based on a machine learning algorithm, determine the corresponding relationship between the target text and the program behavior features corresponding to the target text.
[0073] It should be noted that the machine learning algorithm refers to principal component analysis (PCA), which is a powerful data analysis technology mainly used for dimensionality reduction and feature extraction. Its core idea is to convert high-dimensional data into low-dimensional space through linear transformation while retaining the maximum variance in the data. In principal component analysis, the original variables are converted into a set of linearly unrelated variables through orthogonal transformation. These new variables are called principal components. The purpose of PCA is to reduce the dimension of the data while retaining as much information of the original data as possible. This method is widely used in data compression, redundancy elimination, denoising and visualization. The advantages of principal component analysis include the ability to extract key features from the data, reduce the complexity of the data set, and maintain the structure of the data. It can also be used to improve the efficiency of cluster analysis and regression analysis. Based on this, the present application can improve the efficiency of feature extraction through the machine learning algorithm.
[0074] Determining the correspondence between the target text and the program behavior feature corresponding to the target text based on the machine learning algorithm includes:
[0075] Get the target array (logk,v a );
[0076] Defining a principal component analysis method as the machine learning algorithm, and determining the correspondence between the text features in the target text and the program behavior features corresponding to the target text based on the principal component analysis method includes:
[0077] v a =∑p i x i
[0078] Among them, p i represents the weight, x i Represents the i-th text feature in the target text logk.
[0079] For example, for log1 and the corresponding trace, the constructed array is (log1, v1), that is, (log(c1, c2, ..., c n ),v1); for log2 and the corresponding trace, the constructed array is (log2,v2), that is, (log(y1,y2,…,y n ),v2), the corresponding relations generated are v1=∑p i c i 、v2=∑p i y i , and so on, thereby generating a correspondence between multiple texts and program behavior features corresponding to the texts.
[0080] S4: Based on the corresponding relationship, determine the key text that affects the program behavior.
[0081] It should be noted that determining the key text that affects program behavior is to find the maximum p i , and its corresponding x i The corresponding sample is the key sample, and the text features in the key sample are the key influencing variables, which can refer to the traffic features that have a decisive influence on the program running link. For example, person{gender....} determines different program behaviors: gender=female, person.EnterBabyCareRoom() can be selected; while gender=male will not execute the function, so female is the key influencing variable.
[0082] In some specific implementations, based on the corresponding relationship, determining the key text that affects the program behavior includes:
[0083] Get multiple target arrays, that is, the corresponding (logk,v a), such as (log1,v1), (log2,v2), etc.
[0084] Based on the multiple target arrays, the corresponding relationship between the text features in the multiple target texts and the program behavior features corresponding to the target texts is obtained, that is, (log(x1, x2, ..., x n ),v a ), such as (log(c1,c2,…,c n ),v1)、(log(y1,y2,…,y n ),v2), etc.
[0085] Compare multiple correspondences and determine the key text that affects program behavior based on the comparison results, specifically:
[0086] In response to detecting that the first corresponding relationship v1 is equal to the second corresponding relationship v2, ∑p i (d i -s i )=0~(d i ≠s i =>p i =0), indicating the text feature d in the first correspondence i and the text feature s in the second correspondence i The corresponding text is not the key text that affects the program behavior, where “~” indicates approximation and “=>” indicates derivation;
[0087] In response to detecting that the first corresponding relationship v1 is not equal to the second corresponding relationship v2, the p of the text features in the multiple corresponding relationships is obtained based on the principal component analysis strategy. i value, the largest p i The text corresponding to the value corresponding to the text feature is determined as the key text that affects the program behavior.
[0088] Among them, the principal component analysis strategy is used to obtain the p of text features in multiple corresponding relationships. i The specific steps of the value include:
[0089] (1) Define n d-dimensional data, namely (x1, x2, …, x n );
[0090] (2) The original data is organized into a matrix X with n rows and d columns. Based on the above content, we can know that X is transformed into a matrix X by log(c1, c2, …, c n )、log(y1,y2,…,y n )..., such as X = [[c1,c2,…,c n ],[y1,y2,…,y n ]...];
[0091] (3) Zero-mean each column of matrix X (representing an attribute), that is, subtract the mean of this column;
[0092] (4) Calculate the covariance matrix C = 1 / mXX T ;
[0093] (5) Find the eigenvalues and corresponding eigenvectors of the covariance matrix;
[0094] (6) Arrange the eigenvectors into a matrix row by row from top to bottom according to the corresponding eigenvalues, and take the first k rows to form the matrix P;
[0095] (7)Y=PX is the data after dimension reduction to k dimensions, where Y is v in the above content. a .
[0096] Based on this, we can solve and determine the maximum p i The text corresponding to the value corresponding to the text feature is determined as the key text that affects the program behavior.
[0097] In some specific implementations, after determining the key text that affects the program behavior based on the corresponding relationship, the method further includes:
[0098] Extract the target text features from the key text and define the target text features as key influencing variables that affect program behavior, such as (x1, x2, ..., x n ), and send the key influencing variables to the user terminal for displaying the results to the user.
[0099] Based on the above steps, the implementation process using the corresponding tools includes:
[0100]
[0101]
[0102] For example, the effect of applying the above steps is: Text1:
[0103]
[0104] Text2:
[0105]
[0106] Text3:
[0107]
[0108] Among them, the keywords of Text3 after 3 iterations are as follows:
[0109]
[0110] Among them, it can be seen from the above implementation results that the present application can achieve high-precision feature extraction through multiple iterations in the case of more data.
[0111] In the above-mentioned log file processing method, the method includes: obtaining the log file of the program running link; based on the log file of the program running link, extracting the target text and the program behavior features corresponding to the target text; based on the machine learning algorithm, determining the correspondence between the target text and the program behavior features corresponding to the target text; based on the correspondence, determining the key text that affects the program behavior. The present application is based on an intelligent and universal key feature extraction method for quickly processing log files, improving data processing efficiency and reducing labor costs.
[0112] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0113] In one embodiment, Figure 4 As shown, a log file processing device is provided, including: a log file acquisition module, a feature extraction module, a correspondence determination module and a key text determination module, wherein:
[0114] The log file acquisition module is used to obtain the log file of the program running link;
[0115] A feature extraction module, used to extract a target text and program behavior features corresponding to the target text based on a log file of the program running link;
[0116] A corresponding relationship determination module, used to determine the corresponding relationship between the target text and the program behavior feature corresponding to the target text based on a machine learning algorithm;
[0117] The key text determination module is used to determine the key text that affects the program behavior based on the corresponding relationship.
[0118] As a preferred implementation, in the embodiment of the present invention, the log file acquisition module is specifically used for:
[0119] Get user request;
[0120] Based on the user request, determining a target program running link corresponding to the user request;
[0121] Based on the target program running link, a program running log file corresponding to the user request is obtained.
[0122] As a preferred implementation, in the embodiment of the present invention, the feature extraction module is specifically used for:
[0123] Based on the program running log file corresponding to the user request, extract the n text features {x1, x2, …, x n} composed of the target text logk, where k represents the text identifier;
[0124] Based on the target text, extract the target program behavior feature corresponding to the target text, and determine the hash value v by using an array object constructed based on the target program behavior feature. a , where a represents the program behavior feature identifier;
[0125] Based on the target text and its corresponding hash value, the target array is generated as (logk,v a ).
[0126] As a preferred implementation manner, in the embodiment of the present invention, the corresponding relationship determination module is specifically used for:
[0127] Get the target array (logk,v a );
[0128] Defining a principal component analysis method as the machine learning algorithm, and determining the correspondence between the text features in the target text and the program behavior features corresponding to the target text based on the principal component analysis method includes:
[0129] v a =∑p i x j
[0130] Among them, p i represents the weight, x i Represents the i-th text feature in the target text logk.
[0131] As a preferred implementation, in the embodiment of the present invention, the key text determination module is specifically used for:
[0132] Get multiple target arrays;
[0133] Based on the multiple target arrays, obtaining a correspondence between text features in multiple target texts and program behavior features corresponding to the target texts;
[0134] A plurality of correspondences are compared, and based on the comparison results, key texts affecting program behavior are determined.
[0135] As a preferred implementation, in the embodiment of the present invention, the key text determination module is further used to:
[0136] In response to detecting that the first corresponding relationship v1 is equal to the second corresponding relationship v2, ∑p i (d i -s i )=0~(d i ≠s i =>p i =0), indicating the text feature d in the first correspondence i and the text feature s in the second correspondence i The corresponding text is not critical text that affects the behavior of the program;
[0137] In response to detecting that the first corresponding relationship v1 is not equal to the second corresponding relationship v2, the p of the text features in the multiple corresponding relationships is obtained based on the principal component analysis strategy. i value, the largest p i The text corresponding to the value corresponding to the text feature is determined as the key text that affects the program behavior.
[0138] As a preferred implementation, in the embodiment of the present invention, the device further includes a key influencing variable determination module, and the key influencing variable determination module is specifically used to:
[0139] A target text feature is extracted from the key text, the target text feature is defined as a key influencing variable that affects program behavior, and the key influencing variable is sent to a user terminal.
[0140] For the specific definition of the log file processing device, please refer to the definition of the log file processing method above, which will not be repeated here. Each module in the above-mentioned log file processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0141] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a log file processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0142] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0143] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0144] S1: Get the log file of the program running link;
[0145] S2: extracting a target text and a program behavior feature corresponding to the target text based on a log file of the program running link;
[0146] S3: Determine the corresponding relationship between the target text and the program behavior feature corresponding to the target text based on a machine learning algorithm;
[0147] S4: Based on the corresponding relationship, determine the key text that affects the program behavior.
[0148] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0149] Get user request;
[0150] Based on the user request, determining a target program running link corresponding to the user request;
[0151] Based on the target program running link, a program running log file corresponding to the user request is obtained.
[0152] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0153] Based on the program running log file corresponding to the user request, extract the n text features {x1, x2, …, x n} composed of the target text logk, where k represents the text identifier;
[0154] Based on the target text, extract the target program behavior feature corresponding to the target text, and determine the hash value v by using an array object constructed based on the target program behavior feature. a , where a represents the program behavior feature identifier;
[0155] Based on the target text and its corresponding hash value, the target array is generated as (logk,v a ).
[0156] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0157] Get the target array (logk,v a );
[0158] Defining a principal component analysis method as the machine learning algorithm, and determining the correspondence between the text features in the target text and the program behavior features corresponding to the target text based on the principal component analysis method includes:
[0159] v a =∑p i x i
[0160] Among them, p i represents the weight, x i Represents the i-th text feature in the target text logk.
[0161] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0162] Get multiple target arrays;
[0163] Based on the multiple target arrays, obtaining a correspondence between text features in multiple target texts and program behavior features corresponding to the target texts;
[0164] A plurality of correspondences are compared, and based on the comparison results, key texts affecting program behavior are determined.
[0165] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0166] In response to detecting that the first corresponding relationship v1 is equal to the second corresponding relationship v2, ∑p i (d i -s i )=0~(d i ≠s i =>p i =0), indicating the text feature d in the first correspondence i and the text feature s in the second correspondence i The corresponding text is not critical text that affects the behavior of the program;
[0167] In response to detecting that the first corresponding relationship v1 is not equal to the second corresponding relationship v2, the p of the text features in the multiple corresponding relationships is obtained based on the principal component analysis strategy. i value, the largest p i The text corresponding to the value corresponding to the text feature is determined as the key text that affects the program behavior.
[0168] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0169] A target text feature is extracted from the key text, the target text feature is defined as a key influencing variable that affects program behavior, and the key influencing variable is sent to a user terminal.
[0170] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0171] S1: Get the log file of the program running link;
[0172] S2: extracting a target text and a program behavior feature corresponding to the target text based on a log file of the program running link;
[0173] S3: Determine the corresponding relationship between the target text and the program behavior feature corresponding to the target text based on a machine learning algorithm;
[0174] S4: Based on the corresponding relationship, determine the key text that affects the program behavior.
[0175] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0176] Get user request;
[0177] Based on the user request, determining a target program running link corresponding to the user request;
[0178] Based on the target program running link, a program running log file corresponding to the user request is obtained.
[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0180] Based on the program running log file corresponding to the user request, extract the n text features {x1, x2, …, x n} composed of the target text logk, where k represents the text identifier;
[0181] Based on the target text, extract the target program behavior feature corresponding to the target text, and determine the hash value v by using an array object constructed based on the target program behavior feature. a , where a represents the program behavior feature identifier;
[0182] Based on the target text and its corresponding hash value, the target array is generated as (logk,v a ).
[0183] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0184] Get the target array (logk,v a );
[0185] Defining a principal component analysis method as the machine learning algorithm, and determining the correspondence between the text features in the target text and the program behavior features corresponding to the target text based on the principal component analysis method includes:
[0186] v a =∑p i x i
[0187] Among them, p i represents the weight, x i Represents the i-th text feature in the target text logk.
[0188] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0189] Get multiple target arrays;
[0190] Based on the multiple target arrays, obtaining a correspondence between text features in multiple target texts and program behavior features corresponding to the target texts;
[0191] A plurality of correspondences are compared, and based on the comparison results, key texts affecting program behavior are determined.
[0192] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0193] In response to detecting that the first corresponding relationship v1 is equal to the second corresponding relationship v2, ∑p i (d i -s i )=0~(d i ≠s i =>p i =0), indicating the text feature d in the first correspondence i and the text feature s in the second correspondence i The corresponding text is not critical text that affects the behavior of the program;
[0194] In response to detecting that the first corresponding relationship v1 is not equal to the second corresponding relationship v2, the p of the text features in the multiple corresponding relationships is obtained based on the principal component analysis strategy. i value, the largest p i The text corresponding to the value corresponding to the text feature is determined as the key text that affects the program behavior.
[0195] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0196] A target text feature is extracted from the key text, the target text feature is defined as a key influencing variable that affects program behavior, and the key influencing variable is sent to a user terminal.
[0197] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0198] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0199] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A log file processing method, characterized in that: The method comprises: Get the log file of the program running link; Extracting target text and program behavior features corresponding to the target text based on the log file of the program running link; Determine, based on a machine learning algorithm, a correspondence between the target text and a program behavior feature corresponding to the target text; Based on the corresponding relationship, key text affecting program behavior is determined.
2. The log file processing method according to claim 1, characterized in that: The method for obtaining the log file of the program running link includes: Get user request; Based on the user request, determining a target program running link corresponding to the user request; Based on the target program running link, a program running log file corresponding to the user request is obtained.
3. The log file processing method according to claim 1, characterized in that: Based on the log file of the program running link, extracting the target text and the program behavior features corresponding to the target text includes: Based on the program running log file corresponding to the user request, extract the n text features {x1, x2, …, x n } composed of the target text logk, where k represents the text identifier; Based on the target text, extract the target program behavior feature corresponding to the target text, and determine the hash value v by using an array object constructed based on the target program behavior feature. a , where a represents the program behavior feature identifier; Based on the target text and its corresponding hash value, the target array is generated as (logk,v a ).
4. The log file processing method according to claim 3, characterized in that: Determining the correspondence between the target text and the program behavior feature corresponding to the target text based on the machine learning algorithm includes: Get the target array (logk,v a ); Defining a principal component analysis method as the machine learning algorithm, and determining the correspondence between the text features in the target text and the program behavior features corresponding to the target text based on the principal component analysis method includes: v a =∑p i x i Among them, p i represents the weight, x i Represents the i-th text feature in the target text logk.
5. The log file processing method according to claim 4, characterized in that: Based on the correspondence, the key texts that affect program behavior are determined to include: Get multiple target arrays; Based on the multiple target arrays, obtaining a correspondence between text features in multiple target texts and program behavior features corresponding to the target texts; A plurality of correspondences are compared, and based on the comparison results, key texts affecting program behavior are determined.
6. The log file processing method according to claim 5, characterized in that: Compare multiple correspondences, and based on the comparison results, determine that the key texts that affect program behavior include: In response to detecting that the first corresponding relationship v1 is equal to the second corresponding relationship v2, ∑p i (d i -s i )=0~(d i ≠s i =>p i =0), indicating the text feature d in the first correspondence i and the text feature s in the second correspondence i The corresponding text is not critical text that affects the behavior of the program; In response to detecting that the first corresponding relationship v1 is not equal to the second corresponding relationship v2, the p of the text features in the multiple corresponding relationships is obtained based on the principal component analysis strategy. i value, the largest p i The text corresponding to the value corresponding to the text feature is determined as the key text that affects the program behavior.
7. The log file processing method according to claim 1, characterized in that: After determining the key text that affects the program behavior based on the corresponding relationship, the method further includes: A target text feature is extracted from the key text, the target text feature is defined as a key influencing variable that affects program behavior, and the key influencing variable is sent to a user terminal.
8. A log file processing device, characterized in that: The device comprises: The log file acquisition module is used to obtain the log file of the program running link; A feature extraction module, used to extract a target text and program behavior features corresponding to the target text based on a log file of the program running link; A corresponding relationship determination module, used to determine the corresponding relationship between the target text and the program behavior feature corresponding to the target text based on a machine learning algorithm; The key text determination module is used to determine the key text that affects the program behavior based on the corresponding relationship.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Automatic feature extraction method for distributed logs
CN110427298A
Log file generation method and device, computer equipment and storage medium
CN111290919A
Method, equipment and device for predicting and monitoring running state of high-performance application
CN111352820A
Log processing method and device, electronic equipment and medium
CN114218160A
Software detection method and device, chip and computer readable storage medium
CN117992416A
Cited By
Method and apparatus for managing behavior of application, device, and medium
WO2026123265A1
