Method and apparatus for managing and controlling log output, electronic device, and storage medium

By dynamically adjusting the log output level according to the log statistics of the business process in the log storage system, the burdens brought by log storage and key log storage vulnerabilities are solved, and efficient screening and importance of logs are achieved.

WO2025066402A1PCT designated stage expired Publication Date: 2025-04-03SHENZHEN TCL DIGITAL TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/103825
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-28
Filing Date
2024-07-05
Publication Date
2025-04-03

AI Technical Summary

Technical Problem

As the number of processes increases, logs are also increasing, bringing a burden to the storage of logs. The existing technology is prone to missing the storage of key logs, which is not conducive to the location of abnormal problems.

Method used

By detecting the target log generated by the target business process, obtaining its corresponding target output level, and determining the status identification information of the log based on this level. If the status identification information indicates that the log can be output, it is sent to the target write process and written to the target cache. The target output level is determined based on the log statistics, and the log statistics are counted on the historical logs through the acquisition time interval and the acquisition frequency.

Benefits of technology

While reducing the amount of cached log data, logs can be filtered, improving the importance of logs stored in the cache, and improving the accuracy of log output control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024103825_03042025_PF_FP_ABST
    Figure CN2024103825_03042025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in embodiments of the present application is a method for managing and controlling log output, comprising: if a target log generated by a target service process is detected, obtaining a target output level corresponding to the target service process; determining, according to the target output level, state identification information of the target log; and if the state identification information indicates that the target log may be outputted, sending the target log to a target write process, and by means of the target write process, writing the target log into a target cache. The importance of logs in a cache is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Log output control method, device, electronic device and storage medium

[0001] This application claims priority to Chinese patent application filed on September 28, 2023, with application number 202311295372.7 and application name “Log output control method, device, electronic device and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of air conditioning, and specifically to a log output control method, device, electronic device and storage medium, wherein the storage medium includes a computer-readable storage medium. Background Art

[0003] Logs are records of events generated by applications, system processes, etc. during runtime. They record time and business logic actions. Logs not only help detect the operating status of modules during the development phase, but also help identify the cause of any problems when system upgrade packages are upgraded to user machines. Technical issues

[0004] As the number of processes increases, so does the number of logs, placing a burden on log storage. Currently, a design controls log storage based on cache space to reduce the amount of log data stored in the cache. However, this approach can easily miss critical logs, hindering problem location when an exception occurs. Technical Solutions

[0005] Embodiments of the present application provide a log output control method, device, electronic device, and computer-readable storage medium, which can implement control over logs output to a cache. While reducing the amount of data required to cache logs, the logs can also be filtered, thereby increasing the importance of logs stored in the cache.

[0006] This embodiment of the present application provides a log output control method, including:

[0007] If a target log generated by a target business process is detected, obtaining a target output level corresponding to the target business process; and determining state identification information of the target log according to the target output level;

[0008] If the status identification information indicates that the target log can be output, the target log is sent to the target writing process, and the target log is written into the target cache through the target writing process;

[0009] Among them, the target output level is determined according to the log statistics of the target business process, and the log statistics are obtained by counting the historical logs generated by the target business process according to the collection duration interval and collection frequency, and the time interval corresponding to the collection frequency is less than the collection duration interval.

[0010] Accordingly, the embodiment of the present application further provides a log output control device, including:

[0011] An acquisition module, configured to acquire a target output level corresponding to a target business process if a target log generated by a target business process is detected;

[0012] a determination module, configured to determine the status identification information of the target log according to the target output level;

[0013] a control module configured to send the target log to a target writing process if the status identification information indicates that the target log can be output, and write the target log into a target cache through the target writing process;

[0014] Among them, the target output level is determined according to the log statistics of the target business process, and the log statistics are obtained by counting the historical logs generated by the target business process according to the collection duration interval and collection frequency, and the time interval corresponding to the collection frequency is less than the collection duration interval.

[0015] Optionally, in some embodiments of the present application, the device further includes an adjustment module, and the adjustment module includes:

[0016] an acquiring unit, configured to acquire historical logs generated by the target business process and acquire an initial output level corresponding to the target business process;

[0017] a statistical unit, configured to collect statistics on historical logs generated by the target business process according to a collection time interval and a collection frequency, and obtain at least two log statistics;

[0018] An adjusting unit is configured to adjust the initial output level according to the at least two log statistics to obtain a target output level.

[0019] In some embodiments of the present application, the adjustment unit includes:

[0020] a calculation subunit, configured to calculate, for the at least two log statistics, the number of log statistics exceeding a statistical threshold, and obtain a reference log number;

[0021] The first adjustment subunit is configured to increase the initial output level according to the number of reference logs to obtain a target output level. In some embodiments of the present application, the adjustment unit includes:

[0022] a determination subunit, configured to determine a log volume change trend of the at least two log statistics;

[0023] The second adjustment subunit is configured to increase the initial output level to obtain a target output level if the log volume change trend indicates a continuous increase.

[0024] In some embodiments of the present application, the statistical unit includes:

[0025] A first determining subunit is configured to determine a collection time window according to a collection duration interval;

[0026] a moving subunit, configured to move the acquisition time window according to a time interval corresponding to an acquisition frequency, to obtain at least two window positions corresponding to the acquisition time window;

[0027] The statistical subunit is used to obtain the window statistics of the historical log at each window position through the collection time window; the second determining subunit is used to use the window statistics as log statistics.

[0028] In some embodiments of the present application, the mobile subunit is specifically used to:

[0029] generating at least two collection time sub-windows corresponding to the historical log according to a time interval corresponding to the collection frequency, wherein the collection time window is obtained by combining at least two mutually adjacent collection time sub-windows;

[0030] Moving the acquisition time window according to the width of an acquisition time sub-window;

[0031] The window position is obtained based on the positions of the acquisition time window before and after the movement.

[0032] In some embodiments of the present application, the statistics subunit is specifically used to:

[0033] Perform statistics on the historical logs according to the collection time sub-window to obtain log sub-statistics;

[0034] For each window position, the log sub-statistics of at least two acquisition time sub-windows corresponding to the acquisition time window at the window position are summed to obtain the log statistic.

[0035] In some embodiments of the present application, the control module includes:

[0036] A first control unit is configured to obtain a blacklist of processes to be filtered and a blacklist of functional modules to be filtered if the status identification information indicates that the target log can be output;

[0037] The second control unit is used to send the target log to the target writing process and write the target log into the target cache through the target writing process if the target business process is not in the blacklist of processes to be filtered and the type of the target log is not in the blacklist of functional modules to be filtered.

[0038] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the computer program is executed by the processor, the steps in the above-mentioned log output control method are implemented.

[0039] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned log output control method are implemented.

[0040] In a fifth aspect, embodiments of the present application further provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described in the embodiments of the present application. Beneficial effects

[0041] In an embodiment of the present application, if a target log generated by a target business process is detected, a target output level corresponding to the target business process is obtained, and status identification information of the target log is determined according to the target output level. If the status identification information indicates that the target log can be output, the target log is sent to a target writing process, and the target log is written to a target cache through the target writing process; wherein, the target output level is determined according to the log statistics of the target business process, and the log statistics are obtained by statistically analyzing the historical logs generated by the target business process according to the collection duration interval and the collection frequency, and the time interval corresponding to the collection frequency is less than the collection duration interval.

[0042] Among them, the status identification information of the target log is determined by the target output level corresponding to the target business process, and the output of the target log to the target cache is controlled based on the status identification information, thereby realizing level-based management and control of the storage of logs in the cache. Compared with the control of log storage based on the remaining space of the cache in related technologies, the embodiment of the present application can reduce the amount of data of the logs that need to be cached, and can also filter the logs, thereby enhancing the importance of the logs stored in the cache.

[0043] Among them, the log statistics of the historical logs corresponding to the target business process are obtained by collecting time intervals and collection frequencies, which facilitates dynamic adjustment of the output level of the target log according to the log statistics, improves the accuracy of the target output level, and thus improves the accuracy of log output control.

[0044] Among them, since the time interval corresponding to the collection frequency is smaller than the collection time interval, when the log statistics are counted according to the collection time interval and the collection frequency, the log content with partial overlap in adjacent collection time intervals can achieve refined statistics of historical logs, thereby improving the accuracy of the target output level. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0046] FIG1 is a schematic diagram of a scenario of a log output control method provided in an embodiment of the present application;

[0047] FIG2 is a flow chart of a log output control method provided in an embodiment of the present application;

[0048] FIG3 is a schematic diagram of log statistics collection provided by an embodiment of the present application;

[0049] FIG4 is a log storage guide diagram in the prior art provided by an embodiment of the present application;

[0050] FIG5 is a storage guide diagram of an exportable target log provided by an embodiment of the present application;

[0051] FIG6 is a schematic diagram of the movement of the acquisition time window provided in an embodiment of the present application;

[0052] FIG7 is another schematic diagram of the movement of the acquisition time window provided in an embodiment of the present application;

[0053] FIG8 is another flow chart of the log output control method provided in an embodiment of the present application;

[0054] FIG9 is a schematic diagram of the structure of a log output control device provided in an embodiment of the present application;

[0055] FIG10 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. Modes for Carrying Out the Invention

[0056] The following will be combined with the drawings in this application to clearly and completely describe the technical solutions in this application. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.

[0057] The present invention provides a method, apparatus, electronic device, and computer-readable storage medium for managing and controlling log output. Specifically, the present invention provides a log output management apparatus applicable to electronic devices, including but not limited to televisions, cars, desktop computers, laptops, tablet computers, or mobile phones.

[0058] Please refer to FIG1 , which is a schematic diagram of a scenario in which a terminal device according to an embodiment of the present application executes the log output control method. The specific execution process of the terminal device executing the log output control method is as follows:

[0059] After detecting the target log generated by the target business process, the terminal device 10 obtains the target output level corresponding to the target business process, and determines the status identification information of the target log according to the target output level. If the status identification information indicates that the target log can be output, the target log is sent to the target writing process, and the target log is written to the target cache through the target writing process.

[0060] It should be noted that the target output level is determined based on the log statistics of the target business process. The log statistics are obtained by statistically analyzing the historical logs generated by the target business process according to the collection duration interval and collection frequency. The time interval corresponding to the collection frequency is less than the collection duration interval.

[0061] It can be understood that the embodiment of the present application determines the status identification information of the target log through the target output level corresponding to the target business process, and controls the output of the target log to the target cache based on the status identification information, thereby realizing level-based management and control of the storage of logs in the cache. Compared with the control of log storage based on the remaining space of the cache in the related art, the embodiment of the present application can reduce the amount of log data that needs to be cached while also filtering the logs, thereby enhancing the importance of the logs stored in the cache.

[0062] Among them, the log statistics of the historical logs corresponding to the target business process are obtained by collecting time intervals and collection frequencies, which facilitates dynamic adjustment of the output level of the target log according to the log statistics, improves the accuracy of the target output level, and thus improves the accuracy of log output control.

[0063] Among them, since the time interval corresponding to the collection frequency is smaller than the collection time interval, when the log statistics are counted according to the collection time interval and the collection frequency, the log content with partial overlap in adjacent collection time intervals can achieve refined statistics of historical logs, thereby improving the accuracy of the target output level.

[0064] It should be noted that the order of description of the following embodiments does not limit the priority order of the embodiments.

[0065] Please refer to Figure 2, which is a flow chart of the log output control method provided by an embodiment of the present application. The specific flow of the log output control method is as follows: 101. If a target log generated by a target business process is detected, the target output level corresponding to the target business process is obtained.

[0066] Among them, a process is an operation activity of a program in a computer on a certain data set. It is the basic unit for resource allocation and scheduling of the system and the foundation of the operating system structure.

[0067] It should be noted that a business process is a process based on the business type, including application processes and system processes. This business process is distinguished from the target write process described below. That is, in the embodiments of this application, this business process is a process other than the target write process. Accordingly, the target business process is the business process targeted by the embodiments of this application, that is, the target business process is one of the business processes.

[0068] A log is a record of events generated by applications, system processes, etc. during operation. It records the time and business logic actions, and can be used to trace and locate problems. Accordingly, in the embodiment of the present application, the target log is the log generated by the target business process after it is running.

[0069] It should be noted that the target output level is the current output level of the target business process, which is used to control the output of the target log. For example, if the target output level is higher than the preset reference level, the output of the target log is allowed, that is, the target log is allowed to be transmitted and stored in the cache.

[0070] It should be emphasized that in the embodiments of this application, the target output level is a dynamically adjusted level, for example, based on the historical log generation of the target business process. This dynamically adjusted target output level makes the storage of target logs more flexible and targeted, and level-based storage control can filter out target logs that do not meet the requirements, improving the accuracy of target log storage.

[0071] Accordingly, the historical logs generated by the target business process at historical times can be counted, and the target output level can be adjusted according to the statistical results. For example, the initial output level can be adjusted according to the statistical results to obtain the target output level. When the historical logs are counted, the historical logs can be collected based on the collection time interval to obtain multiple log statistics, and the initial output level can be adjusted based on the size of the log statistics. The collection time interval corresponds to a collection range. For example, each time the collection is performed at a fixed time interval, for example, the collection time interval is 10 seconds, and the log statistics within 10 seconds are collected each time. The log statistics include statistics on the number of log lines and statistics on the number of log bytes.

[0072] Accordingly, to improve the accuracy of initial output level adjustments, you can also control the frequency of log statistics collection to obtain more log statistics. For example, when collecting historical log statistics using a fixed collection duration, you can control the frequency of collection to achieve refined statistics of historical logs. For example, the collection frequency can be set to every two seconds, so that 10 seconds of log statistics are collected every two seconds.

[0073] That is, optionally, in some embodiments of the present application, the target output level is determined based on the log statistics of the target business process, and the log statistics are obtained by statistically analyzing the historical logs generated by the target business process according to the collection duration interval and collection frequency, and the time interval corresponding to the collection frequency is smaller than the collection duration interval.

[0074] Among them, the collection frequency is controlled by the collection frequency, so that the collection of partially overlapping historical logs is included in the two adjacent log statistics. For example, please refer to Figure 3, which is a schematic diagram of the log statistics collection provided by an embodiment of the present application. Among them, at the initial moment, the first statistics are performed on the historical logs within the range of 10 seconds, and the log workload within the range of 1-10 seconds is obtained. In the second statistics, the historical logs within the range of 3-12 seconds are counted, and the log workload within the range of 3-12 seconds is obtained. Among them, since the first and second statistics involve the collection of historical logs within the range of 3-10 seconds, the time span spanned by the log workload statistics is reduced, which helps to achieve refined statistics of historical logs.

[0075] 102. Determine status identification information of the target log according to the target output level.

[0076] It should be noted that the status identification information is the result of filtering and analyzing the target log based on the target output level, and is used to indicate the output status of the target log, wherein the output status includes two types: outputtable or non-outputtable.

[0077] For example, if the actual output level of the target business process is higher than or equal to the target output level, then the status identification information corresponding to the target log can be output; conversely, if the actual output level of the target business process is lower than the target output level, then the status identification information corresponding to the target log cannot be output. The actual output level corresponding to the target business process is configured based on the attributes of the target business process, including the business process type (such as a system process or an application process) or the functional module type corresponding to the process initiator. That is, the actual output level of the target business process is determined based on the process type of the target business process or the functional module that initiates the business process. The actual output levels corresponding to different functional module types or business process types can be predefined based on actual needs. Again, there is no limitation on how to determine the actual output level corresponding to the target business process and the specific level value.

[0078] By determining the state identification information corresponding to the target log, it is convenient to control the output of the target log based on the state indication information, that is, to control the storage of the target log in the cache.

[0079] 103. If the status identification information indicates that the target log can be output, the target log is sent to a target writing process, and the target log is written into a target cache through the target writing process.

[0080] It should be noted that the target writing process is specifically used to handle log caching. The target writing process (also known as the logd process) is a daemon process in the system, responsible for log printing and the core process for log reading and writing. The target writing process is used to receive output target logs and write them to the target cache.

[0081] Among them, in the embodiment of the present application, the cache is a cache for storing logs, and the cache can store various logs of the application process or system process after execution. For example, please refer to Figure 4, which is a log storage guide diagram in the prior art provided by the embodiment of the present application, wherein the log storage guide diagram shows that the first log L1 of the application layer (App+FrameWork layer) and the second log L2 of the system layer (Native+Hal layer) can be sent to the target writing process (logd process) P through the log interface function library (liblog.so) C, and written to the cache (logbuffer) B through the target writing process P. Among them, the first log L1 can be obtained by calling the interfaces Log.v(tag, msg), Log.d(tag, msg), Log.i(tag, msg), Log.w(tag, msg), and Log.e(tag, msg), and the second log L2 can be obtained by calling ALOGV(…), ALOGD(…), ALOGI(…), ALOGW(…), and ALOGE(…). Correspondingly, the interfaces corresponding to the first log L1 and the second log L2 will both call the log interface function library (liblog.so), and through the log interface function library (liblog.so), the first log L1 and the second log L2 will be sent to the target writing process (logd process) P through a socket connection.

[0082] The target cache is one of the above-mentioned caches. In the embodiment of the present application, the target cache refers to a cache for storing exportable target logs. For example, refer to FIG5 , which is a storage guide diagram of exportable target logs provided by the embodiment of the present application, wherein the exportable target log represented by the status identification information is sent to the target writing process (logd process) P through the log interface function library (liblog.so) C, and is written to the cache (logbuffer) B by the target writing process P.

[0083] It should be noted that, as shown in Figure 5 , the steps of detecting the generation of the target log, obtaining the target output level of the target business process, and determining the status identification information of the target log can be understood as being completed by the execution of the corresponding filter F. That is, filter F is configured in the log interface function library (liblog.so) C, and based on the execution of filter F, storage control of the target log generated by the target business process is implemented, that is, whether the target log is sent to the target writing process (logd process) is controlled.

[0084] In summary, the embodiment of the present application determines the status identification information of the target log through the target output level corresponding to the target business process, and controls the output of the target log to the target cache based on the status identification information, thereby realizing level-based management and control of the storage of logs in the cache. Compared with the control of log storage based on the remaining space of the cache in the related art, the embodiment of the present application can reduce the amount of data of the logs that need to be cached, and can also filter the logs, thereby enhancing the importance of the logs stored in the cache.

[0085] Among them, the log statistics of the historical logs corresponding to the target business process are obtained by collecting time intervals and collection frequencies, which facilitates dynamic adjustment of the output level of the target log according to the log statistics, improves the accuracy of the target output level, and thus improves the accuracy of log output control.

[0086] Among them, since the time interval corresponding to the collection frequency is smaller than the collection time interval, when the log statistics are counted according to the collection time interval and the collection frequency, the log content with partial overlap in adjacent collection time intervals can achieve refined statistics of historical logs, thereby improving the accuracy of the target output level.

[0087] Accordingly, in the embodiments of the present application, before obtaining the target output level of the target business process, it is necessary to first complete dynamic adjustment of the target output level, that is, to ensure that the obtained target output level is the dynamically adjusted output level. That is, optionally, in some embodiments of the present application, before the step of "obtaining the target output level corresponding to the target business process", the method further includes:

[0088] Obtaining historical logs generated by the target business process and obtaining an initial output level corresponding to the target business process; performing statistics on the historical logs generated by the target business process according to a collection time interval and a collection frequency to obtain at least two log statistics;

[0089] The initial output level is adjusted according to the at least two log statistics to obtain a target output level.

[0090] It should be noted that the collection time interval corresponds to a time range. For example, the collection time interval may be 10 seconds, that is, the collection time interval is used to collect statistics or historical logs within a 10-second time range.

[0091] It should be noted that the collection frequency controls the frequency of collection. For example, if the collection frequency is once every two seconds, historical logs within the collection duration range will be collected every two seconds. Accordingly, the duration interval corresponding to this collection frequency is two seconds. It is understood that log statistics not only reflect the amount of log data but also the frequency with which the target business process generates logs. For example, when the log statistics are greater than zero, the target business process is considered to have generated logs; otherwise, no logs are generated. By counting the logs generated and the logs not generated, the frequency of log generation by the target business process can be determined.

[0092] Among them, the initial output level is the original default output level, which can be obtained based on the unified configuration of each business process in the terminal, that is, the global output level for the global business process is configured. For each business process, the global output level is the initial output level of the business process.

[0093] Among them, the initial output level is adjusted through log statistics to obtain the target output level, which improves the accuracy of the target output level.

[0094] Optionally, the collection duration interval may correspond to a collection time window, and historical logs may be collected based on the collection time window. That is, optionally, in some embodiments of the present application, the step of "collecting statistics on the historical logs generated by the target business process according to the collection duration interval and the collection frequency to obtain at least two log statistics" includes:

[0095] Determine the collection time window according to the collection duration interval;

[0096] Moving the acquisition time window according to a time interval corresponding to an acquisition frequency to obtain at least two window positions corresponding to the acquisition time window;

[0097] Obtaining window statistics of the historical log at each window position through the acquisition time window;

[0098] The window statistics are used as log statistics.

[0099] It should be noted that the acquisition time window is a window with a time width, and the time width is the width of the acquisition duration interval, that is, the acquisition time window has the width of the acquisition duration interval.

[0100] The collection frequency can be understood as the movement frequency of the collection time window. That is, each time the collection time window moves, historical log statistics for a certain time interval at the corresponding location are collected. For example, if the collection frequency is every two seconds, the collection time window moves for a period of two seconds each time.

[0101] For example, refer to FIG6 , which is a schematic diagram of the movement of the acquisition time window provided in an embodiment of the present application, wherein the acquisition time window moves step by step according to the time interval. For example, the acquisition time window A moves from the first window position a to the second window position b, wherein the distance difference between the first window position a and the second window position b is the time interval. The position of each movement of the acquisition time window is counted to obtain log statistics, wherein the acquisition frequency realizes the control of the movement speed of the acquisition time window, that is, the control of the acquisition frequency of the log statistics is realized, which helps to realize the refined statistics of historical logs.

[0102] Optionally, in an embodiment of the present application, multiple collection time subwindows corresponding to the historical log can be generated according to the time interval corresponding to the collection frequency, and the collection time subwindows can constitute a collection time window. Accordingly, the collection time window can be moved based on the collection time subwindows. That is, optionally, in some embodiments of the present application, the step of "moving the collection time window according to the time interval corresponding to the collection frequency to obtain at least two window positions corresponding to the collection time window" includes:

[0103] generating at least two collection time sub-windows corresponding to the historical log according to a time interval corresponding to the collection frequency, wherein the collection time window is obtained by combining at least two mutually adjacent collection time sub-windows;

[0104] Moving the acquisition time window according to the width of an acquisition time sub-window;

[0105] The window position is obtained based on the positions of the acquisition time window before and after the movement.

[0106] It can be understood that the time width corresponding to each acquisition time sub-window is the same as the time interval of the acquisition frequency.

[0107] Among them, moving the acquisition time window according to the width of an acquisition time sub-window can be understood as: realizing the movement of the acquisition time window by sequentially adding and deleting acquisition time sub-windows. For example, please refer to Figure 7, which is another schematic diagram of the acquisition time window movement provided by an embodiment of the present application, wherein the acquisition time window is composed of multiple acquisition time sub-windows, and the acquisition time sub-window located on the far right is used as the first window, and the acquisition time sub-window located on the far left is used as the second window. The movement of the acquisition time window can be achieved by adding an acquisition time sub-window to the right of the first window and deleting the second window.

[0108] For example, in Figure 7, the acquisition time window consists of five acquisition time sub-windows (T1-T5), where the acquisition duration interval corresponding to the acquisition time window is 10 seconds, and the time interval corresponding to each acquisition duration sub-interval is 2 seconds. Accordingly, the movement of the acquisition time window can be achieved by deleting the acquisition time sub-window T1 in the acquisition time window and adding the acquisition time sub-window T6.

[0109] Among them, since the collection time window is composed of multiple collection time sub-windows, the log statistics can be obtained by calculating the sum of the log sub-statistics corresponding to each collection time sub-window, that is. Optionally, in some embodiments of the present application, the step of "obtaining the log statistics of the historical log at each window position through the collection time window" includes:

[0110] Perform statistics on the historical logs according to the collection time sub-window to obtain log sub-statistics;

[0111] For each window position, the log sub-statistics of at least two acquisition time sub-windows corresponding to the acquisition time window at the window position are summed to obtain the log statistic.

[0112] Among them, the log statistics are obtained by summing up the various log sub-statistics. In the embodiment of the present application, the collection time sub-window also corresponds to a time width, for example, a time length of 2 seconds. Accordingly, the log sub-statistics can be obtained by counting the log volume within the two seconds.

[0113] In the embodiment of the present application, the log sub-statistics can be obtained by counting the number of log lines (Lines) and the number of log bytes (Bytes).

[0114] Optionally, as target business processes are continuously generated and executed, target logs are continuously generated. Therefore, for the next target log to be generated, the target output level after the current dynamic adjustment can be dynamically adjusted again, and the output storage control of the next target log to be generated can be performed based on another output level obtained after the dynamic adjustment. The dynamic adjustment of the target output level after the current dynamic adjustment can be achieved by: obtaining the first time starting point of the acquisition time window when the target output level is determined, wherein the time end point of the acquisition time window at this time is the time when the target log is detected;

[0115] Determine the target time starting point according to the moving step length and the first time starting point;

[0116] Collect historical logs with the target time starting point as the new starting point of the collection time window to obtain new log statistics; if the log statistics exceed the statistics threshold, increase the current dynamically adjusted target output level to obtain another output level;

[0117] Output control is performed on the target log generated next time based on the other output level.

[0118] Among them, output control is: determining new status identification information, and determining whether to send the next target log generated to the target writing process based on the new status identification information.

[0119] That is, in the embodiment of the present application, when a new target log is generated, further adjustments can be made based on the target output level determined last time to obtain a new output level.

[0120] Optionally, in an embodiment of the present application, whether to adjust the initial output level may be determined based on whether the log statistics exceed a statistical threshold. That is, optionally, in some embodiments of the present application, the step of “adjusting the initial output level according to the at least two log statistics to obtain a target output level” includes:

[0121] For the at least two log statistics, calculate the number of log statistics that exceed the statistic threshold to obtain a reference log number;

[0122] The initial output level is increased according to the number of reference logs to obtain a target output level.

[0123] Among them, the number of reference logs is obtained by counting the number of log statistics that exceed the statistical threshold. The initial output level can be adjusted based on the number of reference logs. For example, each time the statistical threshold is exceeded, the initial output level can be increased once, that is, the initial output level is adjusted upward by the level of the reference log number.

[0124] Optionally, in an embodiment of the present application, in order to improve the accuracy of the target output level, the initial output level may be adjusted based on the changing trend of the log statistics. That is, optionally, in some embodiments of the present application, the step of “adjusting the initial output level according to the at least two log statistics to obtain the target output level” includes:

[0125] Determining a log volume change trend of the at least two log statistics;

[0126] If the log volume change trend indicates a continuous increase, the initial output level is increased to obtain the target output level. It is understandable that the log volume change trend reflects the change trend of the log statistics, for example, the log statistics show a trend of rising, falling, continuous rising, continuous falling, first rising and then falling, or first falling and then rising. Accordingly, for different log volume change trends, the adjustment range of the initial output level can be configured, for example, raising zero, one or two levels, or lowering zero, one or two levels, etc. Among them, adjusting the target output level according to the user log volume change trend also improves the accuracy of the target output level.

[0127] Optionally, in an embodiment of the present application, a blacklist may be configured to filter logs to improve the comprehensiveness of log management. That is, optionally, in some embodiments of the present application, the step of "if the status identification information indicates that the target log can be output, sending the target log to a target writing process, and writing the target log to a target cache through the target writing process" includes:

[0128] If the status identification information indicates that the target log can be output, obtaining a blacklist of processes to be filtered and a blacklist of functional modules to be filtered;

[0129] If the target business process is not in the blacklist of processes to be filtered, and the type of the target log is not in the blacklist of functional modules to be filtered, the target log is sent to the target writing process, and the target log is written to the target cache through the target writing process.

[0130] Among them, in the embodiment of the present application, the process type to be filtered is recorded in the blacklist of processes to be filtered, and the functional modules to be filtered are recorded in the blacklist of functional modules to be filtered. Through the blacklist, comprehensive filtering of logs is achieved. Among them, by maintaining the blacklist of processes to be filtered and the blacklist of functional modules to be filtered, accurate control of the target logs generated by the target business process can be achieved.

[0131] In this embodiment of the present application, whether the target business process is in the blacklist of processes to be filtered can be determined based on whether the identifier corresponding to the target business process is in the blacklist of processes to be filtered.

[0132] Among them, the functional module refers to the functional module corresponding to the target business process, for example, including music, video and other functional modules. Correspondingly, different functional modules correspond to different classes. The class is the reflection of the entity in the real world or the thinking world in the computer. It encapsulates the data and the operations on these data together to form a method body, such as class class name {}. Correspondingly, the class name can be used to represent the functional module to be configured for the blacklist of the function module to be filtered. Subsequently, the control of the log output can be achieved based on whether the class name corresponding to the target business process is in the blacklist of the function module to be filtered. In summary, the embodiment of the present application moves the collection time window by the time interval corresponding to the collection frequency, and when collecting historical logs through the moving collection time window, it realizes the collection or statistics of historical logs based on the collection frequency and through the collection time interval. Among them, by calculating the number of reference logs whose log statistics exceed the statistical threshold, and calculating the log quantity change trend, the initial output level is adjusted according to the number of reference logs and the log change trend to obtain the target output level, thereby improving the accuracy of the target output level.

[0133] Among them, by configuring the blacklist of processes to be filtered and the blacklist of functional modules to be filtered, the output control of target logs based on the blacklist is achieved, thereby improving the comprehensiveness of log control.

[0134] In the process of controlling the target log based on the target output level, the blacklist of processes to be filtered, and the blacklist of functional modules to be filtered, a corresponding order can be configured, and whether the target log meets the output conditions is judged in turn based on the order. For example, please refer to FIG8 , which is another flow chart of the log output control method provided in an embodiment of the present application, wherein the log output control method specifically includes:

[0135] 201. Obtain the target log generated by the target business process after it is started;

[0136] 202. Determine whether this is the first control. If so, execute step 203. Otherwise, execute step 205.

[0137] 203. Determine whether to load the configuration file. If so, execute step 204. Otherwise, execute step 206.

[0138] After loading the configuration file, configuration information is obtained, which includes an initial output level for a global business process, a blacklist of processes to be filtered, and a blacklist of functional modules to be filtered.

[0139] 204. Cache is a global configuration for the process;

[0140] That is, initially, the target log of the target business process needs to meet the initial output level, the blacklist of processes to be filtered, and the blacklist of functional modules to be filtered;

[0141] 205. Determine whether the actual output level of the target business process is higher than or equal to the preset output level. If so, execute step 206; otherwise, execute step 207.

[0142] The actual output level is determined based on the attributes of the target business process. The preset output level is a predefined level. In the embodiment of the present application, if the preset output level is met, it means that the target log is very important, that is, of high importance.

[0143] 206. Outputting the target log as status identification information, and sending the target log to a target writing process based on the status identification information, so that the target writing process writes the target log into a target cache;

[0144] 207. Determine whether the global configuration exists. If not, execute step 206. If so, execute step 208.

[0145] 208. Determine whether the log control switch is on. If not, execute step 206. If yes, execute step 209.

[0146] 209. Obtain a target output level, where the target output level is obtained based on statistics of historical logs of the target business process;

[0147] 210. Determine whether the target output level is higher than the actual output level. If so, execute step 211; if not, execute step 212.

[0148] 211. Use "unoutputtable" as the status indicator corresponding to the target log;

[0149] 212. Determine whether the target business process is included in the blacklist of processes to be filtered. If so, execute step 211; otherwise, execute step 213.

[0150] 213. Determine whether the number of log lines exceeds the statistical threshold. If so, execute step 214; otherwise, execute step 215. The number of log lines is obtained by counting the historical logs of the target business process in a certain time interval, for example, the number of log lines generated within 10 seconds.

[0151] 214. Improve the target output level and get a new target output level;

[0152] 215. Determine whether the number of log bytes exceeds the byte threshold. If so, execute step 214; otherwise, execute step 206. The number of log bytes is obtained by counting the historical logs of the target business process within a certain time interval, for example, the number of bytes of logs generated within 10 seconds.

[0153] It can be understood that by loading the configuration file during the first management and obtaining the global configuration, the global configuration can be used to implement the management of the logs generated by each business process, that is, the logs of each business process should meet the global configuration when stored.

[0154] The preset output level corresponds to the level of a very important log. By comparing the actual output level with the preset output level, a judgment is made as to whether the target log is very important. If it is judged to be very important, it can be directly stored in the cache. If the target log is judged to be not very important, a subsequent judgment can be made to determine whether the target log is important or not, thereby filtering the target log.

[0155] The log control switch corresponds to a switch state, indicating whether to compare the target output level, number of log lines, and number of bytes. If it is off, the target log is directly sent to the target writing process for caching according to the traditional process.

[0156] Among them, dynamic adjustment of the target output level is achieved by comparing the target output level, number of log lines, and number of bytes when the log control switch is turned on.

[0157] To facilitate better implementation of the log output control method of this application, this application also provides a log output control device based on the above log output control method. The meanings of the terms are the same as those in the above log output control method, and the specific implementation details can be referred to the description in the method embodiment.

[0158] Please refer to FIG9 , which is a schematic diagram of the structure of the log output control device provided in an embodiment of the present application, wherein the log output control device may be specifically as follows:

[0159] The acquisition module 301 is configured to acquire a target output level corresponding to a target business process if a target log generated by the target business process is detected;

[0160] A determination module 302 is configured to determine the status identification information of the target log according to the target output level;

[0161] The control module 303 is configured to send the target log to a target writing process if the status identification information indicates that the target log can be output, and write the target log into a target cache through the target writing process;

[0162] Among them, the target output level is determined according to the log statistics of the target business process, and the log statistics are obtained by counting the historical logs generated by the target business process according to the collection duration interval and collection frequency, and the time interval corresponding to the collection frequency is less than the collection duration interval.

[0163] Optionally, in some embodiments of the present application, the device further includes an adjustment module, and the adjustment module includes:

[0164] an acquiring unit, configured to acquire historical logs generated by the target business process and acquire an initial output level corresponding to the target business process;

[0165] a statistical unit, configured to collect statistics on historical logs generated by the target business process according to a collection time interval and a collection frequency, and obtain at least two log statistics;

[0166] An adjusting unit is configured to adjust the initial output level according to the at least two log statistics to obtain a target output level.

[0167] In some embodiments of the present application, the adjustment unit includes:

[0168] a calculation subunit, configured to calculate, for the at least two log statistics, the number of log statistics exceeding a statistical threshold, and obtain a reference log number;

[0169] The first adjustment subunit is configured to increase the initial output level according to the number of reference logs to obtain a target output level. In some embodiments of the present application, the adjustment unit includes:

[0170] a determination subunit, configured to determine a log volume change trend of the at least two log statistics;

[0171] The second adjustment subunit is configured to increase the initial output level to obtain a target output level if the log volume change trend indicates a continuous increase.

[0172] In some embodiments of the present application, the statistical unit includes:

[0173] A first determining subunit is configured to determine a collection time window according to a collection duration interval;

[0174] a moving subunit, configured to move the acquisition time window according to a time interval corresponding to an acquisition frequency, to obtain at least two window positions corresponding to the acquisition time window;

[0175] The statistical subunit is used to obtain the window statistics of the historical log at each window position through the collection time window; the second determining subunit is used to use the window statistics as log statistics.

[0176] In some embodiments of the present application, the mobile subunit is specifically used to:

[0177] generating at least two collection time sub-windows corresponding to the historical log according to a time interval corresponding to the collection frequency, wherein the collection time window is obtained by combining at least two mutually adjacent collection time sub-windows;

[0178] Moving the acquisition time window according to the width of an acquisition time sub-window;

[0179] The window position is obtained based on the positions of the acquisition time window before and after the movement.

[0180] In some embodiments of the present application, the statistics subunit is specifically used to:

[0181] Perform statistics on the historical logs according to the collection time sub-window to obtain log sub-statistics;

[0182] For each window position, the log sub-statistics of at least two acquisition time sub-windows corresponding to the acquisition time window at the window position are summed to obtain the log statistic.

[0183] In some embodiments of the present application, the control module 303 includes:

[0184] A first control unit is configured to obtain a blacklist of processes to be filtered and a blacklist of functional modules to be filtered if the status identification information indicates that the target log can be output;

[0185] The second control unit is used to send the target log to the target writing process and write the target log into the target cache through the target writing process if the target business process is not in the blacklist of processes to be filtered and the type of the target log is not in the blacklist of functional modules to be filtered.

[0186] In the embodiment of the present application, if the acquisition module 301 detects a target log generated by a target business process, it obtains the target output level corresponding to the target business process. Then, the determination module 302 determines the status identification information of the target log according to the target output level. Then, if the status identification information indicates that the target log can be output, the control module 303 sends the target log to the target writing process, and writes the target log to the target cache through the target writing process.

[0187] The target output level is determined based on the log statistics of the target business process. The log statistics are obtained by collecting historical logs generated by the target business process according to the collection duration interval and collection frequency. The duration interval corresponding to the collection frequency is less than the collection duration interval.

[0188] Among them, the embodiment of the present application determines the status identification information of the target log through the target output level corresponding to the target business process, and controls the output of the target log to the target cache based on the status identification information, thereby realizing level-based management and control of the storage of logs in the cache. Compared with the control of log storage based on the remaining space of the cache in related technologies, the embodiment of the present application can reduce the amount of data of the logs required to be cached, while also being able to filter the logs, thereby enhancing the importance of the logs stored in the cache.

[0189] Among them, the log statistics of the historical logs corresponding to the target business process are obtained by collecting time intervals and collection frequencies, which facilitates dynamic adjustment of the output level of the target log according to the log statistics, improves the accuracy of the target output level, and thus improves the accuracy of log output control.

[0190] Among them, since the time interval corresponding to the collection frequency is smaller than the collection time interval, when the log statistics are counted according to the collection time interval and the collection frequency, the log content with partial overlap in adjacent collection time intervals can achieve refined statistics of historical logs, thereby improving the accuracy of the target output level.

[0191] In addition, the present application also provides an electronic device, as shown in FIG10 , which shows a schematic structural diagram of the electronic device involved in the present application. Specifically:

[0192] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that the electronic device structure shown in FIG10 does not limit the electronic device and may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0193] Processor 401 is the control center of the electronic device, connecting the various parts of the entire electronic device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, processor 401 may include one or more processing cores; preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.

[0194] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0195] The electronic device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power log output control circuit, a power converter or inverter, a power status indicator, and other arbitrary components.

[0196] The electronic device may further include an input unit 404, which may be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more applications into the memory 402 in accordance with the following instructions, and the processor 401 will run the application stored in the memory 402, thereby implementing the steps in any log output control method provided in the embodiments of the present application.

[0197] In an embodiment of the present application, if a target log generated by a target business process is detected, a target output level corresponding to the target business process is obtained, and status identification information of the target log is determined according to the target output level. If the status identification information indicates that the target log can be output, the target log is sent to a target writing process, and the target log is written to a target cache through the target writing process; wherein, the target output level is determined according to the log statistics of the target business process, and the log statistics are obtained by statistically analyzing the historical logs generated by the target business process according to the collection duration interval and the collection frequency, and the time interval corresponding to the collection frequency is less than the collection duration interval.

[0198] Among them, the status identification information of the target log is determined by the target output level corresponding to the target business process, and the output of the target log to the target cache is controlled based on the status identification information, thereby realizing level-based management and control of the storage of logs in the cache. Compared with the control of log storage based on the remaining space of the cache in related technologies, the embodiment of the present application can reduce the amount of data of the logs that need to be cached, and can also filter the logs, thereby enhancing the importance of the logs stored in the cache.

[0199] Among them, the log statistics of the historical logs corresponding to the target business process are obtained by collecting time intervals and collection frequencies, which facilitates dynamic adjustment of the output level of the target log according to the log statistics, improves the accuracy of the target output level, and thus improves the accuracy of log output control.

[0200] Among them, since the time interval corresponding to the collection frequency is smaller than the collection time interval, when the log statistics are counted according to the collection time interval and the collection frequency, the log content with partial overlap in adjacent collection time intervals can achieve refined statistics of historical logs, thereby improving the accuracy of the target output level.

[0201] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.

[0202] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0203] To this end, the present application provides a computer-readable storage medium, on which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any log output control method provided in the present application.

[0204] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.

[0205] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0206] Since the instructions stored in the computer-readable storage medium can execute the steps in any log output control method provided in this application, the beneficial effects that can be achieved by any log output control method provided in this application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0207] The above is a detailed introduction to a log output control method, device, electronic device and computer-readable storage medium provided by this application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

[0208] It should be noted that in the specific implementation of this application, related data such as logs generated after the process runs and the amount of log data are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

Claims

1. A log output control method, wherein: include: If a target log generated by a target business process is detected, a target output level corresponding to the target business process is obtained; Determine the state identification information of the target log according to the target output level; If the status identification information indicates that the target log can be output, the target log is sent to the target writing process, and the target log is written into the target cache through the target writing process; Among them, the target output level is determined according to the log statistics of the target business process, and the log statistics are obtained by counting the historical logs generated by the target business process according to the collection duration interval and the collection frequency, and the time interval corresponding to the collection frequency is less than the collection duration interval.

2. The log output control method according to claim 1, wherein: Before obtaining the target output level corresponding to the target business process, the method further includes: Obtaining historical logs generated by the target business process, and obtaining an initial output level corresponding to the target business process; According to the collection time interval and the collection frequency, statistics are collected on the historical logs generated by the target business process to obtain at least two log statistics; The initial output level is adjusted according to the at least two log statistics to obtain a target output level.

3. The log output control method according to claim 2, wherein: The adjusting the initial output level according to the at least two log statistics to obtain a target output level includes: For the at least two log statistics, calculate the number of log statistics exceeding the statistic threshold to obtain the reference log number; The initial output level is increased according to the number of reference logs to obtain a target output level.

4. The log output control method according to claim 2, wherein: The adjusting the initial output level according to the at least two log statistics to obtain a target output level includes: Determining a log volume change trend of the at least two log statistics; If the log volume change trend indicates a continuous increase, the initial output level is increased to obtain a target output level.

5. The log output control method according to claim 2, wherein: The historical logs generated by the target business process are counted according to the collection time interval and the collection frequency to obtain at least two log statistics, including: Determine the collection time window according to the collection duration interval; The acquisition time window is moved according to the time interval corresponding to the acquisition frequency to obtain at least two window positions corresponding to the acquisition time window; Obtaining window statistics of the historical log at each window position through the acquisition time window; The window statistics are used as log statistics.

6. The log output control method according to claim 5, wherein: The step of moving the acquisition time window according to the time interval corresponding to the acquisition frequency to obtain at least two window positions corresponding to the acquisition time window includes: Generating at least two collection time sub-windows corresponding to the historical log according to the time interval corresponding to the collection frequency, wherein the collection time window is obtained by combining at least two mutually adjacent collection time sub-windows; Moving the acquisition time window according to the width of an acquisition time sub-window; The window position is obtained based on the position of the acquisition time window before and after the movement.

7. The log output control method according to claim 5, wherein: The obtaining of log statistics of the historical log at each window position through the acquisition time window includes: Perform statistics on the historical logs according to the collection time sub-window to obtain log sub-statistics; For each window position, the log sub-statistics of at least two collection time sub-windows corresponding to the collection time window at the window position are summed to obtain the log statistics.

8. The log output control method according to any one of claims 1 to 7, wherein: If the status identification information indicates that the target log can be output, the target log is sent to a target writing process, and the target log is written into a target cache through the target writing process, including: If the status identification information indicates that the target log can be output, a blacklist of processes to be filtered and a blacklist of functional modules to be filtered are obtained; If the target business process is not in the blacklist of processes to be filtered, and the type of the target log is not in the blacklist of functional modules to be filtered, the target log is sent to the target writing process, and the target log is written into the target cache through the target writing process.

9. The log output control method according to claim 7, wherein: If the status identification information indicates that the target log can be output, the target log is sent to the target writing process, and after the target log is written into the target cache through the target writing process, the method further includes: Acquire the first time starting point of the acquisition time window when the target output level is determined, wherein the time end point of the acquisition time window at this time is the moment when the target log is detected; Determine the target time starting point according to the moving step length and the first time starting point; Collect historical logs with the target time starting point as the new starting point of the collection time window to obtain new log statistics; If the log statistic exceeds the statistic threshold, the target output level after the current dynamic adjustment is increased to obtain another output level; The output of the target log generated next time is controlled based on the other output level.

10. The log output control method according to claim 1, wherein: The determining the state identification information of the target log according to the target output level includes: determining an actual output level according to the attributes of the target business process; If the actual output level of the target business process is higher than or equal to the target output level, the status identification information corresponding to the target log may be output; If the actual output level of the target business process is lower than the target output level, the status identification information corresponding to the target log cannot be output.

11. The log output control method according to claim 6, wherein: The step of moving the acquisition time window according to a width of an acquisition time sub-window comprises: The acquisition time window is composed of a plurality of acquisition time sub-windows; The acquisition time sub-window located at the far right is used as the first window, and the acquisition time sub-window located at the far left is used as the second window; A collection time sub-window is added to the right side of the first window, and the second window is deleted to obtain a collection time window at a new position, so as to realize the movement of the collection time window.

12. The log output control method according to claim 1, wherein: The log statistics include statistics of the number of log lines and statistics of the number of log bytes.

13. The log output control method according to claim 1, wherein: The target log is a log generated after the target business process is run, and the target business process includes at least one of an application process and a system process.

14. A log output control device, wherein: include: An acquisition module, configured to acquire a target output level corresponding to a target business process if a target log generated by a target business process is detected; A determination module, configured to determine the state identification information of the target log according to the target output level; A control module, configured to send the target log to a target writing process if the status identification information indicates that the target log can be output, and write the target log into a target cache through the target writing process; Among them, the target output level is determined according to the log statistics of the target business process, and the log statistics are obtained by counting the historical logs generated by the target business process according to the collection duration interval and the collection frequency, and the time interval corresponding to the collection frequency is less than the collection duration interval.

15. The log output control device according to claim 14, wherein: The log output control device includes an adjustment module, and the adjustment module includes: An acquisition unit, used to acquire the historical logs generated by the target business process, and to acquire the initial output level corresponding to the target business process; A statistical unit, configured to collect statistics on the historical logs generated by the target business process according to the collection time interval and the collection frequency, and obtain at least two log statistics; An adjusting unit is used to adjust the initial output level according to the at least two log statistics to obtain a target output level.

16. The log output control device according to claim 15, wherein: The adjustment unit comprises: A calculation subunit, configured to calculate the number of log statistics exceeding a statistical threshold for the at least two log statistics, and obtain a reference log number; The first adjustment subunit is used to increase the initial output level according to the number of reference logs to obtain a target output level.

17. The log output control device according to claim 15, wherein: The adjustment unit comprises: The determining subunit is used to determine the log volume change trend of the at least two log statistics; the second adjusting subunit is used to increase the initial output level to obtain the target output level if the log volume change trend indicates a continuous increase.

18. The log output control device according to claim 15, wherein: The statistical unit comprises: A first determining subunit is used to determine a collection time window according to a collection duration interval; The mobile subunit is used to move the acquisition time window according to the time interval corresponding to the acquisition frequency. Move to obtain at least two window positions corresponding to the acquisition time window; A statistical subunit, used for obtaining the window statistics of the historical log at each window position through the collection time window; The second determining subunit is configured to use the window statistics as log statistics.

19. An electronic device, wherein: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the log output control method according to any one of claims 1 to 13 are implemented.

20. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps in the log output control method according to any one of claims 1 to 13 are implemented.

Citation Information

Patent Citations

  • Log output management and control method and device, electronic equipment and storage medium

    CN117407240A

  • Log recording method and device, computer equipment and storage medium

    CN107678908A

  • Log processing method and device

    CN114817187A

  • Log analysis and management method, terminal and computer readable storage medium

    CN115858483A

  • Business logic debugging method and apparatus, device, and computer-readable storage medium

    WO2021179578A1