A log file analysis method, device, medium and computer equipment
A technology of log files and analysis methods, applied in the field of data analysis, can solve problems such as low analysis efficiency and inability to ensure analysis accuracy
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0069] This embodiment provides a method for parsing log files, such as figure 1 shown, methods include:
[0070] S110, obtaining the target log file based on the file name of the target log file;
[0071] In order to realize the parsing of the log file, it is first necessary to obtain the target log file based on the file name of the target log file.
[0072] This application uses a pre-designed encapsulation function to encapsulate the overall parsing process, the encapsulation function is Defparse_log_file(file), the encapsulation function defines an acquisition function through the def keyword, the name of the acquisition function is parse_log_file, and the acquisition function has an input parameter file, file can represent a specific log file name.
[0073] Based on this, when the target log file needs to be obtained, assign the file name of the target log file to the input parameter file, that is, the target log file can be obtained based on the file name of the targe...
Embodiment 2
[0173] This embodiment provides an apparatus for parsing log files, such as figure 2 As shown, the device includes: an acquiring unit 21, a reading unit 22, a judging unit 23, an adding unit 24, an analyzing unit 25 and a printing unit 26; wherein,
[0174] an obtaining unit 21, configured to obtain the target log file based on the file name of the target log file;
[0175] The reading unit 22 polls the target log file. During the polling process, for the current line log, a read function is called to read the log content of the current line log, and the log of the current line log is read. The content is assigned to a preset line variable; the current line log is any line of log in the target log file;
[0176] Judging unit 23, for judging whether the value of the line variable is empty, if the value of the line variable is not empty, then match the start line log content of the target log file;
[0177] The adding unit 24 is configured to, if the log content of the start li...
Embodiment 3
[0281] This embodiment provides a computer device, such as image 3 As shown, it includes a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and running on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented:
[0282] Obtain the target log file based on the file name of the target log file;
[0283] Perform polling on the target log file, in the polling process, for the current line log, call the read function to read the log content of the current line log, and assign the log content of the current line log to a preset value The line variable; the current line log is any line log in the target log file;
[0284] Determine whether the value of the line variable is empty, if the value of the line variable is not empty, then match the log content of the start line of the target log file;
[0285] If the log content of the start line of the target log file is successfully matched, it is...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


