Device log collection method, device and system

By setting up FTP and MQTT servers on the server side, remote collection of IoT terminal device logs is realized, which solves the problem of low log collection efficiency in the existing technology, improves efficiency, and reduces system pressure and power consumption.

CN114006916BActive Publication Date: 2024-10-11BOE TECHNOLOGY GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010688427.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-16
Publication Date
2024-10-11
Estimated Expiration
2040-07-16

AI Technical Summary

Technical Problem

In the existing technology, the collection efficiency of IoT terminal device logs is low and requires manual on-site collection, resulting in a waste of time and low efficiency.

Method used

Use the server to set up the FTP server and MQTT server, receive user operation instructions from the front-end device, generate log collection messages, send them to the terminal device through the MQTT server, and store and transmit log files through the FTP server to achieve remote log collection.

Benefits of technology

It improves log collection efficiency, reduces the necessity of manual collection, reduces terminal equipment system pressure and power consumption, and enables efficient remote acquisition and storage of log files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114006916B_ABST
    Figure CN114006916B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and system for collecting device logs, which relates to the field of terminal technology, and the main purpose is to solve the problem of low collection efficiency of the existing log collection process. The method of the present invention mainly includes: receiving a user operation instruction sent by a front-end device, wherein the user operation instruction contains a terminal device identifier; generating a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction; sending the log collection message to the terminal device through the MQTT server; and, when receiving a log file fed back by the terminal device based on the log collection message, storing the log file through the FTP server, and sending the log file to the front-end device through the FTP server. The present invention is applicable to the log collection process of terminal devices in the Internet of Things.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of terminal technology, and in particular to a method, device and system for collecting device logs. Background Art

[0002] As technology continues to develop, the Internet of Things is also developing. More and more IoT terminal devices are scattered in different places indoors or outdoors, taking on various tasks, such as free WiFi routers in public places, outdoor advertising machines, IoT gateways, etc. Among them, these terminal devices run a variety of systems and application software.

[0003] In the process of using the Internet of Things, there are multiple terminal devices in the network. Engineers often need to monitor the operating status of various terminal devices, and the most effective way is to analyze the operating status of each terminal device through the log file. At present, due to the different systems and programs running on different terminal devices, especially when the terminal device has problems due to software or system, engineers are generally required to go to the device site of the terminal device to manually collect logs. However, in actual applications, when it is necessary to obtain log files of terminal devices in multiple different locations or areas within an Internet of Things, it is necessary to go to the device site to manually collect log files of different terminal devices, which wastes a lot of time and makes the log collection efficiency low. Summary of the invention

[0004] In view of this, the device log collection method, apparatus and system provided by the present invention aim to solve the problem of low log collection efficiency when manually collecting terminal logs.

[0005] The purpose of the present invention is to be achieved by adopting the following technical solutions:

[0006] In a first aspect, the present invention provides a method for collecting device logs, which is applied to a server, wherein the server is provided with an FTP server and an MQTT server, and the method comprises:

[0007] Receiving a user operation instruction sent by a front-end device, wherein the user operation instruction includes a terminal device identifier;

[0008] Generating a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction;

[0009] Sending the log collection message to the terminal device through the MQTT server; and,

[0010] When the log file fed back by the terminal device based on the log collection message is received, the log file is stored through the FTP server, and the log file is sent to the front-end device through the FTP server.

[0011] Optionally, the user operation instruction includes a historical log collection instruction and a real-time log collection instruction, and generating a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction includes:

[0012] When the user operation instruction is a history log collection instruction, a history log collection message corresponding to the terminal device identifier is generated according to the terminal device identifier in the history log collection instruction;

[0013] When the user operation instruction is a real-time log collection instruction, a real-time log collection message corresponding to the terminal device identifier is generated according to the terminal device identifier in the real-time log collection instruction.

[0014] Optionally, sending the log collection message to the terminal device through the MQTT server includes:

[0015] When the log collection message is a historical log collection message, sending the historical log collection message to the terminal device through the MQTT server;

[0016] or,

[0017] When the log collection message is a real-time log collection message, the real-time log collection message is sent to the terminal device through the MQTT server.

[0018] Optionally, when receiving a log file fed back by the terminal device based on the log collection message, storing the log file through the FTP server, and sending the log file to the front-end device through the FTP server includes:

[0019] When the log file is a historical log file fed back according to the historical log collection message, the historical log file is stored through the FTP server, and the file name and file location of the historical log file are recorded, and the file name and file location are sent to the front-end device at the same time;

[0020] When the log file is an incremental log file fed back according to the real-time log collection message, the corresponding log file is updated according to the incremental file through the FTP server, and the incremental file is sent to the front-end device.

[0021] In a second aspect, an embodiment of the present invention provides a method for collecting device logs, which is applied to a terminal device, comprising:

[0022] When a log collection message sent by the server is detected, a log collection service is started, wherein the log collection service is used to collect and organize log files in the terminal device;

[0023] Acquire a log file corresponding to the log collection message according to the log collection service;

[0024] Send the log file to the server.

[0025] Optionally, the log collection message includes a historical log collection message;

[0026] The obtaining of the log file corresponding to the log collection message according to the log collection service includes:

[0027] When the log collection message is a historical log collection message, obtaining a log file corresponding to the historical log collection message through a log collection service;

[0028] After sending the log file to the server, the method further includes:

[0029] Receive a feedback message from the server after storing all log files, wherein the feedback message includes a file identifier and a file location of the log file, and send the file identifier and the file location to the server.

[0030] Optionally, the log collection message includes a real-time log collection message, and the real-time log collection message is provided with a collection period;

[0031] The obtaining of the log file corresponding to the log collection message according to the log collection service includes:

[0032] When the log collection message is a real-time log collection message, determining whether the log file corresponding to the real-time log collection message is in an upload queue, the upload queue containing multiple log files to be sent to the server;

[0033] If it does not exist, the incremental file corresponding to the log collection message is obtained in real time according to the collection period through the log collection service and added to the upload queue;

[0034] If it exists, and the log file has been in the upload queue for more than a preset time, the incremental file corresponding to the log collection message is obtained in real time according to the collection period through the log collection service and added to the upload queue; otherwise, the real-time log collection message is ignored;

[0035] The sending the log file to the server includes:

[0036] The incremental file is sent to the server according to the upload queue.

[0037] In a third aspect, the present invention provides a method for collecting device logs, which is applied to a front-end device, comprising:

[0038] When a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to the server;

[0039] as well as,

[0040] Receive the feedback file sent by the server.

[0041] Optionally, the method further includes:

[0042] When the feedback file received from the server is the file name and file location of a log file, an operation interface corresponding to the log file is displayed, wherein the operation interface is used to instruct the user to download the log file based on the operation page;

[0043] When the feedback file received from the server is an incremental file, a log display interface corresponding to the incremental file is displayed, and the log display interface is used to represent the update status of the log file.

[0044] In a fourth aspect, the present invention provides a device for collecting device logs, which is applied to a server, wherein the server is provided with an FTP server and an MQTT server, including:

[0045] A receiving unit, used to receive a user operation instruction sent by a front-end device, wherein the user operation instruction includes a terminal device identifier;

[0046] A generating unit, configured to generate a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction;

[0047] a sending unit, configured to send the log collection message to the terminal device through the MQTT server; and

[0048] The processing unit is used to store the log file through the FTP server when receiving the log file fed back by the terminal device based on the log collection message, and send the log file to the front-end device through the FTP server.

[0049] Optionally, the generating unit includes:

[0050] A first generating module, configured to generate a history log collection message corresponding to the terminal device identifier according to the terminal device identifier in the history log collection instruction when the user operation instruction is a history log collection instruction;

[0051] The second generating module is used to generate a real-time log collection message corresponding to the terminal device identifier according to the terminal device identifier in the real-time log collection instruction when the user operation instruction is a real-time log collection instruction.

[0052] Optionally, the sending unit includes:

[0053] A first sending module, configured to send the historical log collection message to the terminal device through the MQTT server when the log collection message is a historical log collection message;

[0054] The second sending module is used to send the real-time log collection message to the terminal device through the MQTT server when the log collection message is a real-time log collection message.

[0055] Optionally, the processing unit includes:

[0056] A first processing module is used for storing the historical log file through the FTP server, recording the file name and file location of the historical log file, and sending the file name and file location to the front-end device when the log file is a historical log file fed back according to the historical log collection message;

[0057] The second processing module is used to update the corresponding log file according to the incremental file through the FTP server when the log file is an incremental log file fed back according to the real-time log collection message, and send the incremental file to the front-end device.

[0058] In a sixth aspect, the present invention provides a device for collecting device logs, applied to a terminal device, comprising:

[0059] A starting unit, used to start a log collection service when a log collection message sent by the server is detected, wherein the log collection service is used to collect and organize log files in the terminal device;

[0060] An acquisition unit, configured to acquire a log file corresponding to the log collection message according to the log collection service;

[0061] A sending unit is used to send the log file to the server.

[0062] Optionally, the acquisition unit is further configured to, when the log collection message is a historical log collection message, acquire a log file corresponding to the historical log collection message through a log collection service;

[0063] The device also includes:

[0064] The processing unit is used to receive a feedback message from the server after storing all log files, wherein the feedback message includes a file identifier and a file location of the log file, and simultaneously send the file identifier and the file device to the server.

[0065] Optionally, the acquiring unit includes:

[0066] A judgment module, used for judging whether the log file corresponding to the real-time log collection message is in an upload queue when the log collection message is a real-time log collection message, wherein the upload queue contains a plurality of log files to be sent to the server;

[0067] A first acquisition module is used to acquire the incremental file corresponding to the log collection message in real time according to the collection period through the log collection service if it is judged that it does not exist and add it to the upload queue;

[0068] A second acquisition module is used to obtain the incremental file corresponding to the log collection message in real time according to the collection period through the log collection service and add it to the upload queue if it is judged to exist and the log file has been in the upload queue for more than a preset time. Otherwise, the real-time log collection message is ignored;

[0069] The sending unit is specifically used to send the incremental file to the server according to the upload queue.

[0070] In a seventh aspect, the present invention provides a device for collecting device logs, which is applied to a front-end device, comprising:

[0071] A generating unit, configured to generate a user operation instruction according to the user operation behavior when a user operation behavior is detected, and send the user operation instruction to the server;

[0072] The receiving unit is used to receive the feedback file sent by the server.

[0073] Optionally, the device further comprises:

[0074] A display unit, configured to display an operation interface corresponding to the log file when the feedback file received from the server is a file name and a file location of the log file, wherein the operation interface is used to instruct the user to download the log file based on the operation page;

[0075] The display unit is further used to display a log display interface corresponding to the incremental file when the feedback file received from the server is an incremental file, wherein the log display interface is used to represent the update status of the log file.

[0076] In a seventh aspect, the present invention provides a device log collection system, comprising: a server, a terminal device, and a front-end device;

[0077] The server is used to execute the device log collection method as described in the first aspect above;

[0078] The terminal device is used to execute the device log collection method such as that described in the second aspect above;

[0079] The front-end device is used to execute the device log collection method such as that described in the third aspect above.

[0080] In an eighth aspect, the present invention provides a storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the device log collection method as described in the first aspect, the second aspect and the third aspect.

[0081] In a ninth aspect, the present invention provides an electronic device, the electronic device comprising a storage medium and a processor;

[0082] The processor is adapted to implement each instruction;

[0083] The storage medium is suitable for storing a plurality of instructions;

[0084] The instructions are suitable for being loaded by the processor and executing the device log collection method as described in the first aspect, the second aspect and the third aspect.

[0085] Through the above technical scheme, the device log collection method, device and system provided by the present invention, compared with the current manual log file collection on-site, can achieve the acquisition and collection of log files of terminal devices through the interaction between the server, terminal equipment and front-end equipment, without the need for operators to manually go to the equipment site to collect logs for each device one by one, thereby improving the log collection efficiency. Among them, in the server, by receiving the user operation instruction sent by the front-end device, the user operation instruction includes the terminal device identification; generating a log collection message corresponding to the terminal device identification according to the terminal device identification in the user operation instruction; sending the log collection message to the terminal device through the MQTT server; and, when receiving the log file fed back by the terminal device based on the log collection message, storing the log file through the FTP server, and sending the log file to the front-end device through the FTP server, the storage of the log file can be realized based on the FTP server in the server, and the interaction of the log collection message between the server and the terminal device can be realized by using the MQTT server, thereby realizing the remote log collection function based on the server, and separating the FTP server for storing logs from the MQTT server for interacting between terminals, so as to realize the independence and non-interference between the two different functions of message control and file storage. In addition, in the terminal device, when a log collection message sent by the server is detected, the log collection service is started, and the log collection service is used to collect and organize the log files in the terminal device; the log file corresponding to the log collection message is obtained according to the log collection service; the log file is sent to the server, which can ensure that on the basis of the log file collection function, the log collection service can be restarted based on the log collection message, avoiding the terminal device system pressure caused by always starting the log collection service, and reducing unnecessary power consumption. In addition, in the front-end device, when a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to the server; and receiving the feedback file sent by the server can ensure that the user can issue a remote log file collection instruction based on the front-end device, realizing the remote log file collection function.

[0086] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0088] Figure 1 A flow chart of a method for collecting device logs provided by an embodiment of the present invention is shown;

[0089] Figure 2 A flowchart of another method for collecting device logs provided by an embodiment of the present invention is shown;

[0090] Figure 3 A flowchart of another device log collection method provided by an embodiment of the present invention is shown;

[0091] Figure 4 A flowchart of another device log collection method provided by an embodiment of the present invention is shown;

[0092] Figure 4-A A schematic diagram showing the interaction between a front-end device, a server and a terminal device in a process of collecting device logs provided by an embodiment of the present invention is shown;

[0093] Figure 5 A block diagram showing a device for collecting device logs provided by an embodiment of the present invention is shown;

[0094] Figure 6 A block diagram showing a device for collecting device logs provided by an embodiment of the present invention is shown;

[0095] Figure 7 A block diagram showing a device for collecting device logs provided by an embodiment of the present invention is shown;

[0096] Figure 8 A block diagram showing a device for collecting device logs provided by an embodiment of the present invention is shown;

[0097] Fig. 9 A block diagram showing a device for collecting device logs provided by an embodiment of the present invention is shown;

[0098] Fig.10 A block diagram showing a device for collecting device logs provided by an embodiment of the present invention is shown;

[0099] Fig.11 A block diagram showing a composition of a device log collection system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0100] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0101] The embodiment of the present invention provides a method for collecting device logs, which is applied to a server, such as Figure 1 As shown, the server is provided with an FTP server and an MQTT server, and the method mainly includes:

[0102] 101. Receive a user operation instruction sent by a front-end device.

[0103] Wherein, the user operation instruction includes a terminal device identification.

[0104] Since the user is collecting logs for devices in the Internet of Things, and there are multiple different devices in the Internet of Things, the user needs to clearly know which device or devices need to collect log files when issuing instructions. Therefore, the user operation instruction contains a terminal device identifier to clarify which device needs to collect log files. Among them, the terminal device identifier can contain a variety of symbols such as letters, text, and numbers, which are not limited here and can be determined based on actual conditions.

[0105] 102. Generate a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction.

[0106] When the aforementioned step 101 receives the user operation instruction, it means that the user needs to collect the log files of the terminal device of a specific target. Therefore, after the server receives the user operation instruction, it is necessary to generate the corresponding log collection message based on the terminal device identifier in the user instruction to ensure that the subsequent sending process can determine which terminal device or terminals to send the collection message to. Among them, the generation process can be based on the MQTT server, and the MQTT server is a server built based on the MQTT protocol for interaction between different terminals and the server. Among them, MQTT, the Chinese name is message queue telemetry transmission, which is a message protocol based on the publish / subscribe paradigm under the ISO standard (ISO / IEC PRF 20922). It works on the TCP / IP protocol family and is a publish / subscribe message protocol designed for remote devices with low hardware performance and poor network conditions. For this reason, it requires a message middleware. MQTT is a client-server based message publish / subscribe transmission protocol, which has the advantages of being lightweight, simple, open and easy to implement, and these advantages make it very widely applicable. In many cases, information can be transmitted in environments where other protocol services are limited, such as machine-to-machine (M2M) communication and the Internet of Things (IoT). It has been widely used in sensors that communicate via satellite links, medical devices that occasionally dial, smart homes, and some miniaturized devices. Based on the characteristics of the MQTT server, in an embodiment of the present invention, a log collection message corresponding to a user operation instruction can be generated based on the MQTT server.

[0107] 103. Send the log collection message to the terminal device through the MQTT server.

[0108] Since the MQTT server is built using the MQTT protocol, which can realize message transmission between terminal devices of different systems, after the log collection message is generated in the aforementioned steps, the log collection message can be sent to the terminal device that needs to collect logs.

[0109] 104. When receiving the log file fed back by the terminal device based on the log collection message, the log file is stored through the FTP server, and the log file is sent to the front-end device through the FTP server.

[0110] After the aforementioned step 103 sends the log collection message, the terminal device that receives the log collection message will inevitably respond based on the log collection message and feedback the corresponding log file. Here, the service end can store the log file by the FTP server set by it after receiving the log file. Wherein the FTP server is a server built based on the FTP protocol, and the FTP protocol, also known as the File Transfer Protocol (FTP for short), is a set of standard protocols for file transmission on the network. It works at the seventh layer of the OSI model and the fourth layer of the TCP model, i.e., the application layer. It uses TCP transmission instead of UDP. Before the client establishes a connection with the server, it must go through a "three-way handshake" process to ensure that the connection between the client and the server is reliable and connection-oriented, providing reliable guarantee for data transmission. FTP allows users to communicate with another host in the form of file operations (such as adding, deleting, modifying, checking, and transmitting files). However, the user does not actually log in to the computer that he wants to access and becomes a full user. The FTP program can be used to access remote resources, realize the user's round-trip file transmission, directory management, and access to emails, etc., even if the computers of both parties may be equipped with different operating systems and file storage methods. Based on the characteristics of the FTP server, it can be used as a storage device for log files in the embodiment of the present invention, thereby ensuring that the front-end device can query and download log files based on the FTP protocol at any time.

[0111] Furthermore, another embodiment of the present invention also provides a method for collecting device logs, which is applied to a terminal device, such as Figure 2 As shown, the method mainly includes:

[0112] 201. When a log collection message sent by a server is detected, a log collection service is started.

[0113] The log collection service is used to collect and organize log files in the terminal device.

[0114] In this step, the log collection service can be understood as software or programs deployed in the terminal device. The log collection service can be kept closed at ordinary times. After the terminal device receives the log collection message, it means that the user needs to collect the logs of the device. At this time, the log collection service is started again, thereby avoiding the system pressure of the terminal device being affected by the log collection service being turned on all the time and reducing the power consumption of the terminal device.

[0115] 202. Obtain a log file corresponding to the log collection message according to the log collection service.

[0116] Since the log collection service has the function of collecting and organizing the logs of the terminal device, the required log files can be obtained based on the log collection message. In addition, the log collection message can include the time range of log collection, for example, the logs within 24 hours before the current time, so that the logs of the corresponding time range can be obtained from the system log inside the terminal device, thereby avoiding the data transmission pressure caused by the feedback of redundant logs.

[0117] 203. Send the log file to the server.

[0118] After the log file is obtained, it is necessary to feedback the log file so that the server can store it using the FTP server after receiving the log file.

[0119] Furthermore, another embodiment of the present invention also provides a method for collecting device logs, which is applied to front-end devices, such as Figure 3 As shown, the method mainly includes:

[0120] 301. When a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to a server.

[0121] The front-end device described in the embodiment of the present invention can be any terminal device such as a PC, a PAD, and a smart phone. Among them, a WEB display page can be set in the front-end device, and when the user operates based on the WEB page, a user operation instruction corresponding to the user operation behavior can be generated. The user operation instruction includes the device for which log files need to be collected, and when necessary, the start and end time of the required log collection can be set as the time range.

[0122] 302. Receive a feedback file sent by the server.

[0123] Since the embodiment of the present invention is to implement a method capable of remotely collecting log files, after sending the user operation instruction, the server must remotely control the terminal device to collect logs based on the user operation instruction and feedback the result of the log collection. Therefore, in this step, the front-end device can also receive the feedback file sent by the server, wherein the feedback file can include the situation of log collection, the specific log content, and the storage location and storage name after the log collection, etc., which are not specifically limited here and can be selected based on the specific operation content contained in the user operation instruction. For example, when the user operation instruction only contains the log collection content of device A, the feedback file received in this step only needs to include whether the log collection result of device A is successfully collected; and when the user operation instruction contains the log collection of device B, and the log storage situation needs to be determined at the same time, the feedback file received in this step not only includes whether the log file of device B is successfully collected, but also the specific storage location, storage name and storage time of device B in the FTP server in the server, etc., and various storage-related parameters.

[0124] Compared with the current manual log file collection, the device log collection method provided by the embodiment of the present invention can achieve the acquisition and collection of log files of terminal devices through the interaction between the server, terminal devices and front-end devices, without the need for operators to manually go to the device site to collect logs for each device one by one, thereby improving the log collection efficiency. Among them, in the server, by receiving the user operation instruction sent by the front-end device, the user operation instruction includes the terminal device identification; generating a log collection message corresponding to the terminal device identification according to the terminal device identification in the user operation instruction; sending the log collection message to the terminal device through the MQTT server; and, when receiving the log file fed back by the terminal device based on the log collection message, storing the log file through the FTP server, and sending the log file to the front-end device through the FTP server, the storage of the log file can be realized based on the FTP server in the server, and the interaction of the log collection message between the server and the terminal device can be realized by using the MQTT server, thereby realizing the remote log collection function based on the server, and separating the FTP server for storing logs from the MQTT server for interacting between terminals, so as to realize the independence and non-interference between the two different functions of message control and file storage. In addition, in the terminal device, when a log collection message sent by the server is detected, the log collection service is started, and the log collection service is used to collect and organize the log files in the terminal device; the log file corresponding to the log collection message is obtained according to the log collection service; the log file is sent to the server, which can ensure that on the basis of the log file collection function, the log collection service can be restarted based on the log collection message, avoiding the terminal device system pressure caused by always starting the log collection service, and reducing unnecessary power consumption. In addition, in the front-end device, when a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to the server; and receiving the feedback file sent by the server can ensure that the user can issue a remote log file collection instruction based on the front-end device, realizing the remote log file collection function.

[0125] Furthermore, as mentioned above Figure 1-3 Further expansion and refinement of the method shown in the figure, the embodiment of the present invention further provides a method for collecting device logs, which is applicable to front-end devices, server terminals and terminal devices respectively. Figure 4 shown.

[0126] Among them, since the method described in the embodiment of the present invention is based on the interaction between the front-end device, the server and the terminal device, the device schematic diagram during the interaction can be shown as shown in 4-A, wherein a WEB page is set in the front-end device to perform the operation of the instruction and the page display; the server is provided with an FTP server, an MQTT server and a log collection management server, wherein the FTP server is used to store the log files sent by the terminal device and transmit the stored files to the front-end device, and the MQTT server is used to interact with the terminal device and feedback the processing results to the log collection management server. The log collection management server is used as a master server to receive the instructions sent by the front-end device, and control the MQTT server to generate and send messages, and control the FTP server to store the received log files and feedback them to the front-end device; the terminal device is provided with a device management agent and a log collection service, wherein the log collection service is used to collect logs from the system logs of the device on the terminal and send them to the FTP server in the server through the FTP protocol, and the device management agent is used to reside in the terminal system and to detect in real time whether there is a log collection message sent by the MQTT in the server (message interaction with the server, the interaction method can be based on a wired network or a mobile communication network).

[0127] Specifically, the method implemented by the interaction process between the above-mentioned server, front-end device and terminal device can be as follows:

[0128] 401. When a front-end device detects a user operation behavior, it generates a user operation instruction according to the user operation behavior and sends the user operation instruction to the server.

[0129] The user operation instructions include historical log collection instructions and real-time log collection instructions.

[0130] The historical log collection instruction is used to collect logs within a period of history, while the implementation log collection instruction is used to collect logs in a cyclic increment according to a certain period or plan. Based on the different needs of users, the instructions issued are different, and the specific instructions can be determined according to the actual situation. In addition, the user operation instruction contains a terminal device identification, which is used to subsequently determine which terminal device the log file to be collected corresponds to. In addition, the process of generating user operation instructions in the front-end device can be based on the WEB page displayed by the front-end device, and the user issues instructions according to the instructions in the page.

[0131] 402. The server receives a user operation instruction sent by the front-end device.

[0132] The user operation instruction received in this step can be received by the log collection management server set in the server. Its transmission method can be based on the HTTP protocol and communicated in the WebSocket mode. Among them, WebSocket is a protocol for full-duplex communication on a single TCP connection. The WebSocket communication protocol was set as the standard RFC 6455 by IETF in 2011, and supplemented by RFC7936. The WebSocket API is also set as a standard by W3C. WebSocket makes the data exchange between the client and the server simpler, allowing the server to actively push data to the client. In the WebSocket API, the browser and the server only need to complete a handshake, and a persistent connection can be directly created between the two, and two-way data transmission can be carried out.

[0133] 403. The server generates a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction.

[0134] In this step, after receiving the user operation instruction fed back by the log collection management server, the MQTT server can compile the user instruction to generate a log collection message based on the MQTT protocol.

[0135] Specifically, since the user operation instruction includes a historical log collection instruction and a real-time log collection instruction, and the operation intentions of these two commands are different, this step includes:

[0136] 1) When the user operation instruction is a history log collection instruction, a history log collection message corresponding to the terminal device identifier is generated according to the terminal device identifier in the history log collection instruction.

[0137] 2) When the user operation instruction is a real-time log collection instruction, a real-time log collection message corresponding to the terminal device identifier is generated according to the terminal device identifier in the real-time log collection instruction.

[0138] 404. The server sends the log collection message to the terminal device through the MQTT server.

[0139] Among them, in this step, the way in which the MOTT server sends and receives messages to the terminal device can be through mobile networks such as 4G\5G, and of course it can also be based on a wired network WAN, that is, a wide area network. The specific transmission method is not limited here and can be selected according to actual needs.

[0140] Specifically, this step includes: when the log collection message is a historical log collection message, sending the historical log collection message to the terminal device through the MQTT server;

[0141] When the log collection message is a real-time log collection message, the real-time log collection message is sent to the terminal device through the MQTT server.

[0142] 405. When the terminal device detects the log collection message sent by the server, the log collection service is started.

[0143] The log collection service is used to collect and organize the log files in the terminal device. In this step, the device management agent program resident in the background of the terminal system can detect whether the server has sent a log collection message. Since the device management agent program is a real-time monitoring program with the characteristics of being lightweight and having a small memory footprint, it is not necessary for the log collection service to be in the startup state due to real-time detection during its resident period, thereby avoiding the problems of power consumption and system resource occupation caused by the log collection service being in the working state.

[0144] 406. The terminal device obtains a log file corresponding to the log collection message according to the log collection service.

[0145] Specifically, due to the differences in the log collection messages sent by the server in the preceding steps, this step is also different in its specific execution, including:

[0146] On the one hand, when the log collection message is a historical log collection message, the log file corresponding to the historical log collection message is obtained through the log collection service. Among them, the acquisition process can obtain the log file in the corresponding time period from the system log of the terminal device based on the time range in the historical log collection message. In addition, when the user does not set the time range (the user operation instruction does not include the time range for collecting logs), the logs in the corresponding situation can be obtained based on the system default settings. For example, when the embodiment of the present invention is set by default to obtain all logs in the terminal device to the current time when there is no time range, all log files of the current terminal device before the current time can be obtained in this step.

[0147] On the other hand, when the log collection message is a real-time log collection message, it is determined whether the log file corresponding to the real-time log collection message is in the upload queue. The upload queue contains multiple log files to be sent to the server. Since the log files required by the current user may be in the upload state, it is possible to first determine whether the log files are in the upload queue based on the method in this step. Of course, based on different results, the subsequent execution steps are also different.

[0148] If the log file does not exist in the upload queue, it means that the log file needs to be uploaded, so the incremental file corresponding to the log collection message needs to be obtained in real time according to the collection cycle through the log collection service and added to the upload queue;

[0149] If a log file exists in the upload queue, and the log file has been in the upload queue for longer than the preset time, it means that the log file in the queue has exceeded the time limit, and it is necessary to continue uploading the incremental files of the log file according to the collection cycle of the log file. Therefore, the incremental files corresponding to the log collection message are obtained in real time according to the collection cycle through the log collection service and added to the upload queue. On the contrary, when the log file exists in the upload queue, and the log file has not exceeded the preset time in the upload queue, it means that the log file is a newly uploaded log file and has not exceeded the time limit. Therefore, the real-time log collection message can be ignored to avoid the incremental files of the same log file being uploaded repeatedly.

[0150] 407. The terminal device sends the log file to the server.

[0151] Based on the different ways in which the terminal device obtains the log file in the previous step, the sending process in this step is also different. When the incremental file of the log file is obtained, this step can send the incremental file to the server side through the log collection service using the upload queue.

[0152] In addition, when the log file obtained corresponds to a historical log collection message, in addition to the log collection service sending the log file to the FTP server on the server side, the embodiment of the present invention also needs to receive a feedback message from the FTP server after storing all the log files through the log collection agent service, wherein the feedback message includes the file identifier and file location of the log file. At the same time, the log collection agent program sends the feedback message to the device management agent program, and the device management agent program sends the file identifier and file device to the MQTT server on the server side through the MQTT protocol.

[0153] 408. When receiving the log file fed back by the terminal device based on the log collection message, the server stores the log file through the FTP server and sends the log file to the front-end device through the FTP server.

[0154] Specifically, this step includes:

[0155] On the one hand, when the log file is a historical log file fed back according to the historical log collection message, the historical log file is stored through the FTP server, and the file name and file location of the historical log file are recorded, and the file name and file location are sent to the log collection management server, and the log collection management server sends the file name and file location of the log file to the front-end device.

[0156] On the other hand, when the log file is an incremental log file fed back according to the real-time log collection message, the corresponding log file is updated according to the incremental file through the FTP server, and the log file update information is fed back to the front-end device through the log collection management server, and the incremental file is sent to the front-end device through the FTP service.

[0157] 409. The front-end device receives the feedback file sent by the server.

[0158] Based on the different feedback files received, the front-end device can also display different interfaces based on different feedback files, which can be shown in the following ways respectively:

[0159] On the one hand, when the front-end device receives the file name and file location of the feedback file sent by the server as a log file, it displays the operation interface corresponding to the log file. The operation interface is used to instruct the user to download the log file based on the operation page. This ensures that the user can download the log file based on the operation interface.

[0160] On the other hand, when the feedback file sent by the server is an incremental file, the front-end device displays a log display interface corresponding to the incremental file. The log display interface is used to represent the update status of the log file. In this way, the user can understand the log update status of a certain terminal device on the log display interface.

[0161] Further, according to the above method embodiment, another embodiment of the present invention also provides a device log collection device, which is applied to a server, such as Figure 5 As shown, the server is provided with an FTP server and an MQTT server, and the device mainly includes:

[0162] The receiving unit 51 may be used to receive a user operation instruction sent by a front-end device, wherein the user operation instruction includes a terminal device identifier;

[0163] The generating unit 52 may be configured to generate a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction received by the receiving unit 51;

[0164] A sending unit 53 may be used to send the log collection message generated by the generating unit 52 to the terminal device through the MQTT server; and

[0165] The processing unit 54 can be used to store the log file through the FTP server when receiving the log file fed back by the terminal device based on the log collection message, and send the log file to the front-end device through the FTP server.

[0166] Optional, such as Figure 6 As shown, the generating unit 52 includes:

[0167] The first generating module 521 may be configured to generate a history log collection message corresponding to the terminal device identifier according to the terminal device identifier in the history log collection instruction when the user operation instruction is a history log collection instruction;

[0168] The second generating module 522 may be configured to generate a real-time log collection message corresponding to the terminal device identifier according to the terminal device identifier in the real-time log collection instruction when the user operation instruction is a real-time log collection instruction.

[0169] Optional, such as Figure 6 As shown, the sending unit 53 includes:

[0170] The first sending module 531 may be configured to send the historical log collection message to the terminal device through the MQTT server when the log collection message is a historical log collection message;

[0171] The second sending module 532 may be configured to send the real-time log collection message to the terminal device through the MQTT server when the log collection message is a real-time log collection message.

[0172] Optional, such as Figure 6 As shown, the processing unit 54 includes:

[0173] The first processing module 541 may be used to store the historical log file through the FTP server, record the file name and file location of the historical log file, and send the file name and file location to the front-end device when the log file is a historical log file fed back according to the historical log collection message;

[0174] The second processing module 542 can be used to update the corresponding log file according to the incremental file through the FTP server when the log file is an incremental log file fed back according to the real-time log collection message, and send the incremental file to the front-end device.

[0175] Further, according to the above method embodiment, another embodiment of the present invention also provides a device log collection device, which is applied to a terminal device, such as Figure 7 As shown, the device mainly includes:

[0176] The starting unit 71 may be used to start a log collection service when a log collection message sent by the server is detected, wherein the log collection service is used to collect and organize log files in the terminal device;

[0177] The acquiring unit 72 may be configured to acquire a log file corresponding to the log collection message according to the log collection service started by the starting unit 71;

[0178] The sending unit 73 may be configured to send the log file obtained by the obtaining unit 72 to the server.

[0179] Optional, such as Figure 8 As shown, the acquisition unit 72 may also be used to acquire the log file corresponding to the historical log collection message through the log collection service when the log collection message is a historical log collection message;

[0180] The device also includes:

[0181] The processing unit 74 may be configured to receive a feedback message from the server after storing all log files, wherein the feedback message includes a file identifier and a file location of the log file, and send the file identifier and the file location to the server.

[0182] Optional, such as Figure 8 As shown, the acquisition unit 72 includes:

[0183] The judgment module 721 may be used to judge whether the log file corresponding to the real-time log collection message is in an upload queue when the log collection message is a real-time log collection message, and the upload queue contains multiple log files to be sent to the server;

[0184] The first acquisition module 722 may be used to acquire the incremental file corresponding to the log collection message in real time according to the collection period through the log collection service and add it to the upload queue if the determination module 721 determines that it does not exist;

[0185] The second acquisition module 723 can be used to obtain the incremental file corresponding to the log collection message in real time according to the collection period through the log collection service and add it to the upload queue if the judgment module 721 judges that it exists and the log file has been in the upload queue for more than a preset time. Otherwise, the real-time log collection message is ignored;

[0186] The sending unit 73 may be specifically configured to send the incremental file to the server according to the upload queue.

[0187] Further, according to the above method embodiment, another embodiment of the present invention also provides a device log collection device, which is applied to a front-end device, such as Fig. 9 As shown, the device mainly includes:

[0188] The generating unit 91 may be used to generate a user operation instruction according to the user operation behavior when a user operation behavior is detected, and send the user operation instruction to the server;

[0189] The receiving unit 92 may be configured to receive a feedback file sent by the server.

[0190] Optional, such as Fig.10 As shown, the device also includes:

[0191] The display unit 93 is used to display an operation interface corresponding to the log file when the feedback file sent by the receiving unit 92 is a file name and a file location of a log file, wherein the operation interface is used to instruct the user to download the log file based on the operation page;

[0192] The display unit 93 is further configured to display a log display interface corresponding to the incremental file when the feedback file sent by the server end received by the receiving unit 92 is an incremental file. The log display interface is configured to indicate the update status of the log file.

[0193] Further, according to the above method embodiment, another embodiment of the present invention also provides a system for collecting device logs, such as Fig.11 As shown, the device mainly includes: a front-end device 111, a server 112 and a terminal device 113, wherein:

[0194] The front-end device 111 can be used to generate a user operation instruction according to the user operation behavior when the user operation behavior is detected, and send the user operation instruction to the server 112; and receive a feedback file sent by the server 112.

[0195] The server 112 can be used to receive user operation instructions sent by the front-end device 111, and the user operation instructions include a terminal device identifier; generate a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instructions; send the log collection message to the terminal device 113 through the MQTT server; and, when receiving a log file fed back by the terminal device 113 based on the log collection message, store the log file through the FTP server, and send the log file to the front-end device 111 through the FTP server.

[0196] The terminal device 113 can be used to start a log collection service when a log collection message sent by the server 112 is detected. The log collection service is used to collect and organize log files in the terminal device; obtain the log file corresponding to the log collection message according to the log collection service; and send the log file to the server 112.

[0197] Through the scheme described in the above embodiments, the embodiments of the present invention provide a method, device and system for collecting device logs. Compared with the current manual collection of log files at the device site, the present invention can achieve the acquisition and collection of log files of the terminal device through the interaction between the server, the terminal device and the front-end device. There is no need for operators to manually go to the device site to collect logs for each device one by one, thereby improving the log collection efficiency. Among them, in the server, by receiving the user operation instruction sent by the front-end device, the user operation instruction includes the terminal device identification; generating a log collection message corresponding to the terminal device identification according to the terminal device identification in the user operation instruction; sending the log collection message to the terminal device through the MQTT server; and, when receiving the log file fed back by the terminal device based on the log collection message, storing the log file through the FTP server, and sending the log file to the front-end device through the FTP server, the storage of the log file can be realized based on the FTP server in the server, and the interaction of the log collection message between the server and the terminal device can be realized by using the MQTT server, thereby realizing the remote log collection function based on the server, and separating the FTP server for storing logs from the MQTT server for interacting between terminals, so as to realize the independence and non-interference between the two different functions of message control and file storage. In addition, in the terminal device, when a log collection message sent by the server is detected, the log collection service is started, and the log collection service is used to collect and organize the log files in the terminal device; the log file corresponding to the log collection message is obtained according to the log collection service; the log file is sent to the server, which can ensure that on the basis of the log file collection function, the log collection service can be restarted based on the log collection message, avoiding the terminal device system pressure caused by always starting the log collection service, and reducing unnecessary power consumption. In addition, in the front-end device, when a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to the server; and receiving the feedback file sent by the server can ensure that the user can issue a remote log file collection instruction based on the front-end device, realizing the remote log file collection function.

[0198] Furthermore, according to the above method embodiment, another embodiment of the present invention also provides a storage medium, wherein the storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above device log collection method.

[0199] The instructions in the device log collection storage medium provided by the embodiment of the present invention can realize the acquisition and collection of the log files of the terminal device through the interaction between the service end, the terminal device and the front-end device, and the operator no longer needs to go to the device site manually to collect the logs of the device one by one, thereby improving the efficiency of log collection. Among them, in the service end, by receiving the user operation instruction sent by the front-end device, the user operation instruction contains the terminal device identification; according to the terminal device identification in the user operation instruction, a log collection message corresponding to the terminal device identification is generated; the log collection message is sent to the terminal device through the MQTT server; and when the log file fed back by the terminal device based on the log collection message is received, the log file is stored through the FTP server, and the log file is sent to the front-end device through the FTP server, the storage of the log file can be realized based on the FTP server in the service end, and the interaction of the log collection message between the service end and the terminal device can be realized by using the MQTT server, thereby realizing the remote log collection function based on the service end, and separating the FTP server storing the log from the MQTT server interacting between the terminals, so that the two different functions of message control and file storage can be realized to be independent and non-interfering. In addition, in the terminal device, when a log collection message sent by the server is detected, the log collection service is started, and the log collection service is used to collect and organize the log files in the terminal device; the log file corresponding to the log collection message is obtained according to the log collection service; the log file is sent to the server, which can ensure that on the basis of the log file collection function, the log collection service can be restarted based on the log collection message, avoiding the terminal device system pressure caused by always starting the log collection service, and reducing unnecessary power consumption. In addition, in the front-end device, when a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to the server; and receiving the feedback file sent by the server can ensure that the user can issue a remote log file collection instruction based on the front-end device, realizing the remote log file collection function.

[0200] Further, according to the above method embodiment, another embodiment of the present invention also provides an electronic device, the electronic device includes a storage medium and a processor;

[0201] The processor is adapted to implement each instruction;

[0202] The storage medium is suitable for storing a plurality of instructions;

[0203] The instructions are suitable for being loaded by the processor and executing the method for collecting device logs as described above.

[0204] The electronic device for collecting device logs provided by the embodiment of the present invention can realize the acquisition and collection of the log files of the terminal device through the interaction between the service end, the terminal device and the front-end device, and the operator no longer needs to go to the device site manually to collect the logs of the device one by one, thereby improving the efficiency of log collection. Among them, in the service end, by receiving the user operation instruction sent by the front-end device, the user operation instruction contains the terminal device identification; according to the terminal device identification in the user operation instruction, a log collection message corresponding to the terminal device identification is generated; the log collection message is sent to the terminal device through the MQTT server; and when the log file fed back by the terminal device based on the log collection message is received, the log file is stored through the FTP server, and the log file is sent to the front-end device through the FTP server, the storage of the log file can be realized based on the FTP server in the service end, and the interaction of the log collection message between the service end and the terminal device can be realized by using the MQTT server, thereby realizing the remote log collection function based on the service end, and separating the FTP server storing the log from the MQTT server interacting between the terminals, so that the two different functions of message control and file storage can be realized to be independent and non-interfering. In addition, in the terminal device, when a log collection message sent by the server is detected, the log collection service is started, and the log collection service is used to collect and organize the log files in the terminal device; the log file corresponding to the log collection message is obtained according to the log collection service; the log file is sent to the server, which can ensure that on the basis of the log file collection function, the log collection service can be restarted based on the log collection message, avoiding the terminal device system pressure caused by always starting the log collection service, and reducing unnecessary power consumption. In addition, in the front-end device, when a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to the server; and receiving the feedback file sent by the server can ensure that the user can issue a remote log file collection instruction based on the front-end device, realizing the remote log file collection function.

[0205] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0206] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the device log collection method, device, and system according to an embodiment of the present invention. The present invention may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0207] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.

Claims

1. A method for collecting device logs, characterized in that: Applied to the server, the server is provided with an FTP server and an MQTT server, including: Receiving a user operation instruction sent by a front-end device, wherein the user operation instruction includes a terminal device identifier; Generating a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction; Sending the log collection message to the terminal device through the MQTT server; and, When receiving a log file fed back by the terminal device based on the log collection message, the log file is stored through the FTP server, and the log file is sent to the front-end device through the FTP server, and when the log collection message includes a historical log collection message, the feedback message of the FTP server after storing the log file is sent to the log collection agent in the terminal device, and the feedback message includes the file identifier and file location of the log file, so that the log collection agent sends the feedback message to the device management agent, and the device management agent sends the file identifier and file location to the MQTT server through the MQTT protocol; The user operation instruction includes a historical log collection instruction and a real-time log collection instruction, and the generating of a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction includes: When the user operation instruction is a history log collection instruction, a history log collection message corresponding to the terminal device identifier is generated according to the terminal device identifier in the history log collection instruction; When the user operation instruction is a real-time log collection instruction, a real-time log collection message corresponding to the terminal device identifier is generated according to the terminal device identifier in the real-time log collection instruction.

2. The method according to claim 1, characterized in that: The sending the log collection message to the terminal device through the MQTT server includes: When the log collection message is a historical log collection message, sending the historical log collection message to the terminal device through the MQTT server; or, When the log collection message is a real-time log collection message, the real-time log collection message is sent to the terminal device through the MQTT server.

3. The method according to claim 1, characterized in that When receiving the log file fed back by the terminal device based on the log collection message, storing the log file through the FTP server, and sending the log file to the front-end device through the FTP server includes: When the log file is a historical log file fed back according to the historical log collection message, the historical log file is stored through the FTP server, and the file name and file location of the historical log file are recorded, and the file name and file location are sent to the front-end device at the same time; When the log file is an incremental log file fed back according to the real-time log collection message, the corresponding log file is updated according to the incremental file through the FTP server, and the incremental file is sent to the front-end device.

4. A method for collecting device logs, characterized in that: Applied to terminal equipment, including: When a log collection message sent by the server through the MQTT server is detected, a log collection service is started, wherein the log collection service is used to collect and organize log files in the terminal device, wherein the log collection message is a historical log collection message or a real-time log collection message; Acquire a log file corresponding to the log collection message according to the log collection service; Sending the log file to the server so that the server stores the log file through the FTP server and sends the log file to the front-end device through the FTP server; When the log collection message includes a historical log collection message, after sending the log file to the server, the method further includes: A feedback message from the FTP server after storing the log file is received through the log collection agent, wherein the feedback message includes the file identifier and file location of the log file. At the same time, the log collection agent sends the feedback message to the device management agent, and the device management agent sends the file identifier and file location to the MQTT server through the MQTT protocol.

5. The method according to claim 4, characterized in that The log collection message includes a historical log collection message; The obtaining of the log file corresponding to the log collection message according to the log collection service includes: When the log collection message is a historical log collection message, a log file corresponding to the historical log collection message is obtained through a log collection service.

6. The method according to claim 4, characterized in that The log collection message includes a real-time log collection message, and the real-time log collection message is provided with a collection cycle; The obtaining of the log file corresponding to the log collection message according to the log collection service includes: When the log collection message is a real-time log collection message, determining whether the log file corresponding to the real-time log collection message is in an upload queue, the upload queue containing multiple log files to be sent to the server; If it does not exist, the incremental file corresponding to the log collection message is obtained in real time according to the collection period through the log collection service and added to the upload queue; If it exists, and the log file has been in the upload queue for more than a preset time, the incremental file corresponding to the log collection message is obtained in real time according to the collection period through the log collection service and added to the upload queue; otherwise, the real-time log collection message is ignored; The sending the log file to the server includes: The incremental file is sent to the server according to the upload queue.

7. A method for collecting device logs, characterized in that: Applied to front-end equipment, including: When a user operation behavior is detected, a user operation instruction is generated according to the user operation behavior, and the user operation instruction is sent to the server, so that the server generates a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction; the log collection message is sent to the terminal device through the MQTT server; and, when a log file is received based on the log collection message feedback from the terminal device, the log file is stored through the FTP server, and the log file is sent to the front-end device through the FTP server, and when the log collection message includes a historical log collection message, the feedback message of the FTP server after storing the log file is sent to the log collection agent in the terminal device, and the file of the log file is included in the feedback message. The device management agent sends the feedback message to the device management agent, and the device management agent sends the file identifier and the file location to the MQTT server through the MQTT protocol; the user operation instruction includes a historical log collection instruction or a real-time log collection instruction, and the generating of the log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction includes: when the user operation instruction is a historical log collection instruction, the generating of the historical log collection message corresponding to the terminal device identifier according to the terminal device identifier in the historical log collection instruction; when the user operation instruction is a real-time log collection instruction, the generating of the real-time log collection message corresponding to the terminal device identifier according to the terminal device identifier in the real-time log collection instruction; as well as, Receive the feedback file sent by the server.

8. The method according to claim 7, characterized in that The method further comprises: When the feedback file received from the server is the file name and file location of a log file, an operation interface corresponding to the log file is displayed, wherein the operation interface is used to instruct the user to download the log file based on the operation page; When the feedback file received from the server is an incremental file, a log display interface corresponding to the incremental file is displayed, and the log display interface is used to represent the update status of the log file.

9. A device for collecting device logs, characterized in that: Applied to the server, the server is provided with an FTP server and an MQTT server, including: A receiving unit, used to receive a user operation instruction sent by a front-end device, wherein the user operation instruction includes a terminal device identifier; A generating unit, configured to generate a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction; a sending unit, configured to send the log collection message to the terminal device through the MQTT server; and a processing unit, configured to, when receiving a log file fed back by the terminal device based on the log collection message, store the log file through the FTP server, and send the log file to the front-end device through the FTP server, and when the log collection message includes a historical log collection message, send a feedback message of the FTP server after storing the log file to the log collection agent in the terminal device, wherein the feedback message includes a file identifier and a file location of the log file, so that the log collection agent sends the feedback message to the device management agent, and the device management agent sends the file identifier and the file location to the MQTT server through the MQTT protocol; The generating unit comprises: A first generating module, configured to generate a history log collection message corresponding to the terminal device identifier according to the terminal device identifier in the history log collection instruction when the user operation instruction is a history log collection instruction; The second generating module is used to generate a real-time log collection message corresponding to the terminal device identifier according to the terminal device identifier in the real-time log collection instruction when the user operation instruction is a real-time log collection instruction.

10. A device for collecting device logs, characterized in that: Applied to terminal equipment, including: A starting unit, used to start a log collection service when a log collection message sent by the server through the MQTT server is detected, wherein the log collection service is used to collect and organize log files in the terminal device, wherein the log collection message is a historical log collection message or a real-time log collection message; An acquisition unit, configured to acquire a log file corresponding to the log collection message according to the log collection service; A sending unit, used for sending the log file to the server, so that the server stores the log file through the FTP server and sends the log file to the front-end device through the FTP server; A processing unit is used to receive, through a log collection agent, a feedback message from the FTP server after storing the log file when the log collection message includes a historical log collection message, wherein the feedback message includes a file identifier and a file location of the log file, and at the same time, the log collection agent sends the feedback message to the device management agent, and the device management agent sends the file identifier and the file location to the MQTT server through the MQTT protocol.

11. A device for collecting device logs, characterized in that: Applied to front-end equipment, including: A generating unit is used to generate a user operation instruction according to the user operation behavior when a user operation behavior is detected, and send the user operation instruction to a server, so that the server generates a log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction; sends the log collection message to the terminal device through an MQTT server; and, when a log file fed back by the terminal device based on the log collection message is received, stores the log file through an FTP server, and sends the log file to a front-end device through the FTP server, and when the log collection message includes a historical log collection message, sends a feedback message of the FTP server after storing the log file to the log collection agent in the terminal device, wherein the feedback message includes the log file The file identifier and file location of the file are provided so that the log collection agent program sends the feedback message to the device management agent program, and the device management agent program sends the file identifier and file location to the MQTT server through the MQTT protocol; the user operation instruction includes a historical log collection instruction or a real-time log collection instruction, and the generating of the log collection message corresponding to the terminal device identifier according to the terminal device identifier in the user operation instruction includes: when the user operation instruction is a historical log collection instruction, generating the historical log collection message corresponding to the terminal device identifier according to the terminal device identifier in the historical log collection instruction; when the user operation instruction is a real-time log collection instruction, generating the real-time log collection message corresponding to the terminal device identifier according to the terminal device identifier in the real-time log collection instruction; The receiving unit is used to receive the feedback file sent by the server.

12. A device log collection system, characterized in that: include: Server, terminal equipment and front-end equipment; Wherein, the server is used to execute a device log collection method such as any one of claims 1 to 3 above; The terminal device is used to perform a device log collection method such as any one of claims 4 to 6; The front-end device is used to execute a device log collection method such as that described in any one of claims 7-8.

13. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the device log collection method according to any one of claims 1-3, 4-6, or 7-8.

14. An electronic device, characterized in that: The electronic device includes a storage medium and a processor; The processor is adapted to implement each instruction; The storage medium is suitable for storing a plurality of instructions; The instructions are suitable for being loaded by the processor and executing the method for collecting device logs as described in any one of claims 1-3, 4-6, or 7-8.