Log data processing method, system and equipment and storage medium
By segmenting and filtering log data and performing statistical analysis based on preset fields, the problem of low log processing efficiency in the existing technology is solved and rapid customized statistical analysis is achieved.
Patent Information
- Application Number
- CN202410933189.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-27
AI Technical Summary
Existing log processing methods cannot quickly perform customized data statistical analysis from log data, resulting in low processing efficiency.
By acquiring log data, the log data is segmented based on the segmentation identifier, multiple logs and multiple field information in each log are obtained, and filtering and statistics are performed based on the preset fields to generate statistical reports.
It implements customized statistical analysis of log data, improves processing efficiency, and can quickly generate statistical reports.
Smart Images

Figure CN118708632A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a log data processing method, system, device and storage medium. Background Art
[0002] Since log data includes a large amount of data, existing log processing methods cannot quickly perform customized data statistical analysis from log data according to needs, resulting in very cumbersome log processing and low processing efficiency. Summary of the invention
[0003] In view of this, in order to overcome at least one aspect of the above problems, an embodiment of the present invention proposes a log data processing method, comprising the following steps: Get log data; Segmenting the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log; Acquire multiple preset fields and corresponding information in each log to form a first sub-list, and form a list of multiple first sub-lists; Filtering the list according to the first preset field to obtain a plurality of second sub-lists, wherein each of the second sub-lists includes a plurality of first sub-lists and the information corresponding to the first preset field in the plurality of first sub-lists is the same; Data statistics are performed based on each of the second sub-lists and a statistical report is generated.
[0004] In some embodiments, segmenting the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log further includes: Segmenting the log data based on the first segmentation identifier to obtain multiple logs; Each log is segmented into fields based on the second segmentation identifier to obtain information of each field in each log.
[0005] In some embodiments, performing field segmentation on each log based on the second segmentation identifier to obtain information of each field in each log further includes: In response to the number of field information rows being greater than a preset value, information corresponding to the field is determined using a third segmentation identifier.
[0006] In some embodiments, obtaining a plurality of preset fields and corresponding information in each log to form a first sub-list, and forming a plurality of the first sub-lists into a list further includes: The ID field, creation time field, error definition field, reference code field, model field, serial number field, microcode version field, field replaceable unit field and corresponding information in each log are obtained to form a first sub-list, wherein the serial number field is the first preset field.
[0007] In some embodiments, performing data statistics based on each of the second sub-lists and generating a statistical report further includes: Obtaining a version reference file to determine a recommended version corresponding to each device model based on the version reference file; Based on the model field, the microcode version field and the corresponding information, it is determined whether the current version corresponds to the recommended version and a check result is generated.
[0008] In some embodiments, it also includes: The number of occurrences and the time of occurrence of multiple first error types are counted based on the information corresponding to the error definition field, and duplicate removal is performed based on the information corresponding to the reference code field.
[0009] In some embodiments, it also includes: Counting parameters corresponding to the second error type based on information corresponding to the error definition field; Temperature information is determined based on a parameter corresponding to the second error type.
[0010] Based on the same inventive concept, according to another aspect of the present invention, an embodiment of the present invention further provides a log data processing system, including: An acquisition module, configured to acquire log data; A segmentation module, configured to segment the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log; A processing module, configured to obtain a plurality of preset fields and corresponding information in each log to form a first sub-list, and form a list by combining a plurality of the first sub-lists; A screening module, configured to screen the list according to the first preset field to obtain a plurality of second sub-lists, wherein each of the second sub-lists includes a plurality of first sub-lists and the information corresponding to the first preset field in the plurality of first sub-lists is the same; A generating module is configured to perform data statistics based on each of the second sub-lists and generate a statistical report.
[0011] Based on the same inventive concept, according to another aspect of the present invention, an embodiment of the present invention further provides a computer device, including: at least one processor; and A memory, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the processor performs the steps of any one of the log data processing methods described above.
[0012] Based on the same inventive concept, according to another aspect of the present invention, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the log data processing methods described above are performed.
[0013] The present invention has one of the following beneficial technical effects: the solution proposed in the present invention segments the log data based on the segmentation identifier and filters it through preset fields, thereby being able to perform data statistics on the log data in a customized manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0015] Figure 1 A flow chart of a log data processing method provided by an embodiment of the present invention; Figure 2 A flowchart of a log data processing method provided by an embodiment of the present invention; Figure 3 A schematic diagram of the structure of a log data processing system provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention; Figure 5 A schematic diagram of the structure of a computer-readable storage medium provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0016] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0017] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.
[0018] In an embodiment of the present invention, iqyylog is a K1 Power minicomputer monitoring log file recorded by the HMC system.
[0019] HMC, Hardware Management Console is a hardware management console used to manage K1 Power minicomputers. The K1 Power minicomputer is a domestically produced minicomputer based on the POWER processor.
[0020] According to one aspect of the present invention, an embodiment of the present invention provides a log data processing method, such as Figure 1 As shown, it may include the steps of: S1, obtain log data; S2, segmenting the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log; S3, obtaining a plurality of preset fields and corresponding information in each log to form a first sub-list, and forming a list from a plurality of the first sub-lists; S4, filtering the list according to the first preset field to obtain a plurality of second sub-lists, wherein each of the second sub-lists includes a plurality of first sub-lists and information corresponding to the first preset field in the plurality of first sub-lists is the same; S5: Perform data statistics based on each of the second sub-lists and generate a statistical report.
[0021] The solution proposed in the present invention segments the log data based on the segmentation identifier and filters it through the preset fields, so that data statistics can be performed on the log data in a customized manner.
[0022] In some embodiments, segmenting the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log further includes: Segmenting the log data based on the first segmentation identifier to obtain multiple logs; Each log is segmented into fields based on the second segmentation identifier to obtain information of each field in each log.
[0023] In some embodiments, performing field segmentation on each log based on the second segmentation identifier to obtain information of each field in each log further includes: In response to the number of field information rows being greater than a preset value (eg, greater than 1), the information corresponding to the field is determined using a third segmentation identifier.
[0024] Specifically, Figure 2As shown, when text data (such as iqyylog text data) is segmented, it is first segmented according to the first segmentation identifier to obtain multiple logs, and then each log is segmented based on the second segmentation identifier to obtain information of each field of each log, and some special fields need to determine the corresponding information based on the third segmentation identifier.
[0025] For example, you can use the "W>errlPrintLog:" field as the first segmentation marker to obtain multiple logs (each log contains information of multiple fields), and then use double vertical lines as the second segmentation marker to segment each field information, and finally obtain the following information: |EntryId:0x53002182| |Createdat:09 / 03 / 202213:31:30| |EventSeverity:UnrecoverableError,LossofFunction| |ReferenceCode:BA155103| |ReportingMachineType:9009-42G| |ReportingSerialNumber:78F8BC0| |FWReleasedVer:IL950_099| |PrimarySystemReferenceCode| |-------------------------------------------------------------------| |SectionVersion:1| |Sub-sectiontype:0| |Createdby:A000| |SRCFormat:0x00| |SRCVersion:0x02| |VirtualProgressSRC:False| |I5 / OSServiceEventBit:False| |HypervisorDumpInitiated:False| |PowerControlNetFault:False| || |ValidWordCount:0x01| |ReferenceCode:BA155103| |HexWords2-5:00000000000000000000000000000000| |HexWords6-9:00000000000000000000000000000000| || |CalloutSection| || |AdditionalSections:Disabled| |CalloutCount:1| || |NormalHardwareFRU| |Priority:Mandatory,replaceallwiththistypeasaunit| |LocationCode:U78D2.001.JWA0448-P1-C3-T1| || Among them, since the |NormalHardwareFRU| field is a special field, its corresponding information is determined based on the third delimiter. For example, the third delimiter can be ||, so the information corresponding to the |NormalHardwareFRU| field is |Priority: Mandatory, replace all with this type as a unit| and |LocationCode: U78D2.001.JWA0448-P1-C3-T1|.
[0026] In some embodiments, obtaining a plurality of preset fields and corresponding information in each log to form a first sub-list, and forming a plurality of the first sub-lists into a list further includes: The ID field, creation time field, error definition field, reference code field, model field, serial number field, microcode version field, field replaceable unit field and corresponding information in each log are obtained to form a first sub-list, wherein the serial number field is the first preset field.
[0027] Specifically, Figure 2As shown, you can use a for loop to segment and filter the information values corresponding to the key fields in each log event log (segment_list). For example, you can filter the corresponding result fields such as "Entry Id" (ID field), "Createdat" (creation time field), "Event Severity" (error definition field), "Reference Code" (reference code field), "Reporting Machine Type" (model field), "Reporting Serial Number" (serial number field), "FW Released Ver" (microcode version field) and the entire "Primary System Reference Code" including the "FRU" field (field replaceable unit field) as elements to form a list (event_list), and then append the composed list as an element to the entire list (global_list).
[0028] Among them, since each event log does not necessarily contain all the field information that needs to be collected, the program will redefine the number of elements in the event_list list and set the elements to empty before using the for loop to process the event log.
[0029] When data analysis is required based on the serial number, each log with the same serial number can be filtered out from the list. For example, use a for loop to traverse the fifth element of the event_list sublist in the global_list list (global_list[i][4] Note: i is the i+1th element of global_list) to obtain the serial number set (sn_set). Use the sequence number as the keyword to filter the sequence number field of the event_list sublist in the global_list list, and generate the second sublist (XXXXXX_list) according to the sequence number. In this way, each log in the obtained second sublist belongs to the same sequence number.
[0030] Finally, statistical analysis is performed based on the data in the second sublist and a health check report is generated.
[0031] In some embodiments, performing data statistics based on each of the second sub-lists and generating a statistical report further includes: Obtaining a version reference file to determine a recommended version corresponding to each device model based on the version reference file; Based on the model field, the microcode version field and the corresponding information, it is determined whether the current version corresponds to the recommended version and a check result is generated.
[0032] Specifically, Figure 2 As shown, you can read the version upgrade suggestion file, enter the recommended microcode version for all device models corresponding to this quarter, and then compare it with the target device microcode version. If it does not match the recommended version, generate a suggestion for updating the microcode version. Finally, the microcode version check result shown in Table 1 is generated: Table 1
[0033] In some embodiments, the method further comprises: The number of occurrences and the time of occurrence of multiple first error types are counted based on the information corresponding to the error definition field, and duplicate removal is performed based on the information corresponding to the reference code field.
[0034] Specifically, the error definition field can include multiple error types. By matching the "Event Severity" column field information of each sublist event_list[3] in the second sublist (XXXXXXX_list), and counting the corresponding type of events according to the set statistical type, the "Reference Code" field is used for filtering and deduplication, and the first and most recent occurrence time is recorded, and the number of times is counted, such as counting Informational Event, PredictiveError, Critical Error, Unrecoverable Error, etc. Generate a corresponding table based on the statistical results, or fill in the statistical results of the three types of logs, "Predictive Error", "Critical Error", and "Unrecoverable Error" into the specified position of the report template. For example, the following Table 2 can be generated or filled in: Table 2
[0035] When obtaining all reference codes other than "Informational Event" type, you can use a for loop to traverse the list (XXXXXXX_list), and based on the "Event Severity" column field information in the sublist event_list[3] and the "Created at" (i.e., occurrence time) in event_list[1], filter the events that occurred within the last three months of log collection. Then, split the list into an "Informational Event" event type list (info_list) and three event type lists (noinfo_list) of PredictiveError, Critical Error, and Unrecoverable Error. At the same time, import the "Reference Code" in the sublist noinfo_list[4] into the reference code set (ref_set).
[0036] When counting the first and most recent occurrence time and number of occurrences of all non-"Informational Event" type reference codes, a nested for loop can be used to traverse the reference codes in the reference code set (ref_set) through the non-"Informational Event" event type list (noinfo_list) in turn, obtain the first and most recent occurrence time of each reference code event record in the reference code set (ref_set), count the number of times, and add the noinfo_list[7], i.e., the entire "Primary System Reference Code" information to generate a new list src_report_list (format: src_report_list["Event Type", "Reference Code", "First Occurrence", "Latest Occurrence", "Number of Occurrences", "Related Components"]). The list src_report_list generated for each reference code is appended as an element to all_src_report_list.
[0037] In some embodiments, it also includes: Counting parameters corresponding to the second error type based on information corresponding to the error definition field; Temperature information is determined based on a parameter corresponding to the second error type.
[0038] Specifically, you can get the temperature parameters by reading the "Informational Event" event type list (info_list), for example, get the "Current" part of the "Ambient" value data, and check whether the temperature in the past 7 days is between 19 and 28. If it is, output "normal", otherwise output "it is recommended to pay attention to the operating temperature of the device". Finally, the inspection results shown in Table 3 are generated: Table 3
[0039] When all information statistics are completed, the final inspection results can be generated, such as the following Table 4: Table 4
[0040] The solution proposed in the present invention segments the log data based on the segmentation identifier and filters it through the preset fields, so that data statistics can be performed on the log data in a customized manner.
[0041] Based on the same inventive concept, according to another aspect of the present invention, an embodiment of the present invention further provides a log data processing system 400, such as Figure 3 As shown, including: An acquisition module 401 is configured to acquire log data; A segmentation module 402 is configured to segment the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log; The processing module 403 is configured to obtain a plurality of preset fields and corresponding information in each log to form a first sub-list, and form a list by combining a plurality of the first sub-lists; A screening module 404 is configured to screen the list according to the first preset field to obtain a plurality of second sub-lists, wherein each of the second sub-lists includes a plurality of first sub-lists and the information corresponding to the first preset field in the plurality of first sub-lists is the same; The generating module 405 is configured to perform data statistics based on each of the second sub-lists and generate a statistical report.
[0042] Based on the same inventive concept, according to another aspect of the present invention, Figure 4 As shown, an embodiment of the present invention further provides a computer device 501, including: at least one processor 520; and The memory 510 stores a computer program 511 that can be run on the processor. When the processor 520 executes the program, the steps of any of the above log data processing methods are performed.
[0043] Based on the same inventive concept, according to another aspect of the present invention, Figure 5 As shown, an embodiment of the present invention further provides a computer-readable storage medium 601, which stores a computer program 610. When the computer program 610 is executed by a processor, the steps of any of the above log data processing methods are performed.
[0044] Finally, it should be noted that a person skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods.
[0045] Furthermore, it should be appreciated that the computer-readable storage medium (eg, memory) herein may be either volatile memory or nonvolatile memory, or may include both volatile memory and nonvolatile memory.
[0046] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.
[0047] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0048] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0049] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0050] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0051] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the above embodiments of the present invention, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A log data processing method, characterized in that: The following steps are involved: Get log data; Segmenting the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log; Acquire multiple preset fields and corresponding information in each log to form a first sub-list, and form a list of multiple first sub-lists; Filtering the list according to the first preset field to obtain a plurality of second sub-lists, wherein each of the second sub-lists includes a plurality of first sub-lists and the information corresponding to the first preset field in the plurality of first sub-lists is the same; Data statistics are performed based on each of the second sub-lists and a statistical report is generated.
2. The method according to claim 1, characterized in that Segmenting the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log further includes: Segmenting the log data based on the first segmentation identifier to obtain multiple logs; Each log is segmented into fields based on the second segmentation identifier to obtain information of each field in each log.
3. The method according to claim 2, characterized in that Performing field segmentation on each log based on the second segmentation identifier to obtain information of each field in each log further includes: In response to the number of field information rows being greater than a preset value, information corresponding to the field is determined using a third segmentation identifier.
4. The method according to claim 1, characterized in that Acquiring a plurality of preset fields and corresponding information in each log to form a first sub-list, and forming a list of a plurality of the first sub-lists, further includes: The ID field, creation time field, error definition field, reference code field, model field, serial number field, microcode version field, field replaceable unit field and corresponding information in each log are obtained to form a first sub-list, wherein the serial number field is the first preset field.
5. The method according to claim 4, characterized in that Performing data statistics based on each of the second sub-lists and generating a statistical report further includes: Obtaining a version reference file to determine a recommended version corresponding to each device model based on the version reference file; Based on the model field, the microcode version field and the corresponding information, it is determined whether the current version corresponds to the recommended version and a check result is generated.
6. The method according to claim 5, characterized in that Also includes: The number of occurrences and the time of occurrence of multiple first error types are counted based on the information corresponding to the error definition field, and duplicate removal is performed based on the information corresponding to the reference code field.
7. The method according to claim 5, characterized in that Also includes: Counting parameters corresponding to the second error type based on information corresponding to the error definition field; Temperature information is determined based on a parameter corresponding to the second error type.
8. A log data processing system, characterized in that: include: An acquisition module, configured to acquire log data; A segmentation module, configured to segment the log data based on the segmentation identifier to obtain multiple logs and information of multiple fields in each log; A processing module, configured to obtain a plurality of preset fields and corresponding information in each log to form a first sub-list, and form a list by combining a plurality of the first sub-lists; A screening module, configured to screen the list according to the first preset field to obtain a plurality of second sub-lists, wherein each of the second sub-lists includes a plurality of first sub-lists and the information corresponding to the first preset field in the plurality of first sub-lists is the same; A generating module is configured to perform data statistics based on each of the second sub-lists and generate a statistical report.
9. A computer device comprising: at least one processor; as well as A memory storing a computer program executable on the processor, wherein the processor executes the steps of the method according to any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are performed.
Citation Information
Patent Citations
Version upgrading method and electronic device
CN103731733A
Log management method and device, computer device and computer readable storage medium
CN109977089A
Data processing method and device
CN110209643A
Log analysis method and device
CN111475380A
Data extraction method and device, equipment and storage medium
CN116431698A
