Log collection method, device, equipment and computer-readable storage medium

By merging and processing log files of smart devices and terminals, it solves the problem of difficulty in quickly locating problems on the log management platform, improves the efficiency of problem locating and the readability of log files, and reduces storage space and costs.

CN115378802BActive Publication Date: 2024-08-30FONG CHAU (SINGAPORE) PTE LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211019410.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-24
Publication Date
2024-08-30
Estimated Expiration
2042-08-24

AI Technical Summary

Technical Problem

It is difficult for existing log management platforms to quickly locate problems with smart devices, mainly because the log files of smart devices and APPs are scattered, resulting in low problem location efficiency.

Method used

By receiving the retrieval instructions from the log management platform, we obtain and merge the log files of smart devices and terminals, form upload files in the order of log generation time, and detect and insert target log files that meet preset conditions to ensure file integrity and readability. properties, and finally upload the merged files to the log management platform.

Benefits of technology

It improves the speed and efficiency of problem locating on smart devices, enhances the readability of logs, ensures the integrity of log files, reduces the storage space occupied by smart devices, and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115378802B
    Figure CN115378802B
Patent Text Reader

Abstract

The present invention discloses a log collection method, device, equipment and computer-readable storage medium, which are applied to the field of software technology, including: receiving a retrieval instruction sent by a log management platform, obtaining a first log file related to a smart device stored locally according to the retrieval instruction; sending the retrieval instruction to the smart device; receiving a second log file sent by the smart device according to the retrieval instruction; when the second log file is received, merging the first log file and the second log file into an upload file in the order of log generation time. The present application obtains the first log file and the second log file using a terminal according to the retrieval instruction, and arranges them into an upload file in the order of log generation time. Compared with the prior art, the present invention uses the retrieval instruction received by the terminal to arrange and summarize the log files in the terminal and the smart device in chronological order, which increases the centralization of the log files, thereby reducing the difficulty of locating problems in the logs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software technology, and in particular to a log collection method, device, system and computer-readable storage medium. Background Art

[0002] As technology continues to develop, the Internet of Things is also developing. More and more IoT devices are scattered in different places indoors or outdoors to undertake various tasks, such as sweeping robots, rice cookers, smart desk lamps, smart speakers, etc. Among them, these smart devices undertake various tasks and realize various functions.

[0003] In the process of using smart devices, engineers often need to monitor the operating status of various smart devices, and the most effective way is to analyze the operating status of each smart device through the log files. The existing way to locate problems with smart devices is to determine the smart device and APP through device identification or user identification, and then through the link between the log management platform and APP or the log management platform and the device, the smart device and APP upload the relevant log files to the log management platform respectively, and finally locate the problems with the smart device. However, since the logs of smart devices and APPs obtained by the existing log management platform are relatively scattered, it is very difficult to locate problems with smart devices. Therefore, how to concentrate the log files uploaded by smart devices and APPs, increase the speed of locating problems, and improve the efficiency of log collection are technical problems to be solved by technical personnel in this field. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a log collection method, device, system and computer-readable storage medium, which solve the technical problem that the prior art cannot quickly locate the problem location.

[0005] In order to solve the above technical problems, the present invention provides a log collection method, comprising:

[0006] Receiving a retrieval instruction sent by the log management platform, and acquiring a first log file related to the smart device stored locally according to the retrieval instruction;

[0007] Sending the retrieval instruction to the smart device;

[0008] Receiving a second log file sent by the smart device according to the retrieval instruction;

[0009] When the second log file is received, the first log file and the second log file are merged into an upload file in the order of log generation time.

[0010] Optionally, after merging the first log file and the second log file into an upload file in the order of log generation time, the method further includes:

[0011] Detect whether there is a target log file that meets the preset insertion condition in the log file to be detected, and stop detecting until it is determined that the log file to be detected currently detected does not meet the preset insertion condition; wherein the log generation time of the log file to be detected is earlier than the first log file in the preset time period, and / or the log generation time is later than the last log file in the preset time period; wherein the retrieval instruction includes the preset time period;

[0012] When the target log file exists, the target log is inserted into the upload file in the order of log generation time.

[0013] Optionally, before detecting whether there is a target log file that meets a preset insertion condition in the log file to be detected, the method further includes:

[0014] Obtaining a first transaction identifier of the first log file, and / or obtaining a second transaction identifier of the last log file;

[0015] Correspondingly, detecting whether there is a target log file that meets the preset insertion condition in the log file to be detected, and stopping the detection when it is determined that the log file to be detected currently does not meet the preset insertion condition, includes:

[0016] Detecting whether there is a first target log file in the first file to be detected that is identical to the first transaction identifier and satisfies a preset insertion condition, and stopping the detection until it is determined that the first log file to be detected currently detected is different from the first transaction identifier; wherein the log generation time of the first file to be detected is earlier than the first log file in the preset time period;

[0017] and / or detecting whether there is a second target log file in the second file to be detected that is identical to the second transaction identifier and satisfies a preset insertion condition, and stopping the detection until it is determined that the second log file to be detected currently detected is different from the second transaction identifier; wherein the log generation time of the second file to be detected is later than the last log file in the preset time period;

[0018] The first target log file and / or the second target log file is used as the target log file.

[0019] Optionally, the log collection method further includes:

[0020] Detecting whether there is the uploaded file that has not yet been uploaded to the log management platform;

[0021] If it exists, the upload file is uploaded to the log management platform.

[0022] Optionally, after receiving the second log file sent by the smart device according to the retrieval instruction, the method further includes:

[0023] A successful reception instruction is sent to the smart device, so that the smart device deletes the stored second log file according to the successful reception instruction.

[0024] Optionally, obtaining a first log file related to the smart device and stored locally according to the retrieval instruction includes:

[0025] Receiving a device log file sent by the smart device at a preset period;

[0026] Aggregating the device log file and the log file related to the smart device in the terminal to form an aggregate log file;

[0027] The first log file is obtained from the aggregated log file.

[0028] The present invention also provides a log collection device, comprising:

[0029] A first log file acquisition module, configured to receive a retrieval instruction sent by the log management platform, and acquire a first log file related to the smart device stored locally according to the retrieval instruction;

[0030] A salvage instruction sending module, used to send the salvage instruction to the smart device;

[0031] A second log file acquisition module, used to receive a second log file sent by the smart device according to the retrieval instruction;

[0032] The collecting module is used to merge the first log file and the second log file into an upload file in the order of log generation time when the second log file is received.

[0033] The present invention also provides a log collection device, comprising:

[0034] Memory for storing computer programs;

[0035] A processor is used to implement the steps of the above-mentioned log collection method when executing the computer program.

[0036] The present invention also 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 of the log collection method are implemented.

[0037] It can be seen that the method receives a retrieval instruction sent by a log management platform, obtains a first log file related to the smart device stored locally according to the retrieval instruction; sends the retrieval instruction to the smart device; receives a second log file sent by the smart device according to the retrieval instruction; when the second log file is received, merges the first log file and the second log file into an upload file in the order of log generation time, and then transmits the upload file to the log management platform. Compared with the prior art in which the terminal and the smart device transmit the smart device-related log files to the log management platform respectively, and the log files related to the smart device in the terminal and the smart device cannot be associated, the log collection method of the present application is used to collect logs, which can ensure that the log files in the terminal and the smart device obtained according to the retrieval instruction are arranged in chronological order, so that the log management platform can quickly locate the location where the problem of the smart device occurs.

[0038] In addition, the present invention also provides a log collection device, equipment and computer-readable storage medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0040] Figure 1 A flow chart of a log collection method provided by an embodiment of the present invention;

[0041] Figure 2 A schematic diagram of the structure of a log collection device provided by an embodiment of the present invention;

[0042] Figure 3 A schematic diagram of the structure of a log collection device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0044] Please refer to Figure 1 , Figure 1A log collection method is provided in an embodiment of the present invention. The method may include:

[0045] S100, receiving a retrieval instruction sent by a log management platform, and acquiring a first log file related to a smart device stored locally according to the retrieval instruction.

[0046] This embodiment does not limit the specific type of the log management platform, as long as the log can be managed. For example, the log management platform can be VWware (VMware vRealize Log Insight, virtualized log management platform), Splunk log management platform with powerful hosting function, Pandora intelligent log management platform, etc. This embodiment does not limit the retrieval instruction either. For example, the retrieval instruction may include device identification, accountID (account name), time period, transaction type, page identification, log level, etc., wherein the device identification is used to determine the device, the accountID (account name) is used to determine the terminal, the time period is used to determine the time period for obtaining the log file, the page identification is used to determine the type of page obtained, and the log level is used to determine the level of the log. For example, the retrieval instruction is a log file related to the A smart device with the smart device identification "A", and the accountID (account name) is "Little Apple", and the time period is "July 24, 2022 5:00 to July 24, 13:00", and the log level is the third level. The execution subject of this embodiment is a terminal, for example, the terminal can be a mobile phone, a computer, a tablet, etc. This embodiment does not limit the type of smart device, as long as the smart device can be connected to the terminal. For example, the smart device can be a smart speaker, a sweeping robot, a smart light bulb, a smart rice cooker, etc.

[0047] S101, sending the retrieval instruction to the smart device.

[0048] This embodiment does not limit the timing of sending the retrieval instruction to the smart device. For example, when the terminal receives the retrieval instruction sent by the log management platform, the retrieval instruction is immediately sent to the smart device, or after obtaining the first locally stored log file according to the retrieval instruction, the retrieval instruction is sent to the smart device.

[0049] S102: Receive a second log file sent by the smart device according to the retrieval instruction.

[0050] This embodiment does not limit the content of the second log file obtained according to the retrieval instruction, as long as it is a log file obtained from the smart device according to the retrieval instruction. This embodiment does not limit the action performed when the second log file does not exist in the smart device. For example, when the second log file does not exist in the smart device, the smart device will directly send a second log file containing no content to the corresponding terminal, and the terminal can receive the second log file containing no content sent by the smart device; or when receiving a prompt message from the smart device that the second log file does not exist, the first log file is directly merged in the order of log generation time, or when the second log file does not exist in the smart device, after the terminal sends the retrieval instruction to the smart device, if the second log file is not received within the preset time threshold, the first log file obtained is directly merged in the order of log generation time.

[0051] S103: When the second log file is received, the first log file and the second log file are merged into an upload file in the order of log generation time.

[0052] This embodiment does not limit the specific process of merging the first log file and the second log file in the order of log generation time, as long as the first log file and the second log file can be merged in the order of log generation time. For example, the logs contained in the first log file are inserted into the second log file one by one, or after the first log files are merged in the time sequence, the logs contained in the second log file are inserted into the first log file one by one.

[0053] Based on the above implementation scheme, the embodiment of the present invention obtains the first log file that complies with the retrieval instruction from the local storage of the terminal according to the retrieval instruction issued by the log management platform, and sends the retrieval instruction to the smart device, thereby obtaining the second log file related to the smart device from the smart device, and further merges the first log file and the second file in the order of log generation time to merge into an uploaded file. Compared with the prior art that uploads the logs of the smart device and the local logs of the terminal to the log management platform respectively without any processing, and then analyzes the log files, the embodiment of the present invention merges the log files that comply with the retrieval instruction in the terminal and the smart device in the order of the day generation time through the terminal, so that the logs of the terminal and the smart device can be arranged in chronological order after being merged, which increases the readability of the logs and makes it faster to locate device problems.

[0054] Based on the above embodiment, further, in order to ensure the integrity of the same associated log file, after merging the first log file and the second log file into an uploaded file in the order of log generation time, the method further includes:

[0055] Detect whether there is a target log file that meets the preset insertion condition in the log file to be detected, and stop detecting until it is determined that the log file to be detected currently detected does not meet the preset insertion condition; wherein the log generation time of the log file to be detected is earlier than the first log file in the preset time period, and / or the log generation time is later than the last log file in the preset time period; wherein the retrieval instruction includes the preset time period;

[0056] When the target log file exists, the target log is inserted into the upload file in the order of log generation time.

[0057] In order to ensure the integrity of the same associated log file, this embodiment needs to detect whether there is a target log file that meets the preset insertion conditions in the locally stored log files. Among them, the log files to be detected are log files relative to the first log file and the last log file in the uploaded file. Since the uploaded file formed by the first log file and the second log file obtained according to the retrieval instruction may have the problem of incomplete and incomplete log files, it is necessary to detect whether there is a target log file that can make up for the incompleteness of the uploaded file in the log files to be detected other than the first log file and the second log file according to the needs. This embodiment does not limit the specific condition form of the preset insertion condition. For example, when the preset insertion condition is that the time is earlier than the first log file in the uploaded file and the page identifier is the same as the first log file, and the time is later than the last log file in the uploaded file and the page identifier is the same as the last log file, after determining the first log file, it is necessary to obtain a target log file whose log generation time is earlier than the first log file and whose page identifier is the same as the first log file, and stop detecting when the detected log file to be detected has a different page identifier from the first log file, and after determining the last log file in the uploaded file, obtain a target log file whose log generation time is later than the last log file and whose page identifier is the same as the last log file, and stop detecting when the detected log file to be detected has a different page identifier from the last log file. The preset time period in this embodiment is set according to actual needs. For example, the user estimates that the approximate time when the device has problems is from 8:00 am to 1:00 pm, and the preset time period in the salvage instruction can be set to 8:00 am to 1:00 pm; the user estimates that the approximate time when the device has problems is from 11:00 am to 11:00 pm, and the preset time period in the salvage instruction can be set to 11:00 am to 11:00 pm.

[0058] Based on the above embodiment, further, in order to ensure the integrity of the logs of the same transaction type, before detecting whether there is a target log file that meets the preset insertion condition in the log file to be detected, the following may be included:

[0059] Obtaining a first transaction identifier of the first log file, and / or obtaining a second transaction identifier of the last log file;

[0060] Correspondingly, detecting whether there is a target log file that meets the preset insertion condition in the log file to be detected, and stopping the detection when it is determined that the log file to be detected currently does not meet the preset insertion condition, includes:

[0061] Detecting whether there is a first target log file in the first file to be detected that is identical to the first transaction identifier and satisfies a preset insertion condition, and stopping the detection until it is determined that the first log file to be detected currently detected is different from the first transaction identifier; wherein the log generation time of the first file to be detected is earlier than the first log file in the preset time period;

[0062] and / or detecting whether there is a second target log file in the second file to be detected that is identical to the second transaction identifier and satisfies a preset insertion condition, and stopping the detection until it is determined that the second log file to be detected currently detected is different from the second transaction identifier; wherein the log generation time of the second file to be detected is later than the last log file in the preset time period;

[0063] The first target log file and / or the second target log file is used as the target log file.

[0064] The specific content of the preset insertion condition is not limited in this embodiment, and the user can set it according to the specific situation. For example, the preset insertion condition is a condition that is consistent with all other conditions except the time range and transaction type in the retrieval instruction. When the retrieval instruction is specifically, the time range is from 12:00 on July 23, 2022 to 23:00 on July 23, 2022, and the smart device is identified as "D", and the terminal is identified as "Xiao Ai", and the log level is the fourth level, then at this time, the preset insertion condition is that the smart device is identified as "D", and the terminal is identified as "Xiao Ai", and the log level is the fourth level. This embodiment detects from the first file to be detected whether there is a target log file with the same transaction type as the first log file with the earliest time in the uploaded file and meets the preset insertion condition, wherein the first file to be detected is a log earlier than the first log file; and / or detects whether there is a target log file with the same transaction type as the last log file in the uploaded file and meets the preset insertion condition in the second file to be detected, wherein the second file to be detected is a log later than the last log file. When detecting from the first log file forward, if the transaction type of the detected log file is different from that of the first log file, the detection is stopped; when detecting from the last log file backward, if the transaction type of the detected log file is different from that of the last log file, the detection is stopped. For example, the generation time of the first log file of the uploaded file formed according to the retrieval instruction is 1:00 on July 27, 2022, and the generation time of the last log file is 23:00 on July 27, 2022. Then, the first file to be detected, which is earlier than the first log file at this time, is the log at 1:00 on July 27, 2022, and the second file to be detected, which is later than the last log file, is the log after 23:00 on July 27, 2022. At this time, if the transaction type of the first log file is A, the transaction types detected from 1:00 on July 27, 2022 are A, A, A, B and A in sequence. Since the transaction type of B is different from that of A, only three As need to be inserted into the uploaded file. Or, since the second A does not meet the log level condition of the preset insertion condition, although the second A has the same transaction type as the first log file, it does not need to be inserted into the uploaded file because it does not meet the log level condition of the preset insertion condition. Since it has the same transaction type as the first log file, there is no need to stop detection. At this time, if the transaction type of the last log file is C, and the transaction type detected from 23:00 on July 27, 2022 is D, then the detection is stopped directly at this time, and since there is no log file that meets the preset insertion conditions, there is no need to insert any logs in the uploaded file.

[0065] Based on any of the above embodiments, further, in order to prevent the upload of the uploaded file from failing, the log collection method may also include:

[0066] Detecting whether there is the uploaded file that has not yet been uploaded to the log management platform;

[0067] If it exists, the upload file is uploaded to the log management platform.

[0068] This embodiment can detect the uploaded files that have not been successfully uploaded, and timely re-upload the uploaded files that have failed to be uploaded, thereby preventing the uploaded files from being uploaded to the log management platform in time.

[0069] Based on any of the above embodiments, further, in order to ensure the integrity of the log file and prevent the smart device from deleting important log files due to insufficient storage space of the smart device, after receiving the second log file sent by the smart device according to the retrieval instruction, the method may also include:

[0070] A successful reception instruction is sent to the smart device, so that the smart device deletes the stored second log file according to the successful reception instruction.

[0071] This embodiment does not limit the specific form of the successful reception instruction, as long as the smart device can determine, based on the successful reception instruction, that the terminal has successfully received the second log file sent according to the retrieval instruction.

[0072] Based on any of the above embodiments, further, in order to ensure the feasibility of acquisition, the step of acquiring the first log file related to the smart device stored locally according to the retrieval instruction includes:

[0073] Receiving a device log file sent by the smart device at a preset period;

[0074] Aggregating the device log file and the log file related to the smart device in the terminal to form an aggregate log file;

[0075] The first log file is obtained from the aggregated log file.

[0076] The first log file in this embodiment mainly includes two parts: one is the device log file sent by the smart device according to a preset period, and the other is the log file generated by the terminal during operation that complies with the retrieval instruction.

[0077] In summary, the embodiment of the present invention merges the device log files in the terminal and the smart device in chronological order through the terminal, so that the readability of the device log is greatly enhanced, and the speed of locating the problem is increased; and by obtaining the log file that is earlier than the first log file in the uploaded file and meets the preset insertion condition, and the log file that is later than the last log file in the uploaded file and meets the preset insertion condition, the integrity of the device log file is obtained, so that the problem can be located more quickly and accurately. And by timely deleting the device log file sent to the terminal by the smart device, the storage space of the smart device is increased, so that the device log file of the terminal is more complete; therefore, the application of the log collection method provided by this embodiment can reduce the storage space of the device log file, save costs, increase the readability of the log, and obtain a more complete device log file, and increase the success probability of log locating problems.

[0078] The following is an introduction to a log collection device provided by an embodiment of the present invention. The log collection device described below and the log collection method described above can be referenced to each other.

[0079] Please refer to Figure 2 , Figure 2 A schematic diagram of a log collection device provided by an embodiment of the present invention may include:

[0080] The first log file acquisition module 100 is used to receive a retrieval instruction sent by the log management platform, and acquire a first log file related to the smart device stored locally according to the retrieval instruction;

[0081] A salvage instruction sending module 200, used to send the salvage instruction to the smart device;

[0082] A second log file acquisition module 300 is used to receive a second log file sent by the smart device according to the retrieval instruction;

[0083] The collecting module 400 is configured to merge the first log file and the second log file into an upload file in the order of log generation time when the second log file is received.

[0084] Based on the above embodiment, after the collection module 400, the following may also be included:

[0085] A target log file detection module is used to detect whether there is a target log file that meets the preset insertion condition in the log file to be detected, and stop the detection until it is determined that the log file to be detected currently detected does not meet the preset insertion condition; wherein the log generation time of the log file to be detected is earlier than the first log file in the preset time period, and / or the log generation time is later than the last log file in the preset time period; wherein the preset time period is included in the retrieval instruction;

[0086] The target log insertion module is used to insert the target log into the uploaded file in the order of log generation time when the target log file exists.

[0087] Based on any of the above embodiments, before the target log file detection module, the following may also be included:

[0088] A transaction identifier acquisition module, used to acquire a first transaction identifier of the first log file, and / or acquire a second transaction identifier of the last log file;

[0089] Correspondingly, the target log file insertion module includes:

[0090] A first target log file detection unit is used to detect whether there is a first target log file that is identical to the first transaction identifier and satisfies a preset insertion condition in the first file to be detected, and stops detecting when it is determined that the first log file to be detected currently detected is different from the first transaction identifier; wherein the log generation time of the first file to be detected is earlier than the first log file in the preset time period;

[0091] A second target log file detection unit is used to detect whether there is a second target log file that is identical to the second transaction identifier and satisfies a preset insertion condition in the second file to be detected, and stops detecting when it is determined that the second log file to be detected currently detected is different from the second transaction identifier; wherein the log generation time of the second file to be detected is later than the last log file in the preset time period;

[0092] The target log file aggregation unit is used to use the first target log file and / or the second target log file as the target log file.

[0093] Based on any of the above embodiments, the log collection device may further include:

[0094] An upload detection module, used to detect whether there is an upload file that has not been uploaded to the log management platform;

[0095] The upload module is used to upload the upload file to the log management platform when it exists.

[0096] Based on any of the above embodiments, after the second log file acquisition module 300, the following may also be included:

[0097] The successful reception instruction sending module is used to send a successful reception instruction to the smart device, so that the smart device deletes the stored second log file according to the successful reception instruction.

[0098] Based on any of the above embodiments, after the first log file acquisition module 100, the following may also be included:

[0099] A preset receiving module, used to receive the device log file sent by the smart device according to a preset period;

[0100] A log file aggregation module, used to aggregate the device log files and the log files related to the smart device in the terminal to form an aggregated log file;

[0101] The first log file acquisition module is used to acquire the first log file from the summary log file.

[0102] Based on the above implementation scheme, this embodiment provides a log collection device, which may include: a first log file acquisition module 100, used to receive a retrieval instruction sent by a log management platform, and obtain a first log file related to a smart device stored locally according to the retrieval instruction; a retrieval instruction sending module 200, used to send the retrieval instruction to the smart device; a second log file acquisition module 300, used to receive a second log file sent by the smart device according to the retrieval instruction; a collection module 400, used to merge the first log file and the second log file into an upload file in the order of log generation time when the second log file is received. It can be seen that compared with the prior art that uploads the log of the smart device and the local log of the terminal to the log management platform respectively, the embodiment of the present invention merges the log files in the terminal and the smart device that meet the retrieval instruction in the order of log generation time through the terminal, so that the logs of the terminal and the smart device can be arranged in the order of log generation time after being merged, which increases the readability of the log and makes it faster to locate the device problem.

[0103] The following is an introduction to a log collection device provided by an embodiment of the present invention. The log collection device described below and the log collection method described above can be referenced to each other.

[0104] Please refer to Figure 3 , FIG. 1 is a schematic diagram of a log collection device provided by an embodiment of the present invention, which may include:

[0105] A memory 10, used for storing computer programs;

[0106] The processor 20 is used to execute a computer program to implement the above-mentioned log collection method.

[0107] like Figure 3 , which is a schematic diagram of the composition structure of a log collection device, the log collection device may include: a memory 10, a processor 20, a communication interface 30 and a communication bus 40. The memory 10, the processor 20, and the communication interface 30 all communicate with each other through the communication bus 40.

[0108] The memory may include a read-only memory and a random access memory, and provides instructions and data to the processor. A portion of the memory may also include an NVRAM. The memory stores an operating system and operating instructions, executable devices or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and processing hardware-based tasks.

[0109] The processor controls the operation of the log collection device, and the processor can also be referred to as a CPU. The number of processors can be one or more. In some embodiments of the present application, the processor and the memory can be connected via a bus or other means.

[0110] The method disclosed in the above embodiment of the present application can be applied to a processor or implemented by a processor. The processor can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above log collection method can be completed by an integrated logic circuit of hardware in the processor or instructions in the form of software. The above processor can be a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0111] Of course, it should be noted that Figure 3 The structure shown does not constitute a limitation on the log collection device in the embodiment of the present application. In actual applications, the log collection device may include Figure 3 More or fewer components than shown, or combinations of certain components.

[0112] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the log collection method in any of the above embodiments are implemented.

[0113] In this embodiment, the computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0114] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0115] Professionals may further appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0116] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly by hardware, software devices executed by a processor, or a combination of the two. The software device may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0117] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0118] The log collection method, device, equipment and computer-readable storage medium provided by the present invention are introduced in detail above. The principles and implementation methods of the present invention are explained in detail using specific examples. 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 those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A log collection method, It is characterized in that Applied to terminals, including: Receiving a retrieval instruction sent by the log management platform, and acquiring a first log file related to the smart device stored locally according to the retrieval instruction; Sending the retrieval instruction to the smart device; Receiving a second log file sent by the smart device according to the retrieval instruction; When the second log file is received, merging the first log file and the second log file into an upload file in the order of log generation time; The uploaded file is transmitted to the log management platform so that the log management platform can locate the location where the problem of the smart device occurs based on the uploaded file.

2. The log collection method according to claim 1, It is characterized in that After merging the first log file and the second log file into an upload file in the order of log generation time, the method further includes: Detect whether there is a target log file that meets the preset insertion condition in the log file to be detected, and stop detecting until it is determined that the log file to be detected currently detected does not meet the preset insertion condition; wherein the log generation time of the log file to be detected is earlier than the first log file in the preset time period, and / or the log generation time is later than the last log file in the preset time period; wherein the retrieval instruction includes the preset time period; When the target log file exists, the target log is inserted into the upload file in the order of log generation time.

3. The log collection method according to claim 2, It is characterized in that Before detecting whether there is a target log file that meets the preset insertion condition in the log file to be detected, the method further includes: Obtaining a first transaction identifier of the first log file, and / or obtaining a second transaction identifier of the last log file; Correspondingly, detecting whether there is a target log file that meets the preset insertion condition in the log file to be detected, and stopping the detection when it is determined that the log file to be detected currently does not meet the preset insertion condition, includes: Detecting whether there is a first target log file in the first file to be detected that is identical to the first transaction identifier and satisfies a preset insertion condition, and stopping the detection until it is determined that the first log file to be detected currently detected is different from the first transaction identifier; wherein the log generation time of the first file to be detected is earlier than the first log file in the preset time period; and / or detecting whether there is a second target log file in the second file to be detected that is identical to the second transaction identifier and satisfies a preset insertion condition, and stopping the detection until it is determined that the second log file to be detected currently detected is different from the second transaction identifier; wherein the log generation time of the second file to be detected is later than the last log file in the preset time period; The first target log file and / or the second target log file is used as the target log file.

4. The log collection method according to claim 1, It is characterized in that Also includes: Detecting whether there is the uploaded file that has not yet been uploaded to the log management platform; If it exists, the upload file is uploaded to the log management platform.

5. The log collection method according to claim 1, It is characterized in that After receiving the second log file sent by the smart device according to the retrieval instruction, the method further includes: A successful reception instruction is sent to the smart device, so that the smart device deletes the stored second log file according to the successful reception instruction.

6. The log collection method according to claim 1, It is characterized in that The step of obtaining a locally stored first log file related to the smart device according to the retrieval instruction includes: Receiving a device log file sent by the smart device at a preset period; Aggregating the device log file and the log file related to the smart device in the terminal to form an aggregate log file; The first log file is obtained from the aggregated log file.

7. A log collection device, It is characterized in that Applied to terminals, including: A first log file acquisition module, configured to receive a retrieval instruction sent by the log management platform, and acquire a first log file related to the smart device stored locally according to the retrieval instruction; A salvage instruction sending module, used to send the salvage instruction to the smart device; A second log file acquisition module, used to receive a second log file sent by the smart device according to the retrieval instruction; The collection module is used to merge the first log file and the second log file into an upload file in the order of log generation time when the second log file is received; and transmit the upload file to the log management platform so that the log management platform can locate the location where the problem of the smart device occurs based on the upload file.

8. A log collection device, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the log collection method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the log collection method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Log inquiry method and system

    CN105488201A