CN113055459B - Log delivery method and device, electronic equipment and storage medium - Google Patents

Log delivery method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113055459B
CN113055459B CN202110256443.7A CN202110256443A CN113055459B CN 113055459 B CN113055459 B CN 113055459B CN 202110256443 A CN202110256443 A CN 202110256443A CN 113055459 B CN113055459 B CN 113055459B
Authority
CN
China
Prior art keywords
log
delivery
target
type
weight value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110256443.7A
Other languages
Chinese (zh)
Other versions
CN113055459A (en
Inventor
王亦梁
韩直彬
彭瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202110256443.7A priority Critical patent/CN113055459B/en
Publication of CN113055459A publication Critical patent/CN113055459A/en
Application granted granted Critical
Publication of CN113055459B publication Critical patent/CN113055459B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2425Traffic characterised by specific attributes, e.g. priority or QoS for supporting services specification, e.g. SLA
    • H04L47/2433Allocation of priorities to traffic types

Abstract

The application discloses a log delivery method and device, electronic equipment and a storage medium, wherein the log delivery method comprises the following steps: under the condition that a log delivery operation is received, determining a delivery type associated with the log delivery operation; acquiring M log information from N log files according to the delivery type and a preset delivery rule to obtain log information to be delivered, wherein the N log files comprise log information of N service types in one-to-one correspondence, the preset delivery rule comprises an initial priority and an initial weight value corresponding to the N service types, N is an integer larger than 1, and M is a positive integer smaller than or equal to N; and sending a log delivery request to a server, wherein the log delivery request carries the information of the log to be delivered and the delivery type. Therefore, log information corresponding to important service types can be prevented from being omitted, and the effectiveness of the log information to be delivered is improved.

Description

Log delivery method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of data processing, in particular to a log delivery method and device, electronic equipment and a storage medium.
Background
The log can be used for recording important data such as user use records and state information under different service types of the application software, and is often used by maintenance personnel as an important basis for fault analysis in the later maintenance stage of the application software. However, when a certain application software contains more service types and the delivered log information has a certain upper limit of capacity, the log information corresponding to each service type is randomly combined, so that the log information corresponding to the important service type may be omitted, resulting in a problem that the validity of the delivered log information is not high.
Disclosure of Invention
The embodiment of the application aims to provide a log delivery method and device, electronic equipment and a storage medium, and the log delivery method and device can solve the problem that the validity of log information delivered by the existing log delivery mode is not high.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a log delivery method, where the method includes:
under the condition that a log delivery operation is received, determining a delivery type associated with the log delivery operation;
acquiring M log information from N log files according to the delivery type and a preset delivery rule to obtain log information to be delivered, wherein the N log files comprise log information of N service types in one-to-one correspondence, the preset delivery rule comprises an initial priority and an initial weight value corresponding to the N service types, N is an integer larger than 1, and M is a positive integer smaller than or equal to N;
and sending a log delivery request to a server, wherein the log delivery request carries the information of the log to be delivered and the delivery type.
In a second aspect, an embodiment of the present application provides a log delivery apparatus, including:
the determining module is used for determining a delivery type associated with the log delivery operation under the condition that the log delivery operation is received;
the obtaining module is used for obtaining M log information from N log files according to the delivery type and a preset delivery rule to obtain the log information to be delivered, wherein the N log files comprise log information of N service types in one-to-one correspondence, the preset delivery rule comprises initial priorities and initial weight values corresponding to the N service types, N is an integer larger than 1, and M is a positive integer smaller than or equal to N;
and the sending module is used for sending a log delivery request to the server, wherein the log delivery request carries the information of the log to be delivered and the delivery type.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect.
In the embodiment of the application, under the condition that a log delivery operation is received, determining a delivery type associated with the log delivery operation; acquiring M log information from N log files according to the delivery type and a preset delivery rule to obtain log information to be delivered, wherein the N log files comprise log information of N service types in one-to-one correspondence, the preset delivery rule comprises an initial priority and an initial weight value corresponding to the N service types, N is an integer larger than 1, and M is a positive integer smaller than or equal to N; and sending a log delivery request to a server, wherein the log delivery request carries the information of the log to be delivered and the delivery type. Therefore, M pieces of log information can be selectively acquired from the log information of N business types according to the delivery type and the preset delivery rule to obtain the log information to be delivered, thereby avoiding missing the log information corresponding to the important business types and improving the effectiveness of the log information to be delivered.
Drawings
FIG. 1 is a flowchart of a log delivery method according to an embodiment of the present disclosure;
FIG. 2 is a second flowchart of a log delivery method according to an embodiment of the present application;
FIG. 3 is a third flowchart of a log delivery method according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a log delivery apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/", and generally means that the former and latter related objects are in an "or" relationship.
The log delivery method provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof.
As described in the background art, when a certain application software contains more service types and the log information delivered each time has a certain upper limit of capacity, if the logs are delivered in a random combination manner, the log information corresponding to the important service types may be omitted. For example, assume that the random combination mode is play type log + payment type log + advertisement type log + network type log, and the upper limit of the capacity of each delivery log is 5M, when the play type log occupies 3M and the payment type log occupies 2M, other types of logs cannot be delivered. That is to say, if the user needs to troubleshoot the network problem of the application software, such as offline download failure, page loading failure, etc., the useful log information cannot be obtained from the delivered log information this time, so that the validity of the log information delivered by the existing log delivery method is not high, and this problem becomes a problem to be solved urgently. Referring to fig. 1, fig. 1 is a flowchart of a log delivery method provided in an embodiment of the present application. As shown in FIG. 1, the log delivery method includes:
step 101, determining the delivery type associated with the log delivery operation under the condition of receiving the log delivery operation.
It should be noted that the apparatus in the embodiment of the present application is an electronic device, and the electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), or the like.
The electronic equipment is provided with one or more application software and can record the log information of different service types of the same application software in the log files corresponding to the application software respectively. The user can input the log delivery operation in a log delivery operation input interface of the application software, and the electronic device can determine the delivery type associated with the log delivery operation when the log delivery operation input by the user is detected.
The delivery type can be determined according to whether a target service type is included in the log delivery operation input by the user, wherein the target service can be any one of the service types of the application software. For example, if the service types in a certain application software include a play type, a payment type, an advertisement type, and a network type, options of "play type", "payment type", "advertisement type", "network type", and "other" may be included in the log delivery operation input interface, and the user may select any one of these 4 service types as a target service type for log delivery, and may also select an "other" option. If the user selects the "other" option, it is a random combination of one or more of these 4 service types.
And 102, acquiring M log information from N log files according to the delivery type and a preset delivery rule to obtain the log information to be delivered.
For example, if the service type in a certain application software includes a play type, a payment type, an advertisement type, and a network type, the application software includes 4 log files, and the 4 log files are respectively used for recording log information corresponding to the play type, the payment type, the advertisement type, and the network type.
The preset delivery rule comprises initial priorities and initial weight values corresponding to N service types, wherein N is an integer greater than 1, and M is a positive integer less than or equal to N. The preset delivery rule may be preset in the local of the electronic device, or may be preset in a server corresponding to the application program. In an optional embodiment, the preset delivery rule may be set at the server side corresponding to the application program, so that when a developer of the application software needs to change a service type, or change an initial priority or an initial weight value corresponding to the service type, the application software of different electronic device sides can obtain the preset delivery rule through a mode of being actively issued by the server side, or through a mode of being actively requested by the electronic device side.
After determining the delivery type associated with the log delivery operation, the electronic device can acquire M log information from N log files according to the delivery type and a preset delivery rule. Specifically, the electronic device may re-determine a target priority and a target weight value corresponding to the N service types according to a delivery type associated with a log delivery operation and an initial priority and an initial weight value corresponding to the N service types in a preset delivery rule, sequentially obtain M pieces of log information from the N log files based on a high-to-low ordering of the target priority, during the process of obtaining the M pieces of log information, may determine a capacity proportion of the log information of each service type in the log information to be delivered based on the target weight values corresponding to the N service types, intercept the log information of a corresponding capacity according to the capacity proportion, intercept the log information of each service type based on an actual capacity of the log information of each service type, or combine the two to obtain the log information, which is not specifically limited in this application.
And 103, sending a log delivery request to the server, wherein the log delivery request carries the information of the log to be delivered and the delivery type.
After the electronic equipment acquires the log information to be delivered, a log delivery request is sent to the server, wherein the log delivery request can carry the log information to be delivered and the delivery type, and therefore developers of application software can analyze the log information to be delivered according to the log delivery request received by the server.
In this embodiment, M pieces of log information can be selectively obtained from the log information of N service types according to the delivery type and the preset delivery rule, so as to obtain the log information to be delivered, so that the log information to be delivered is obtained based on the delivery type and the preset delivery rule, thereby avoiding missing the log information corresponding to the important service type, and improving the effectiveness of the log information to be delivered.
Further, referring to fig. 2, fig. 2 is a second flowchart of a log delivery method provided in the embodiment of the present application. As shown in fig. 2, the step 102 of obtaining M log information from N log files according to the delivery type and the preset delivery rule to obtain the log information to be delivered includes:
step 201, determining target priority and target weight values corresponding to the N service types according to the delivery type and a preset delivery rule.
The target priority is used for indicating the priority of each service type for acquiring the log information, and the higher the priority of the service type is, the more first the log information of the service type is acquired; and acquiring the log information of the service type later the lower the priority of the service type is. The target priority can be the initial priority or a new priority determined according to the initial priority and the delivery type; the target weight value is used for indicating that the capacity of the log information allowed to be acquired by each service type accounts for the capacity threshold proportion of the whole to-be-delivered log information. The higher the weight value of the service type is, the larger the capacity of the log information allowed to be acquired by the service type is; the lower the weight value of a service type is, the smaller the capacity of the log information allowed to be acquired by the service type is. The target weight value may be an initial weight value or a new weight value determined according to a capacity threshold and a preset weight value.
Specifically, the electronic device may set different target priorities and target weight values according to different delivery types, for example, as a first implementation, the target priority may be an initial priority, and the target weight value may be a weight value determined according to a capacity threshold and a preset weight value; as a second embodiment, the target priority may be an initial priority, and the target weight value may be an initial weight value; as a third implementation manner, the target priority may be a priority determined according to the initial priority and the delivery type, and the target weight value may be an initial weight value; as a fourth embodiment, the target priority may be a priority determined according to the initial priority and the delivery type, and the target weight value may be a weight value determined according to a capacity threshold and a preset weight value.
Step 202, according to the sequence of the target priority from high to low, M pieces of log information are sequentially obtained from N log files, the total capacity of the M pieces of log information is smaller than or equal to a preset capacity threshold, and the ratio of the capacity corresponding to the M pieces of log information to the capacity threshold is smaller than or equal to a target weight value.
Wherein N is an integer greater than 1, and M is a positive integer less than or equal to N. The preset capacity threshold value refers to a capacity upper limit value of the log information to be delivered, which is preset in the electronic device. The total capacity of the M pieces of log information refers to the sum of capacities of log information obtained from M log files, the total capacity of the M pieces of log information needs to be less than or equal to the capacity threshold, and ratios of the capacities of the M pieces of log information to the capacity threshold respectively satisfy target weight values of corresponding service types. For example, it is assumed that the service type of a certain application software includes a play type, a payment type, an advertisement type, and a network type, and the target weight values of the 4 service types are 0.4, 0.3, 0.2, and 0.1, respectively, and the volume threshold of the log information to be delivered is 10M, then, the volume of the log information corresponding to the obtained play type needs to be less than or equal to 4M, the volume of the log information corresponding to the obtained payment type needs to be less than or equal to 3M, the volume of the log information corresponding to the obtained advertisement type needs to be less than or equal to 2M, and the volume of the log information corresponding to the obtained network type needs to be less than or equal to 1M. Therefore, the upper limit value of the capacity of the log information to be delivered can be ensured not to exceed 10M, and the proportion of the log information of each service type in the log information to be delivered can also be ensured to meet the target weight value.
After the target priority corresponding to the N service types is determined, M pieces of log information can be sequentially obtained from the N log files according to the sequence of the target priority from high to low. Specifically, in the process of obtaining M pieces of log information, a capacity ratio of the log information of each service type in the log information to be delivered may be determined based on a target weight value corresponding to the N service types, the log information of the corresponding capacity size may be intercepted according to the capacity ratio, the log information of each service type may also be intercepted based on an actual capacity size of the log information of each service type, and the two may also be combined to obtain the log information, which is not specifically limited in the present application. For example, assuming that the service types of a certain application software include a play type, a payment type, an advertisement type and a network type, the target weight values of the 4 service types are 0.4, 0.3, 0.2 and 0.1, respectively, and the capacity threshold of the log information to be delivered is 10M, the play type, the payment type, the advertisement type and the network type allow the acquired capacity of the log information to be 4M, 3M, 2M and 1M, respectively. When the log information corresponding to the capacity is intercepted according to the capacity proportion, the log information with the capacity of 4M, 3M, 2M and 1M can be respectively intercepted from the log information corresponding to the play type, the payment type, the advertisement type and the network type, and the log information to be delivered is obtained after splicing. In the process, if the actual capacity of some type of log information is smaller than the capacity value allowed to be obtained, all the log information of the type can be intercepted, and the residual excess capacity is directly ignored. If the actual capacity of some type of log information is greater than or equal to the capacity value allowed to be obtained, part of the log information of the type can be intercepted, and redundant log information is discarded. When the log information is intercepted based on the actual capacity of the log information of each service type, the log information corresponding to the service type can be intercepted in sequence from high to low according to the priority of each service type. For example, assuming that the actual capacities of the play type, the payment type, the advertisement type, and the network type log information are 5M, 4M, 5M, and 3M, respectively, and the target priorities of the play type, the payment type, the advertisement type, and the network type are sequentially lowered, the play type log information of 5M, the payment type log information of 4M, and the advertisement type log information of 1M may be directly intercepted, so as to form 10M log information to be posted. It should be noted that, when M pieces of log information are obtained, a header identifier and a trailer identifier may be added to each piece of obtained log information to distinguish the start and end positions of different pieces of log information.
And 203, splicing the M pieces of log information to obtain the log information to be delivered.
Splicing the M pieces of log information, namely sequentially acquiring the log information from high to low according to the target priority, and sequentially splicing the acquired log information until the M pieces of log information are spliced; or after M pieces of log information are acquired, the M pieces of log information can be spliced in a unified manner.
In this embodiment, M pieces of log information may be sequentially obtained from N log files according to the order of the target priority from high to low, so as to obtain the log information to be delivered, so that the log information to be delivered may be sorted according to the order of the target priority from high to low, and the log information with higher importance may be conveniently arranged at a position ahead in the log information to be delivered, thereby improving the efficiency and accuracy of log analysis.
Further, in step 201, determining target priorities and target weight values corresponding to the N service types according to the delivery types and the preset delivery rules includes:
under the condition that the log delivery operation comprises a selection operation of a target service type, determining a target priority according to the initial priority and the delivery type, and determining a target weight value according to a capacity threshold and a preset weight value;
and under the condition that the log delivery operation does not comprise a selection operation on a target service type, determining the initial priority as a target priority, and determining the initial weight value as a target weight value.
Specifically, the target service may be any one of service types of the application software. For example, assuming that the service types in a certain application software include a play type, a payment type, an advertisement type and a network type, options of "play type", "payment type", "advertisement type", "network type" and "other" may be included in the log delivery operation input interface, and a user may select any one of the 4 service types as a target service type for log delivery, and may also select an "other" option. If the user selects the "other" option, it is a random combination of one or more of these 4 service types.
In the case that the log delivery operation input by the user includes a selection operation on a target service type, such as a selection operation on a "play type", "payment type", "advertisement type", or "network type", a final target priority of each service type may be determined according to an initial priority of each service type and a priority of the target service type determined according to the delivery type, and a final target weight value of each service type may be determined according to a capacity threshold of the log information to be delivered and a preset weight value of the target service type.
When the log delivery operation input by the user does not include a selection operation on a target service type, such as a selection operation on "other", the initial priority of each service type can be directly determined as the final target priority of each service type, and the initial weight value of each service type can be directly determined as the final target weight value of each service type.
In this embodiment, the target priority and the target weight value corresponding to the N service types may be determined according to the delivery type and the preset delivery rule, so that the priority and the weight value of each service type may be flexibly set according to the different delivery types of the log information to be delivered, and the log information to be delivered is more suitable for the actual needs.
Further, determining the target priority according to the initial priority and the delivery type comprises the following steps:
determining the priority of the target service type as a first priority, and determining the priorities of a plurality of remaining service types except the target service type in the N service types as a second priority;
wherein the first priority is higher than the second priority, and the ordering of the plurality of remaining traffic types in the second priority is consistent with the ordering in the initial priority.
Specifically, continuing to explain based on the foregoing example, assuming that the initial priorities of the service types of a certain application software are sequentially the play type, the payment type, the advertisement type, and the network type from high to low, when the user selects the advertisement type as the target service type on the log delivery operation input interface, the priority of the advertisement type may be determined as the first priority, and the priorities of a plurality of remaining service types except the advertisement type among the N service types may be determined as the second priority, so that the target priorities of the service types may be obtained, and the target priorities are the advertisement type, the play type, the payment type, and the network type from high to low; when the user selects the payment type as the target service type on the log delivery operation input interface, the priority of the payment type can be determined as a first priority, and the priorities of a plurality of remaining service types except the payment type in the N service types are determined as a second priority, so that the target priority of each service type can be obtained, and the target priority is the payment type, the playing type, the advertisement type and the network type from high to low.
In this embodiment, the priority of the target service may be used as the first priority, so that the log information of the target service selected by the user may be set at the top of the log information to be delivered, which is convenient for a developer to analyze based on the log information of the target service, thereby improving the log analysis efficiency.
Further, determining a target weight value according to the capacity threshold and a preset weight value includes:
determining the residual capacity of the log information corresponding to the plurality of residual service types based on the capacity threshold and a preset weight value, wherein the preset weight value is a target weight value corresponding to the target service type;
and determining a target weight value of each remaining service type in the plurality of remaining service types based on the number and the remaining capacity of the plurality of remaining service types.
The preset weight value is a target weight value corresponding to the target service type, and may be set according to actual needs, such as 0.9, 0.8, 0.7, and the like. Under the condition that the log delivery operation comprises a selection operation of a target service type, the electronic setting can calculate the log information capacity of the target service and the residual capacity of the log information corresponding to a plurality of residual service types according to the capacity threshold and the target weight value corresponding to the target service type, and then determine the target weight value of each residual service type in the plurality of residual service types according to the quantity and the residual capacity of the plurality of residual service types.
Specifically, continuing to explain based on the foregoing example, assuming that the service type of a certain application software includes a play type, a payment type, an advertisement type, and a network type, the initial weight values of the 4 service types are 0.4, 0.3, 0.2, and 0.1, respectively, the capacity threshold value of the log information to be delivered is 10M, and the preset weight value of the target service type is set to 0.7, when the user selects the advertisement type as the target service type at the log delivery operation input interface, the log information capacity of the advertisement type may be calculated to be 0.7 × 10=7M, and the remaining capacities of the other remaining service types are 10M-7M =3m, at which time the remaining capacity of the 3M may be continuously allocated to obtain the target weight value of each remaining service type, for example, the remaining capacity of the 3M is averagely allocated to 3 remaining service types, and the target weight value of each remaining service type is 0.1; and determining a target weight value according to the proportion of each remaining service type in the initial weight values, wherein since the initial weight values of the play type, the payment type and the network type are 0.4, 0.3 and 0.1 respectively, the weight value proportion of the play type, the payment type and the network type is 4/8 × 0.3, 3/8 × 0.3 and 1/8 × 0.3 respectively. Of course, the target weight value of each remaining service type may also be obtained by confirming the weight value obtained in the above manner and the actual capacity of each log file.
In this embodiment, the weighted value of the target service may be preset, so that the proportion of the target service in the to-be-delivered log may be adjusted, log information of more target services may be obtained, and the validity of the log information may be improved. Meanwhile, partial residual capacity is reserved for other service types, and diversification of the service types is realized.
Further, determining a target weight value of each remaining service type of the plurality of remaining service types based on the number and the remaining capacity of the plurality of remaining service types includes:
acquiring the ith calculated capacity mean value aiming at a plurality of residual service types, wherein the ith calculated capacity mean value is determined according to the residual capacity after the ith-1 time of calculation and the number of the residual service types after the ith-1 time of calculation, and i is a positive integer less than or equal to the number of the plurality of residual service types;
acquiring the actual capacity of log information corresponding to the ith residual service type, wherein the ith residual service type is the ith residual service type which is arranged from high to low according to the second priority in the plurality of residual service types;
determining the ratio of the capacity mean value calculated at the ith time to the capacity threshold as a target weight value of the ith remaining service type under the condition that the actual capacity is greater than or equal to the capacity mean value calculated at the ith time;
and under the condition that the actual capacity is smaller than the capacity average value calculated at the ith time, determining the ratio of the actual capacity to the capacity threshold as a target weight value of the ith remaining service type.
In an embodiment, the target weight value of each remaining service may be determined according to an actual capacity of log information corresponding to the current remaining service type and a current capacity average value, where the current capacity average value is a ratio of the current remaining capacity to the number of the current remaining service types. When the actual capacity is larger than or equal to the current capacity average value, determining the ratio of the current capacity average value to the capacity threshold value as a target weight value of the current remaining service type; and when the actual capacity is smaller than the current capacity average value, determining the ratio of the actual capacity to the capacity threshold value as a target weight value of the current remaining service type. For each remaining traffic type, the target weight value itself may be determined in the manner described above.
It should be noted that, in the process of determining the target weight value of each remaining service type, the target priority of each remaining service type needs to be determined sequentially from high to low, so as to preferentially determine the service type with higher priority.
Continuing to explain based on the foregoing example, assuming that the target service type is an advertisement type, and the preset weight value of the target service type is 0.7, and the capacity threshold of the log to be delivered is 10M, the remaining service types include a play type, a payment type, and a network type, assuming that the target priorities of the 3 remaining service types are, in order from high to low, the play type, the payment type, and the network type, and assuming that the actual capacities of the log information corresponding to the play type, the payment type, and the network type are 2.5M, 0.8M, and 0.6M, respectively, after determining that the remaining capacity is 3M, the actual capacity of the log information corresponding to the play type may be compared with the average capacity calculated at the 1 st time based on the current number of the remaining service types and the current remaining capacity, and according to the target priorities of the 3 remaining service types, it is determined that the highest priority is the play type among the 3 remaining service types, at this time, and the actual capacity of the log information corresponding to the play type is compared with the average capacity calculated at the 1 st time, and since 2.5M is greater than 1M, the target priority of the play type that needs to be obtained, and at this time, the play type is 1m = 1M, and the target priority of the play type is 0.0.0.0.0.0/0.0.0. Furthermore, after the target weight value of the play type is calculated, the current number of the remaining service types is 2, and the current remaining capacity is 2M, so that the capacity average calculated 2 nd time is 1M, at this time, the actual capacity of the log information corresponding to the payment type is compared with the capacity average calculated 2 nd time, since 0.8M is less than 1M, the log information of the payment type that needs to be obtained is 0.8M, and at this time, the target weight value of the payment type is 0.8M/10m =0.08. And after the target weight value of the payment type is calculated, the current number of the remaining service types is 1, and the current remaining capacity is 1.2M, so that the 3 rd calculated capacity average value is 1.2M, at this time, the actual capacity of the log information corresponding to the network type is compared with the 3 rd calculated capacity average value, since 0.6M is less than 1.2M, the log information of the network type to be acquired is 0.6M, and at this time, the target weight value of the network type is 0.6M/1m =0.06.
In this embodiment, the target weight value of the current remaining service type may be determined according to the actual capacity of the log information corresponding to the current remaining service type and the current capacity average value, so that the to-be-delivered log information covers each service type, and the log information corresponding to each service type is closer to the capacity threshold.
Further, determining a target weight value according to the capacity threshold and a preset weight value includes:
determining residual weight values of a plurality of residual service types based on a preset weight value, wherein the preset weight value is a target weight value corresponding to a target service type;
and equally dividing the residual weight value according to the number of the plurality of residual service types to obtain a target weight value of each residual service type in the plurality of residual service types.
In an embodiment, the target weight value of each remaining service may be determined according to the number of remaining service types and a preset weight value. Specifically, based on the capacity threshold and the preset weight value, the remaining weight values of all the remaining service types are determined, then the ratio of the remaining weight values to the remaining service types is calculated, and the ratio is used as the target weight value of each remaining service type.
Continuing with the foregoing example, assuming that the target service type is an advertisement type and the preset weight value is 0.7, the remaining weight value is 1-0.7=0.3, and since the remaining service types include a play type, a payment type and a network type, the target weight values of the 3 remaining service types are 0.3/3=0.1, respectively.
In this embodiment, the target weight value of the current remaining service type may be determined according to the number of the remaining service types and the preset weight value, so as to simplify a calculation manner of the target weight value of each remaining service.
In an application example, referring to fig. 3, fig. 3 is a third flowchart of a log delivery method provided in an embodiment of the present application. As shown in FIG. 3, the log delivery method may include the steps of:
step 301, determining the delivery type associated with the log delivery operation under the condition of receiving the log delivery operation.
In this step, the log delivery operation input by the user may be obtained, and if the log delivery operation includes a selection operation on a target service type, step 302 is executed; if the log delivery operation does not include a select operation for the target traffic type, step 303 is performed.
It should be noted that, before this step, preset delivery rules of each service type, that is, an initial priority and an initial weight value corresponding to each service type, need to be preset on the server. Therefore, when receiving the log delivery operation input by the user, the electronic equipment can acquire the preset delivery rule in the server and determine the target priority and the target weight value corresponding to each service type according to the acquired delivery type and the preset delivery rule.
Step 302, determining a target priority according to the initial priority and the delivery type, and determining a target weight value according to a capacity threshold and a preset weight value.
In this step, if the log delivery operation input by the user includes the target service type, the priority of the target service may be used as the first priority, and the priorities of the remaining service types except the target service type are consistent with the initial priority. Meanwhile, the residual capacity of the residual service types can be determined according to the capacity threshold and the preset weight value of the target type, the current capacity average value is determined according to the current residual capacity and the number of the current residual service types, and if the actual capacity of the log information corresponding to the current residual service type is larger than or equal to the current capacity average value, the ratio of the current capacity average value to the capacity threshold is determined as the target weight value of the current residual service type; and if the actual capacity of the log information corresponding to the current remaining service type is smaller than the current capacity average value, determining the ratio of the actual capacity to the capacity threshold value as the target weight value of the current remaining service type. For each remaining service type, the target weight value of each remaining service type can be determined in turn according to the target priority of each remaining service type.
Step 303, determining the initial priority as a target priority, and determining the initial weight value as a target weight value.
In this step, if the log delivery operation input by the user does not include the target service type, the log information corresponding to each service type may be sequentially obtained according to the initial priority and the initial weight value of each service type.
And step 304, sequentially acquiring the log information corresponding to each service type by using the asynchronous thread according to the sequence of the target priority from high to low.
The asynchronous thread refers to other threads except for a main thread of the application program and is used for acquiring log information of the application program under different service type scenes. The asynchronous thread is used for acquiring the log information, so that the main thread is not blocked, and the normal use of the application program is ensured. In the process of obtaining the log information corresponding to each service type, the log information of corresponding capacity needs to be sequentially obtained according to the target weight value of each service type.
And 305, sequentially splicing the acquired log information to obtain the to-be-delivered log information, and sending the to-be-delivered log information to a server.
The electronic equipment sends a log delivery request to the server after acquiring the log information to be delivered, wherein the log delivery request can carry the log information to be delivered and the delivery type, so that developers of application software can analyze the log information to be delivered according to the log delivery request received by the server.
In the application example, the M pieces of log information can be selectively acquired from the log information of the N business types according to the delivery type and the preset delivery rule, and the log information to be delivered is acquired, so that the log information to be delivered is acquired based on the delivery type and the preset delivery rule, log information corresponding to important business types is prevented from being omitted, and the effectiveness of the log information to be delivered is improved.
It should be noted that, in the log delivery method provided in the embodiment of the present application, the execution main body may be a log delivery apparatus, or a control module in the log delivery apparatus for executing the log delivery method. In the embodiment of the present application, a log delivery method executed by a log delivery apparatus is taken as an example to describe the log delivery apparatus provided in the embodiment of the present application.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a log delivery apparatus provided in an embodiment of the present application. As shown in fig. 4, the log delivery apparatus 400 includes:
the determining module 401 is configured to determine, in the case that the log delivery operation is received, a delivery type associated with the log delivery operation;
an obtaining module 402, configured to obtain M pieces of log information from N log files according to a delivery type and a preset delivery rule, to obtain log information to be delivered, where the N log files include log information of N service types that correspond one to one, the preset delivery rule includes an initial priority and an initial weight value that correspond to the N service types, N is an integer greater than 1, and M is a positive integer less than or equal to N;
a sending module 403, configured to send a log delivery request to the server, where the log delivery request carries information of the log to be delivered and a delivery type.
Optionally, the obtaining module 402 includes:
the determining submodule is used for determining target priorities and target weight values corresponding to the N service types according to the delivery types and the preset delivery rules;
the acquisition submodule is used for sequentially acquiring M log information from the N log files according to the sequence of the target priority from high to low, the total capacity of the M log information is smaller than or equal to a preset capacity threshold, and the ratio of the capacity corresponding to the M log information to the capacity threshold is smaller than or equal to a target weight value;
the splicing submodule is used for splicing the M pieces of log information to obtain the log information to be delivered;
the target priority is an initial priority or a priority determined according to the initial priority and the delivery type; the target weight value is an initial weight value or a weight value determined according to a capacity threshold value and a preset weight value.
Optionally, a determination submodule comprising:
the first determining unit is used for determining a target priority according to the initial priority and the delivery type and determining a target weight value according to a capacity threshold and a preset weight value under the condition that the log delivery operation comprises a selection operation of a target service type;
and a second determining unit, configured to determine the initial priority as a target priority and determine the initial weight value as a target weight value in a case that the log delivery operation does not include a selection operation for a target service type.
Optionally, the first determining unit specifically includes:
determining the priority of the target service type as a first priority, and determining the priorities of a plurality of remaining service types except the target service type in the N service types as a second priority;
wherein the first priority is higher than the second priority, and the ordering of the plurality of remaining traffic types in the second priority is consistent with the ordering in the initial priority.
Optionally, the first determining unit specifically further includes:
determining the residual capacity of the log information corresponding to the plurality of residual service types based on the capacity threshold and a preset weight value, wherein the preset weight value is a target weight value corresponding to the target service type;
and determining a target weight value of each of the plurality of remaining service types based on the number and the remaining capacity of the plurality of remaining service types.
Optionally, the first determining unit specifically further includes:
acquiring the ith calculated capacity average value aiming at the plurality of residual service types, wherein the ith calculated capacity average value is determined according to the (i-1) th calculated residual capacity and the (i-1) th calculated residual service type number, and i is a positive integer less than or equal to the number of the plurality of residual service types;
acquiring the actual capacity of the log information corresponding to the ith residual service type, wherein the ith residual service type is the ith residual service type which is arranged from high to low in the plurality of residual service types according to the second priority;
determining the ratio of the capacity mean value calculated at the ith time to the capacity threshold as a target weight value of the ith remaining service type under the condition that the actual capacity is greater than or equal to the capacity mean value calculated at the ith time;
and under the condition that the actual capacity is smaller than the capacity average value calculated at the ith time, determining the ratio of the actual capacity to the capacity threshold as a target weight value of the ith remaining service type.
Optionally, the first determining unit specifically further includes:
determining residual weight values of a plurality of residual service types based on a preset weight value, wherein the preset weight value is a target weight value corresponding to a target service type;
and equally dividing the residual weight value according to the number of the plurality of residual service types to obtain a target weight value of each residual service type in the plurality of residual service types.
The log delivery device 400 in the embodiment of the application can selectively acquire the M pieces of log information from the log information of the N service types according to the delivery type and the preset delivery rule to acquire the log information to be delivered, so that the log information to be delivered is acquired based on the delivery type and the preset delivery rule, log information corresponding to important service types is prevented from being omitted, and the effectiveness of the log information to be delivered is improved.
The log delivery apparatus 400 in the embodiment of the present application may be an apparatus, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiment of the present application is not particularly limited.
The log delivery apparatus 400 in the embodiment of the present application may be an apparatus having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The log delivery apparatus 400 provided in this embodiment of the present application can implement each process implemented in the method embodiments of fig. 1 to fig. 3, and is not described here again to avoid repetition.
Optionally, as shown in fig. 5, an electronic device 500 is further provided in the embodiment of the present application, and includes a processor 501, a memory 502, and a program or an instruction stored in the memory 502 and capable of running on the processor 501, where the program or the instruction is executed by the processor 501 to implement each process of the log delivery method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic device and the non-mobile electronic device described above.
The embodiments of the present application further provide a readable storage medium, where a program or an instruction is stored, and when the program or the instruction is executed by a processor, the program or the instruction implements the processes of the log delivery method embodiment, and can achieve the same technical effects, and in order to avoid repetition, the detailed description is omitted here.
The processor is the processor in the electronic device in the above embodiment. Readable storage media include computer readable storage media such as Read-Only Memory (ROM), random Access Memory (RAM), magnetic or optical disk, and so on.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one of 8230, and" comprising 8230does not exclude the presence of additional like elements in a process, method, article, or apparatus comprising the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (9)

1. A log delivery method, comprising:
under the condition that a log delivery operation is received, determining a delivery type associated with the log delivery operation;
acquiring M log information from N log files according to the delivery type and a preset delivery rule to obtain the log information to be delivered, wherein the method comprises the following steps: determining target priorities and target weight values corresponding to the N service types according to the delivery types and preset delivery rules; acquiring M log information from N log files in sequence according to the sequence of the target priority from high to low, wherein the total capacity of the M log information is smaller than or equal to a preset capacity threshold, and the ratio of the capacity corresponding to the M log information to the capacity threshold is smaller than or equal to the target weight value; splicing the M log information to obtain the log information to be delivered; wherein, the target priority is an initial priority or a priority determined according to the initial priority and the delivery type; the target weight value is an initial weight value or a weight value determined according to the capacity threshold value and a preset weight value; the N log files comprise log information of N service types in one-to-one correspondence, the preset delivery rule comprises initial priorities and initial weight values corresponding to the N service types, N is an integer larger than 1, and M is a positive integer smaller than or equal to N;
and sending a log delivery request to a server, wherein the log delivery request carries the information of the log to be delivered and the delivery type.
2. The method according to claim 1, wherein said determining target priority and target weight values corresponding to the N service types according to the delivery type and a preset delivery rule comprises:
under the condition that the log delivery operation comprises a selection operation of a target service type, determining the target priority according to the initial priority and the delivery type, and determining the target weight value according to the capacity threshold and a preset weight value;
and in the case that the log delivery operation does not comprise a selection operation of a target service type, determining the initial priority as the target priority and determining the initial weight value as the target weight value.
3. The method of claim 2, wherein determining the target priority based on the initial priority and the delivery type comprises:
determining the priority of the target service type as a first priority, and determining the priorities of a plurality of remaining service types except the target service type in the N service types as a second priority;
wherein the first priority is higher than the second priority, and an ordering of the plurality of remaining traffic types in the second priority is consistent with an ordering in the initial priority.
4. The method of claim 2, wherein determining the target weight value according to the capacity threshold and a preset weight value comprises:
determining the residual capacity of the log information corresponding to a plurality of residual service types based on the capacity threshold and a preset weight value, wherein the preset weight value is a target weight value corresponding to the target service type, and the plurality of residual service types are other service types except the target service type in the N service types;
and determining a target weight value of each of the plurality of remaining service types based on the number of the plurality of remaining service types and the remaining capacity.
5. The method of claim 4, wherein the determining the target weight value for each of the plurality of remaining traffic types based on the number of the plurality of remaining traffic types and the remaining capacity comprises:
obtaining the ith calculated capacity average value aiming at the plurality of residual service types, wherein the ith calculated capacity average value is determined according to the residual capacity after the ith-1 time of calculation and the number of the residual service types after the ith-1 time of calculation, and i is a positive integer less than or equal to the number of the plurality of residual service types;
acquiring the actual capacity of log information corresponding to an ith residual service type, wherein the ith residual service type is an ith residual service type which is arranged from high to low in the plurality of residual service types according to a second priority;
determining a ratio of the ith calculated capacity mean value to the capacity threshold as a target weight value of the ith remaining service type when the actual capacity is greater than or equal to the ith calculated capacity mean value;
and under the condition that the actual capacity is smaller than the capacity average value calculated at the ith time, determining the ratio of the actual capacity to the capacity threshold as a target weight value of the ith remaining service type.
6. The method of claim 2, wherein the determining the target weight value according to the capacity threshold and a preset weight value comprises:
determining a remaining weight value of a plurality of remaining service types based on the preset weight value, wherein the preset weight value is a target weight value corresponding to the target service type, and the plurality of remaining service types are other service types except the target service type in the N service types;
and equally dividing the residual weight values according to the number of the plurality of residual service types to obtain a target weight value of each residual service type in the plurality of residual service types.
7. A log delivery apparatus, comprising:
the determining module is used for determining a delivery type associated with the log delivery operation under the condition that the log delivery operation is received;
the acquisition module is used for determining target priorities and target weight values corresponding to the N service types according to the delivery types and preset delivery rules; obtaining M log information from N log files according to the delivery type and a preset delivery rule to obtain the log information to be delivered, wherein the method comprises the following steps: according to the target priority from high to low, sequentially obtaining M log information from N log files, wherein the total capacity of the M log information is smaller than or equal to a preset capacity threshold value, and the ratio of the capacity corresponding to the M log information to the capacity threshold value is smaller than or equal to the target weight value; splicing the M log information to obtain the log information to be delivered; wherein, the target priority is an initial priority or a priority determined according to the initial priority and the delivery type; the target weight value is an initial weight value or a weight value determined according to the capacity threshold value and a preset weight value; the N log files comprise log information of N service types in one-to-one correspondence, the preset delivery rule comprises initial priorities and initial weight values corresponding to the N service types, N is an integer larger than 1, and M is a positive integer smaller than or equal to N;
and the sending module is used for sending a log delivery request to a server, wherein the log delivery request carries the information of the log to be delivered and the delivery type.
8. An electronic device comprising a processor, a memory, and a program or instructions stored on the memory and executable on the processor, the program or instructions when executed by the processor implementing the steps of the log delivery method of any of claims 1-6.
9. A readable storage medium, storing thereon a program or instructions which, when executed by a processor, implement the steps of the log delivery method of any of claims 1-6.
CN202110256443.7A 2021-03-09 2021-03-09 Log delivery method and device, electronic equipment and storage medium Active CN113055459B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110256443.7A CN113055459B (en) 2021-03-09 2021-03-09 Log delivery method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110256443.7A CN113055459B (en) 2021-03-09 2021-03-09 Log delivery method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113055459A CN113055459A (en) 2021-06-29
CN113055459B true CN113055459B (en) 2022-11-01

Family

ID=76510695

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110256443.7A Active CN113055459B (en) 2021-03-09 2021-03-09 Log delivery method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113055459B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105306277A (en) * 2015-11-19 2016-02-03 中国建设银行股份有限公司 Message scheduling method and message scheduling device for message queues

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111429163B (en) * 2019-01-10 2023-08-15 百度在线网络技术(北京)有限公司 Recommendation method and device for outdoor advertisement putting resources and computer equipment
CN110266514A (en) * 2019-05-15 2019-09-20 平安科技(深圳)有限公司 Journal obtaining method, device, terminal and storage medium
CN111010290B (en) * 2019-11-22 2022-11-29 泰康保险集团股份有限公司 Service log processing method and device, electronic equipment and storage medium
CN111190871A (en) * 2019-12-18 2020-05-22 中移(杭州)信息技术有限公司 Log generation method and device, computer equipment and storage medium
CN112217737B (en) * 2020-09-23 2022-07-29 北京邮电大学 Opportunistic network resource dynamic allocation method based on service priority

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105306277A (en) * 2015-11-19 2016-02-03 中国建设银行股份有限公司 Message scheduling method and message scheduling device for message queues

Also Published As

Publication number Publication date
CN113055459A (en) 2021-06-29

Similar Documents

Publication Publication Date Title
CN109104336B (en) Service request processing method and device, computer equipment and storage medium
CN109327353B (en) Service flow determination method and device and electronic equipment
CN110060139B (en) Accounting processing method and device
US20170185454A1 (en) Method and Electronic Device for Determining Resource Consumption of Task
CN108112038B (en) Method and device for controlling access flow
CN106713396A (en) Server scheduling method and system
CN108268296A (en) Loading method, the client and server of page layout
US20170308546A1 (en) File storage method and electronic device
CN115878394A (en) Memory test method and device, electronic equipment and storage medium
CN108632085B (en) Gray level user management method, device, platform and storage medium
CN113055459B (en) Log delivery method and device, electronic equipment and storage medium
CN113806594A (en) Business data processing method, device, equipment and storage medium based on decision tree
CN110365682B (en) Anti-cheating method and device
CN112256672A (en) Database change approval method and device
CN109542775B (en) Test script generation and execution method and device
WO2020052358A1 (en) Method and system for game data processing, server and computer readable storage medium
CN107193721B (en) Method and device for generating log
CN114995982A (en) Task processing method and device and storage medium
CN112269940A (en) Data processing method and device
CN111080309B (en) Data processing method, device and equipment for multiple objects or multiple models
CN114237910A (en) Client load balancing implementation method and device
CN114169451A (en) Behavior data classification processing method, device, equipment and storage medium
US11475383B2 (en) Operation defense method and device, apparatus, and computer-readable storage medium
CN110442501B (en) Method and device for simulating business abnormality and electronic equipment
CN114513686A (en) Method and device for determining video information and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant