Log data statistical method and device, medium and electronic equipment

By flexibly combining the time information, process number, thread number and log level of large-scale logs, the problems of low efficiency and poor flexibility of log statistics in the existing technology are solved, and efficient and intelligent log data statistics are achieved.

CN119415574APending Publication Date: 2025-02-11CHINA FAW CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411379793.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The prior art is low efficiency and poor flexibility when analyzing and counting large-scale logs, making it difficult to quickly and reliably obtain the log data expected by staff.

Method used

By obtaining multiple logs to be counted, each log includes time information, process number, thread number and log level, and outputting data statistics results based on at least one of these information, to achieve flexible combination and statistics of large-scale logs.

Benefits of technology

It improves the efficiency of log data statistics, saves manpower, and has more intelligent and flexible statistical methods, making it easier for users to take timely measures based on statistical results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415574A_ABST
    Figure CN119415574A_ABST
Patent Text Reader

Abstract

The invention relates to a log data statistical method and device, a medium and electronic equipment. Relates to the field of data processing. The method comprises the steps of obtaining a plurality of logs to be counted, wherein each log to be counted comprises time information, a process number, a thread number and a log level; and according to at least one of the time information, the process number, the thread number and the log level, outputting a data statistical result of the plurality of logs to be counted. One or more of the time information, the process number, the thread number and the log level can be flexibly combined to serve as a statistical target of the to-be-counted log data for a large batch of to-be-counted logs, and the statistical target is consistent with a log data type expected by a user. Therefore, the data statistical results of the logs to be counted can be reliably, flexibly and rapidly output, the statistical efficiency is improved, manpower is saved, the statistical method is more intelligent and better in flexibility, and a user can conveniently take corresponding measures in time according to the statistical results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a log data statistics method, device, medium and electronic device. Background Art

[0002] Logs are generated by the vehicle computer system and are a way of recording data. They are used to record events, operations, system status or other important data. Logs can exist in many forms, including but not limited to text files, database records or special log management systems. Logs reflect the actual operation of the vehicle computer system and are an important basis for staff to troubleshoot and analyze attack sources in daily operation and maintenance. During the operation of the vehicle computer system, a large number of logs are usually generated. The logs usually include time information, log levels (such as information, warnings, errors), event descriptions, user information, and affected system components. Therefore, it is particularly important to quickly and reliably analyze and count large quantities of logs to obtain the log data expected by the staff. In related technologies, manual screening is usually used to analyze and count large quantities of logs, which has low statistical efficiency and poor flexibility. Summary of the invention

[0003] The purpose of the present disclosure is to provide a log data statistics method, device, medium and electronic device. The method can reliably count the data of a large number of logs, with high statistical efficiency and good flexibility, so that the staff can obtain the expected log data in time.

[0004] In order to achieve the above object, the present disclosure provides a log data statistics method, the method comprising:

[0005] Obtain multiple logs to be counted, each of which includes time information, process number, thread number and log level;

[0006] Output data statistics results of the multiple logs to be counted according to at least one of the time information, the process number, the thread number and the log level.

[0007] Optionally, obtaining multiple logs to be counted includes:

[0008] Get multiple logs to be filtered from a pre-defined folder;

[0009] For each of the plurality of logs to be filtered, a log to be filtered that meets a predetermined condition is determined as the log to be counted.

[0010] Optionally, the predetermined condition includes: the file name of the log to be filtered satisfies a predetermined naming rule.

[0011] Optionally, outputting the data statistics results of the plurality of logs to be counted according to at least one of the time information, the process number, the thread number and the log level includes:

[0012] According to a filtering instruction triggered by a user, at least one of the time information, the process number, the thread number and the log level is determined as a filtering condition;

[0013] Filter the multiple logs to be counted according to the filtering condition;

[0014] According to the file name, log tag and the filtering condition of each filtered log, the data statistical results of the multiple logs to be counted are output.

[0015] Optionally, outputting data statistics results of the plurality of logs to be counted according to the file name, log tag and the filtering condition of each filtered log includes:

[0016] The file name, log tag and the filtering condition of each filtered log are stored in a data table as the data statistics results of the multiple logs to be counted and output.

[0017] Optionally, the method further comprises:

[0018] In the case where the screening condition is a predetermined log level, for each of the multiple logs that meet the predetermined log level, determining a user name corresponding to the file name of the log;

[0019] For each user name among the multiple user names, determining whether the user name is in a predetermined user list;

[0020] If there is a user name that is not in the user list, a prompt message is generated and output according to the user name that is not in the user list and the file name of the corresponding log.

[0021] Optionally, the method further comprises:

[0022] In response to receiving an update instruction triggered by a user, a user name that is not in the user list is added to the predetermined user list, so that the user list is updated.

[0023] The present disclosure also provides a log data statistics device, the device comprising:

[0024] An acquisition module is configured to acquire a plurality of logs to be counted, each of which includes time information, a process number, a thread number and a log level;

[0025] The first output module is configured to output data statistical results of the multiple logs to be counted according to at least one of the time information, the process number, the thread number and the log level.

[0026] The present disclosure also provides a non-temporary computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above-mentioned log data statistics method are implemented.

[0027] The present disclosure also provides an electronic device, comprising:

[0028] a memory having a computer program stored thereon;

[0029] The processor is used to execute the computer program in the memory to implement the steps of the above-mentioned log data statistics method.

[0030] Through the above technical solution, multiple logs to be counted are obtained, each log to be counted includes time information, process number, thread number and log level, and data statistical results of multiple logs to be counted are output according to at least one of the time information, process number, thread number and log level. The process number, thread number and log level between different logs to be counted may be the same or different, and each of the same time, the same process number, the same thread number and the same log level may correspond to multiple logs to be counted. Therefore, for a large number of logs to be counted, one or more of the time information, process number, thread number and log level can be flexibly combined as the statistical target of multiple log data to be counted, and the statistical target is consistent with the type of log data expected by the user, so that according to at least one of the time information, process number, thread number and log level, the data statistical results of multiple logs to be counted can be reliably, flexibly and quickly output, which improves statistical efficiency, saves manpower, and the statistical method is more intelligent and more flexible, so that users can take corresponding measures in time according to the statistical results.

[0031] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0033] Figure 1 It is a schematic diagram showing an implementation environment according to an exemplary embodiment.

[0034] Figure 2 It is a flowchart of a log data statistics method provided by an exemplary embodiment.

[0035] Figure 3 It is a block diagram of a log data statistics device provided by an exemplary embodiment.

[0036] Figure 4 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0037] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0038] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.

[0039] Figure 1 1 is a schematic diagram of an implementation environment according to an exemplary embodiment. The implementation environment may include a first vehicle 110, a telematics service provider (TSP) cloud platform 140, and a data analysis platform 150. The first vehicle 110 and the TSP cloud platform 140, and the TSP cloud platform 140 and the data analysis platform 150 may communicate via various wired or wireless methods, such as but not limited to: 4G network, 5G network, WiFi, etc.

[0040] The first vehicle 110 sends the logs of daily working conditions to the TSP cloud platform 140 through its own telematics processor (T-BOX) for storage. After receiving the statistical instruction, the data analysis platform 150 obtains the logs from the TSP cloud platform 140. In one embodiment, the data analysis platform 150 and the TSP cloud platform 140 can be independent devices, such as servers. Figure 1 As shown. In other embodiments, the data analysis platform 150 can be integrated on the TSP cloud platform 140 in the form of software. After the data analysis platform 150 obtains the log, the log data statistics are performed through computer software. The log data statistics method provided in the present disclosure can be applied to the data analysis platform 150.

[0041] Figure 2 FIG. 1 is a flow chart of a log data statistics method provided by an exemplary embodiment. Figure 2 As shown, the method includes the following steps.

[0042] In step S101, a plurality of logs to be counted are obtained, each of which includes time information, a process number, a thread number and a log level.

[0043] The log to be counted is the log file before data statistics are collected. There can be multiple logs to be counted. Each log to be counted can include data such as time information, process number, thread number, log level, label, and event record information. Time information is used to represent the specific time when the log occurs. The process number is used to represent the process identifier of the log. The thread number is used to represent the thread identifier of the log. The log level is used to represent the importance of the log. The log level can include information level, error level, warning level, failure level, and debug level. The label is the identifier of the event recorded in the log.

[0044] Exemplarily, the content of the log to be counted may be (2024-07-02 16:15:20.905465 922963Itsync:[GPTP][16:15:20][INFO][CalRateDev:409][Slave][Update result][rateDev=0.994828,offset=52926646]). Among them, the time information is 2024-07-02 16:15:20.905465; the process number is 922; the thread number is 963; the log level is INFO; the label is tsync; and the event record information is [GPTP][16:15:20][INFO][CalRateDev:409][Slave][Update result][rateDev=0.994828,offset=52926646].

[0045] After obtaining multiple logs to be counted, the time information, process number, thread number and log level in each log to be counted can be obtained respectively as the data basis for subsequent data statistics.

[0046] In step S102, data statistics results of a plurality of logs to be counted are output according to at least one of time information, process number, thread number and log level.

[0047] There may be multiple logs to be counted at the same time, and the process number, thread number and log level of each log to be counted may be the same or different. There may be multiple logs to be counted for the same process number, and the time information, thread number and log level of each log to be counted may be the same or different. There may be multiple logs to be counted for the same thread number, and the time information, process number and log level of each log to be counted may be the same or different. There may be multiple logs to be counted for the same log level, and the time information, process number and thread number of each log to be counted may be the same or different. Thus, at least one of the time information, process number, thread number and log level can be used as the statistical target in the data statistics process, and by combining the time information, process number, thread number and log level, the data of multiple logs to be counted can be flexibly counted, thereby obtaining the data statistical results of multiple logs to be counted. The data statistical results are the data statistical results expected by the user. Exemplarily, in response to the statistical instruction triggered by the user, the data statistical results of multiple logs to be counted can be output according to at least one of the time information, process number, thread number and log level. Exemplarily, the statistical instruction may include at least one of time information, process number, thread number and log level.

[0048] For example, the statistical instruction may include a specified time period, and the data statistical results of multiple logs to be counted may be output according to the specified time period. Exemplarily, the statistical instruction may include a specified time period and a log level as an error level, and the data statistical results of multiple logs to be counted may be output according to the specified time period and the log level as an error level.

[0049] Through the above technical solution, multiple logs to be counted are obtained, each log to be counted includes time information, process number, thread number and log level, and data statistical results of multiple logs to be counted are output according to at least one of the time information, process number, thread number and log level. The process number, thread number and log level between different logs to be counted may be the same or different, and each of the same time, the same process number, the same thread number and the same log level may correspond to multiple logs to be counted. Therefore, for a large number of logs to be counted, one or more of the time information, process number, thread number and log level can be flexibly combined as the statistical target of multiple log data to be counted, and the statistical target is consistent with the type of log data expected by the user, so that according to at least one of the time information, process number, thread number and log level, the data statistical results of multiple logs to be counted can be reliably, flexibly and quickly output, which improves statistical efficiency, saves manpower, and the statistical method is more intelligent and more flexible, so that users can take corresponding measures in time according to the statistical results.

[0050] In yet another embodiment, the obtaining of multiple logs to be counted includes:

[0051] Get multiple logs to be filtered from a pre-defined folder;

[0052] For each of the multiple logs to be filtered, a log to be filtered that meets a predetermined condition is determined as a log to be counted.

[0053] The log to be filtered is an unfiltered log file. During the operation of the vehicle system, multiple logs (the size of each log is usually 30M) will be generated and stored in one or more folders. Exemplarily, the predetermined folder can be pre-specified by the user. For example, a folder selection dialog box can be displayed on the computer display, and the user can select a folder with the mouse.

[0054] Exemplarily, if the predetermined folder is in the form of a compressed package, the compressed package may be decompressed first.

[0055] There may be redundant data and erroneous data in the multiple logs to be screened, so the multiple logs to be screened need to be screened. For each of the multiple logs to be screened, the logs to be screened can be screened in combination with a predetermined condition, and the logs to be screened that meet the predetermined condition are determined as logs to be counted, thereby obtaining multiple logs to be counted.

[0056] In this embodiment, the obtained multiple logs to be screened are screened according to the predetermined conditions, and the logs to be screened that meet the conditions are used as logs to be counted. In this way, data noise, abnormal values ​​and duplicate data in the multiple logs to be screened can be reliably removed, the data quality and reliability are improved, and a reliable data basis is provided for log data statistics.

[0057] In yet another embodiment, the above-mentioned predetermined condition includes: the file name of the log to be filtered satisfies a predetermined naming rule.

[0058] The predetermined naming rule can be preset by the user, for example, it can be: log level-log label-thread number. For each of the multiple logs to be filtered, the log to be filtered that meets the predetermined file naming rule can be determined as the log to be counted; the log to be filtered that does not meet the predetermined file naming rule can be filtered. After obtaining multiple logs to be counted that meet the file naming rule, the time information, process number, thread number and log level in each log to be counted that meets the file naming rule can be obtained, so as to perform log data statistics.

[0059] In this embodiment, a predetermined file naming rule is used as a predetermined condition to screen a plurality of logs to be screened, and the obtained logs to be counted have high consistency and good accuracy.

[0060] In yet another embodiment, the outputting of data statistics results of a plurality of logs to be counted according to at least one of time information, process number, thread number and log level comprises:

[0061] According to the filtering instruction triggered by the user, at least one of the time information, the process number, the thread number and the log level is determined as a filtering condition;

[0062] Filter multiple logs to be counted according to the filtering conditions;

[0063] According to the file name, log tag and filtering condition of each filtered log, the data statistical results of multiple logs to be counted are output.

[0064] The filtering instruction may include filtering conditions, and the filtering instruction may be triggered by the user. Exemplarily, the output dialog box "Do you want to filter?" may be controlled on the computer display screen. The user may click the button "Yes" via the mouse or keyboard (e.g., the Enter key) to send the filtering instruction. The filtering conditions may be preset by the user, for example, a time selection dialog box, a process number selection dialog box, a thread number selection dialog box, and a log level selection dialog box may be displayed on the computer display screen, and the user may select at least one of the time, process number, thread number, and log level as the filtering condition via the mouse.

[0065] Exemplarily, the screening condition may be time information, for example. For each of the multiple logs to be counted, the logs whose time information is within the time specified by the user may be saved, and the logs whose time information is not within the time specified by the user may be filtered. According to the file name, log tag and time information of each filtered log, the data statistics results of the multiple logs to be counted are output. In this way, the log situation output within the user-specified time may be analyzed. For example, the number of logs corresponding to each type of log tag within the user-specified time may be further counted, so that the log output situation corresponding to each type of log tag within the user-specified time may be analyzed. For log tag types with a large number of logs, they occupy more storage, and users can take corresponding measures in time.

[0066] Exemplarily, the screening condition may be, for example, a process number. For each of the multiple logs to be counted, the logs whose process number is consistent with the process number specified by the user may be saved, and the logs whose process number is inconsistent with the process number specified by the user may be filtered. Then, according to the file name, log tag, and process number of each filtered log, the data statistics results of the multiple logs to be counted are output. In this way, the log situation output by each process in the multiple processes may be analyzed. For example, the number of logs corresponding to each type of process number may be further counted.

[0067] Exemplarily, the screening condition may be, for example, that the log level is equal to the error level. For each of the multiple logs to be counted, the logs with a log level of the error level may be saved, and the logs with a log level not of the error level may be filtered, and then, according to the file name, log tag, and log level of the error level of each filtered log, the data statistical results of the multiple logs to be counted may be output. In this way, the output of the logs with a log level of the error level may be analyzed.

[0068] Exemplarily, the thread number and the log level being an error level can also be used as screening conditions, and for each of the multiple logs to be counted, the log whose log level is an error level and whose thread number is consistent with the thread number specified by the user can be saved, and the data statistical results of the multiple logs to be counted are output according to the file name, log label, log level being an error level and thread number of each filtered log. In this way, the distribution of the number of thread numbers of various types in the logs with a log level of an error level can be analyzed.

[0069] Each log to be counted has a corresponding file name, and the file name can distinguish each log to be counted. According to the file name, log tag and filtering conditions of each filtered log, the data statistics results of multiple logs to be counted are output, which can enable users to intuitively understand the statistical type of this data statistics and the file type corresponding to the data statistical results, and facilitate users to quickly find the corresponding log according to the file name.

[0070] In another embodiment, the data statistics results of multiple logs to be counted are output according to the file name, log tag and filtering condition of each filtered log, including:

[0071] The file name, log tag and filtering condition of each filtered log are stored in a data table as the data statistical results of the multiple logs to be counted and output.

[0072] Exemplarily, for each of the multiple filtered logs, the file name of each filtered log, the corresponding log tag and the filtering condition can be directly stored in the data table as the data statistics results of the multiple logs to be counted, as shown in Table 1 below.

[0073] Table 1

[0074] Filters Log Tags File name Error Level tsync A Error Level tsync B Error Level tsync C Error Level tsync D Error Level tsync E Error Level tsync F

[0075] As shown in Table 1, the data statistical results of multiple logs to be counted in this statistical process include six logs. The data statistical results of this data indicate that there are a total of six logs with a log level of error, and each log is labeled tsync.

[0076] In yet another embodiment, the outputting of data statistics results of a plurality of logs to be counted according to the file name, log tag and filtering condition of each filtered log also includes:

[0077] According to the filtering instructions triggered by the user, determine the output rules of the data statistics results of multiple logs to be counted;

[0078] According to the determined output rule, at least one of the file name, log tag and screening condition of each filtered log is stored in the data table as the data statistical result of the multiple logs to be counted and output.

[0079] The filtering instruction triggered by the user may also include data statistical result output rules for multiple logs to be counted. The data statistical result output rule is a combination of the file name of the log, the log label and the filtering condition. For example, the output rule of the data statistical result may be to use the file name of each filtered log and the filtering condition as the data statistical result of multiple logs to be counted. For another example, the output rule of the data statistical result may also be to store the file name, log label, and filtering condition of each filtered log as the data statistical result of multiple logs to be counted in a data table and output it. For another example, the output rule of the data statistical result may also be to store the log label of each filtered log and the filtering condition as the data statistical result of multiple logs to be counted in a data table and output it.

[0080] The output rules of the data statistics results can be set by the user. For example, an output rule selection dialog box can be displayed on a computer display screen, and the user can select one or more of the log file name, log label, and filter condition by using the mouse.

[0081] Different output rules correspond to different data statistics results requirements of users. For example, if the screening condition is that the log level meets the error level, the screened logs require the user to further analyze and process such log files. Therefore, in order to enable users to quickly and accurately locate the log files that need to be processed, and to intuitively understand the log level in the log statistics results, users can determine the file name and screening conditions of the log as the output rules of the data statistics results, so that the file name of each filtered log and the screening conditions are stored in the data table as the data statistics results of multiple logs to be counted and output. In this way, the output data statistics results include the file name and log level of each log as the error level, so that users can intuitively and quickly understand the log level and find the logs that need to be processed.

[0082] In yet another embodiment, the above method further includes:

[0083] In the case where the screening condition is a predetermined log level, for each of the multiple logs that meet the predetermined log level, determining a user name corresponding to a file name of the log;

[0084] For each user name among the plurality of user names, determining whether the user name is in a predetermined user list;

[0085] If there is a user name that is not in the user directory, a prompt message is generated and output according to the user name that is not in the user directory and the file name of the corresponding log.

[0086] The predetermined log level can be preset by the user, for example, it can be a warning level. Each log to be counted has a corresponding user who is responsible for risk handling, so that corresponding measures can be taken in time when errors occur or risks exist. A user name can correspond to the file names of multiple logs. Exemplarily, the correspondence between the file name of the log and the user name can be preset, and the user name corresponding to the file name of the log can be found from the predetermined correspondence as the determined user name.

[0087] The predetermined user list may include multiple personnel names, and may include all personnel names with operation permissions. The predetermined user list may be increased or decreased by the designer according to the situation, thereby controlling the operation permissions.

[0088] If it is determined that there is a user name that is not in the user list, it indicates that the user corresponding to the log that meets the predetermined log level does not have the operation authority. Therefore, a prompt message can be generated and output based on the user name that is not in the user list and the file name of the corresponding log. For example, a pop-up message "User name: Zhang San; File name: Z; No operation authority" can be output on the display screen of the computer screen.

[0089] In this embodiment, the user corresponding to the log meeting the predetermined log level can be determined timely and accurately, and by judging whether the user name is in the predetermined user list, it can be quickly found whether the user corresponding to the log meeting the predetermined log level has the operation authority.

[0090] In yet another embodiment, the above method further includes:

[0091] In response to receiving an update instruction triggered by a user, a user name that is not in the user list is added to a predetermined user list, so that the user list is updated.

[0092] The update instruction can be triggered by the user. For example, a dialog box "Do you want to add the user name A1 that is not in the user list to the user list?" can be controlled to be output on the computer display screen. The user can click the button "Yes" through the mouse or keyboard (such as the Enter key) to send the update instruction. After receiving the update instruction, the user name that is not in the user list can be controlled to be added to the predetermined user list, so that the user list is updated.

[0093] In this embodiment, the user names that are not in the user list are added to the predetermined user list, so that the user list can be updated in time and the user has the operation authority, thereby improving the risk handling efficiency and security.

[0094] In yet another embodiment, the above method further includes:

[0095] In the case where the screening condition is a predetermined log level, for each of the multiple logs that meet the predetermined log level, determining a user name corresponding to a file name of the log;

[0096] For each user name among the plurality of user names, determining whether the user name is in a predetermined user list;

[0097] If there is a user name that is not in the user list, the permission level of the user name corresponding to the log level is found in the predetermined correspondence relationship as the permission level of the user name that is not in the user list;

[0098] If the authority level of the user name that is not in the user list is greater than or equal to the predetermined authority level threshold, the user name that is not in the user list is added to the predetermined user list to update the user list.

[0099] The predetermined log level can include multiple log levels, and different log levels correspond to different user name authority levels. After judging that there is a user name that is not in the user list, first the authority level (for example, it can be divided into one level, two levels and three levels) corresponding to the user name that is not in the user list can be determined, and then, it can be judged whether the user's authority level has the processing operation authority. In the case where the authority level of the user name that is not in the user list is greater than or equal to the predetermined level threshold, it can be considered that the authority level of the user name that is not in the user list is higher and has the processing operation authority, so the user name that is not in the user list can be added to the predetermined user list so that the user list is updated. In the case where the authority level of the user name that is not in the user list is less than the predetermined level threshold, it can be considered that the authority level of the user name that is not in the user list is lower and does not have the processing operation authority, so it can not be added to the predetermined user list. In this way, for the user name that is not in the user list, it can be reliably determined whether the user name has the operation authority and the specific operation authority level according to its corresponding log level, thereby, the predetermined user list is updated flexibly and intelligently.

[0100] Based on the same inventive concept, the present disclosure also provides a log data statistics device. Figure 3 FIG. 1 is a block diagram of a log data statistics device provided by an exemplary embodiment. Figure 3 As shown, the log data statistics device 600 includes an acquisition module 601 and a first output module 602 .

[0101] The acquisition module 601 is configured to acquire multiple logs to be counted, each of which includes time information, a process number, a thread number and a log level.

[0102] The first output module 602 is configured to output data statistics results of a plurality of logs to be counted according to at least one of time information, process number, thread number and log level.

[0103] Optionally, the acquisition module 601 includes an acquisition submodule and a first determination submodule.

[0104] The acquisition submodule is configured to acquire a plurality of logs to be filtered from a predetermined folder.

[0105] The first determining submodule is configured to determine, for each of the multiple logs to be filtered, a log to be filtered that meets a predetermined condition as a log to be counted.

[0106] Optionally, the predetermined condition includes: the file name of the log to be filtered satisfies a predetermined naming rule.

[0107] Optionally, the first output module 602 includes a second determination submodule, a screening submodule and an output submodule.

[0108] The second determining submodule is configured to determine at least one of time information, process number, thread number and log level as a filtering condition according to a filtering instruction triggered by a user.

[0109] The screening submodule is configured to screen multiple logs to be counted according to screening conditions.

[0110] The output submodule is configured to output data statistical results of multiple logs to be counted according to the file name, log tag and filtering condition of each filtered log.

[0111] Optionally, the output submodule is further configured as:

[0112] The file name, log tag and filtering condition of each filtered log are stored in a data table as the data statistics results of the multiple logs to be counted and output.

[0113] Optionally, the log data statistics device 600 further includes a determination module, a judgment module and a generation module.

[0114] The determination module is configured to determine, when the screening condition is a predetermined log level, for each of the multiple logs that meet the predetermined log level, a user name corresponding to the file name of the log.

[0115] The determination module is configured to determine, for each of the plurality of user names, whether the user name is in a predetermined user name list.

[0116] The generating module is configured to generate and output a prompt message according to the user name not in the user directory and the file name of the corresponding log if there is a user name not in the user directory.

[0117] Optionally, the log data statistics device 600 further includes an update module.

[0118] The updating module is configured to add the user names that are not in the user list to the predetermined user list in response to receiving the updating instruction triggered by the user, so that the user list is updated.

[0119] Through the above technical solution, multiple logs to be counted are obtained, each log to be counted includes time information, process number, thread number and log level, and data statistical results of multiple logs to be counted are output according to at least one of the time information, process number, thread number and log level. The process number, thread number and log level between different logs to be counted may be the same or different, and each of the same time, the same process number, the same thread number and the same log level may correspond to multiple logs to be counted. Therefore, for a large number of logs to be counted, one or more of the time information, process number, thread number and log level can be flexibly combined as the statistical target of multiple log data to be counted, and the statistical target is consistent with the type of log data expected by the user, so that according to at least one of the time information, process number, thread number and log level, the data statistical results of multiple logs to be counted can be reliably, flexibly and quickly output, which improves statistical efficiency, saves manpower, and the statistical method is more intelligent and more flexible, so that users can take corresponding measures in time according to the statistical results.

[0120] The present invention discloses a non-temporary computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps of the log data statistics method are implemented.

[0121] The present disclosure also provides an electronic device, comprising:

[0122] a memory having a computer program stored thereon;

[0123] The processor is used to execute the computer program in the memory to implement the steps of the above-mentioned log data statistics method.

[0124] Figure 4 1 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 1900 may be provided as a server. Figure 4 The electronic device 1900 includes a processor 1922, which may be one or more, and a memory 1932 for storing a computer program executable by the processor 1922. The computer program stored in the memory 1932 may include one or more modules each corresponding to a set of instructions. In addition, the processor 1922 may be configured to execute the computer program to perform the above-mentioned log data statistical method.

[0125] In addition, the electronic device 1900 may further include a power supply component 1926 and a communication component 1950, wherein the power supply component 1926 may be configured to perform power management of the electronic device 1900, and the communication component 1950 may be configured to implement communication, for example, wired or wireless communication, of the electronic device 1900. In addition, the electronic device 1900 may further include an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932.

[0126] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned log data statistics method are implemented. For example, the non-transitory computer-readable storage medium can be the above-mentioned memory 1932 including program instructions, and the above-mentioned program instructions can be executed by the processor 1922 of the electronic device 1900 to complete the above-mentioned log data statistics method.

[0127] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned log data statistics method when executed by the programmable device.

[0128] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0129] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0130] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A log data statistics method, characterized in that: The method comprises: Obtain multiple logs to be counted, each of which includes time information, process number, thread number and log level; Output data statistics results of the multiple logs to be counted according to at least one of the time information, the process number, the thread number and the log level.

2. The method according to claim 1, characterized in that: The obtaining of multiple logs to be counted includes: Get multiple logs to be filtered from a pre-defined folder; For each of the plurality of logs to be filtered, a log to be filtered that meets a predetermined condition is determined as the log to be counted.

3. The method according to claim 2, characterized in that The predetermined condition includes: the file name of the log to be filtered meets a predetermined naming rule.

4. The method according to claim 1, characterized in that The step of outputting the data statistics results of the plurality of logs to be counted according to at least one of the time information, the process number, the thread number, and the log level comprises: According to a filtering instruction triggered by a user, at least one of the time information, the process number, the thread number and the log level is determined as a filtering condition; Filter the multiple logs to be counted according to the filtering condition; According to the file name, log tag and the filtering condition of each filtered log, the data statistical results of the multiple logs to be counted are output.

5. The method according to claim 4, characterized in that Outputting the data statistics results of the plurality of logs to be counted according to the file name, log tag and the filtering condition of each filtered log includes: The file name, log tag and the filtering condition of each filtered log are stored in a data table as the data statistics results of the multiple logs to be counted and output.

6. The method according to claim 4, characterized in that The method further comprises: In the case where the screening condition is a predetermined log level, for each of the multiple logs that meet the predetermined log level, determining a user name corresponding to the file name of the log; For each user name among the multiple user names, determining whether the user name is in a predetermined user list; If there is a user name that is not in the user list, a prompt message is generated and output according to the user name that is not in the user list and the file name of the corresponding log.

7. The method according to claim 6, characterized in that The method further comprises: In response to receiving an update instruction triggered by a user, a user name that is not in the user list is added to the predetermined user list, so that the user list is updated.

8. A log data statistics device, characterized in that: The device comprises: An acquisition module is configured to acquire a plurality of logs to be counted, each of which includes time information, a process number, a thread number and a log level; The first output module is configured to output data statistical results of the multiple logs to be counted according to at least one of the time information, the process number, the thread number and the log level.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Log storage method and device

    CN105868340A

  • Data statistics method and device, equipment and medium

    CN115550157A

  • In-vehicle infotainment log recording method, in-vehicle infotainment log recording system and vehicle

    CN117931489A