Log recording method, system and device, electronic equipment and storage medium

By establishing a communication mechanism for the establishment of a log configuration parameter between the target device and the server, the target device records the operating log without the need for the logo file of the server storage, solves the problem of increasing the cost of distributed storage, and realizes the reduction of log record costs and increased the cost of log records and increased. Log configuration management convenience effect.

CN119383073APending Publication Date: 2025-01-28HANGZHOU HIKSTORAGE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411535219.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In the prior art, the operation logs of controlled devices and control terminals require distributed storage, resulting in the need to deploy multiple servers, which increases the logging cost.

Method used

By establishing a communication mechanism between the target equipment and the server, the target device sends a request to obtain a log configuration parameter to the server. After the server sends the configuration parameter, the target device is set and the operating log is used to record the log. If the conditions are met, the log file is generated.

Benefits of technology

There is no need to store log files on the server side, reducing the cost of logging, and configuration parameters through uniform management logs through the server, which improves the convenience of log configuration management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119383073A_ABST
    Figure CN119383073A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a log recording method, system and device, electronic equipment and a storage medium, and relates to the technical field of the Internet, and the method comprises the steps that target equipment sends a first obtaining request used for obtaining log configuration parameters to a server; and after receiving the first acquisition request, the server sends the requested log configuration parameters to the target equipment. The target equipment sets log configuration parameters of the target equipment according to the received log configuration parameters; if it is determined that the log recording condition is met based on the log configuration parameters, the running log of the target equipment is recorded, and the log file is obtained, the log file of the target equipment can be recorded in the local of the target equipment and does not need to be recorded in a server, multiple servers used for storing running logs of different services do not need to be deployed, and the log recording cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a log recording method, system, device, electronic device and storage medium. Background Art

[0002] In the control system, a control APP (application) for controlling the operation of the controlled device is installed in the control terminal. The user uses the control APP to control the operation of the controlled device. For example, in a smart home system, the controlled device is a sweeping robot, and the control terminal is a device installed with a control APP for controlling the operation of the sweeping robot, such as a mobile phone. The user uses the control APP in the mobile phone to control the sweeping robot to clean.

[0003] In the related art, the operation logs of the controlled devices and the operation logs of the control applications in the control terminals are distributedly stored in servers corresponding to different businesses according to the different businesses that generate the operation logs. However, in the above distributed storage method, it is necessary to deploy multiple servers for storing the operation logs of different businesses, which increases the log recording cost. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a log recording method, system, device, electronic device and storage medium to reduce the log recording cost. The specific technical solution is as follows:

[0005] In a first aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a log recording method, the method is applied to a target device, the target device communicates with a server, and the method includes:

[0006] Sending a first acquisition request for acquiring log configuration parameters to a server, so that the server sends the requested log configuration parameters to the target device after receiving the first acquisition request;

[0007] Setting the log configuration parameters of the target device according to the received log configuration parameters;

[0008] If it is determined based on the log configuration parameters that the log recording condition is met, the operation log of the target device is recorded to obtain a log file.

[0009] Optionally, the log configuration parameters include: at least one of a record name, a record level, an encryption key, and a limit size of different business logs;

[0010] The step of setting the log configuration parameters of the target device according to the received log configuration parameters includes:

[0011] For each service of the target device, setting the acquired record name of the service as the target name when recording the operation log of the service;

[0012] The acquired record level of the service is set as the level threshold when recording the operation log of the service;

[0013] Setting the obtained encryption key as the target key for encryption when recording the operation log of the target device;

[0014] The obtained limit size is set as the storage threshold of the operation log of the target device.

[0015] Optionally, if it is determined based on the log configuration parameters that the log recording condition is met, recording the operation log of the target device to obtain a log file includes:

[0016] For each service of the target device, when the record level of the operation log generated by the service is not less than the level threshold, determining that the log record condition of the service is met;

[0017] Using the target secret key, encrypt the operation log generated by the business to obtain an encrypted operation log;

[0018] The encrypted operation log is recorded to obtain a log file; wherein the name of the operation log of the business in the log file is the target name.

[0019] Optionally, the encrypted operation log is recorded to obtain a log file, including:

[0020] When the recorded logs reach the storage threshold, the encrypted operation logs are used to overwrite the recorded logs, and the encrypted operation logs are recorded to obtain a log file.

[0021] Optionally, if it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes:

[0022] Sending a second acquisition request for obtaining the modified log configuration parameter to the server, so that the server sends the modified log configuration parameter to the target device after receiving the second acquisition request; wherein the modified log configuration parameter is sent to the server by a technician through a management terminal; and the modified log configuration parameter includes: at least one of a record name, a record level, and a limit size of different services;

[0023] The log configuration parameters of the target device are updated according to the received modified log configuration parameters.

[0024] Optionally, if it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes:

[0025] Sending a third acquisition request for obtaining an updated encryption key to the server, so that the server sends the updated encryption key to the target device after receiving the third acquisition request; wherein the updated encryption key is generated by the server when a preset update cycle is reached; after receiving the updated encryption key, setting the updated encryption key as the target key for encryption when recording the operation log of the target device;

[0026] or,

[0027] After receiving the updated encryption key sent by the server, the updated encryption key is set as the target key for encryption when recording the operation log of the target device; wherein the updated encryption key is: sent by the technician to the server through the management terminal.

[0028] Optionally, the target device is a control terminal installed with a control application for controlling the operation of the controlled device;

[0029] If it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes:

[0030] Receiving a log query request sent by the controlled device; wherein the log query request is: the controlled device forwards the log query request sent by the server to the control terminal after receiving the log query request;

[0031] The log file of the control application in the control terminal is sent to the server, so that the server sends the log file to the management terminal after receiving the log file sent by the control terminal and the controlled device.

[0032] Optionally, the target device is a controlled device running according to a control application installed in the control terminal;

[0033] If it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes:

[0034] Receive the log query request sent by the server;

[0035] Send the log file of the controlled device to the server, and send the log query request to the control terminal, so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request, so that the server sends the log file to the management terminal after receiving the log file sent by the control terminal and the controlled device.

[0036] In a second aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a log recording method, which is applied to a server, and the server communicates with a target device, and the method includes:

[0037] Receiving a first acquisition request sent by the target device for acquiring log configuration parameters;

[0038] The requested log configuration parameters are sent to the target device so that the target device sets the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file.

[0039] Optionally, after sending the requested log configuration parameters to the target device, the method further includes:

[0040] Receive the modified log configuration parameters sent by the technician through the management terminal;

[0041] After receiving a second acquisition request sent by the target device for obtaining the modified log configuration parameters, the modified log configuration parameters are sent to the target device so that the target device updates the log configuration parameters of the target device according to the received modified log configuration parameters; wherein the modified log configuration parameters include: at least one of the record name, record level, and limit size of different services.

[0042] Optionally, the log configuration parameters include: an encryption key;

[0043] After sending the requested log configuration parameters to the target device, the method further includes:

[0044] When a preset update cycle is reached, an updated encryption key is generated; after receiving a third acquisition request sent by the target device for acquiring the updated encryption key, the updated encryption key is sent to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device;

[0045] or,

[0046] After receiving the updated encryption key sent by the technician through the management terminal, the updated encryption key is sent to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

[0047] Optionally, the target device includes: a control terminal installed with a control application for controlling the operation of the controlled device, and a controlled device operating according to the control application installed in the control terminal;

[0048] After sending the requested log configuration parameters to the target device, the method further includes:

[0049] After receiving the log query instruction for the controlled device issued by the management terminal, sending a log query request to the controlled device so that the controlled device sends the log file of the controlled device to the server, and sending the log query request to the control terminal so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request;

[0050] Receive the log files sent by the control terminal and the controlled device, and send the log files to the management terminal.

[0051] Optionally, the log query request carries an identifier of the target device; the identifier of the target device is generated based on a serial number of the target device and a query time.

[0052] In a third aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a log recording system, the system comprising: a server and a target device;

[0053] The target device is used to send a first acquisition request for acquiring log configuration parameters to the server;

[0054] The server is configured to send the requested log configuration parameter to the target device after receiving the first acquisition request;

[0055] The target device is further used to set the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file.

[0056] In a fourth aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a log recording device, the device is applied to a target device, the target device communicates with a server, and the device includes:

[0057] A request sending module, used for sending a first acquisition request for acquiring log configuration parameters to a server, so that the server sends the requested log configuration parameters to the target device after receiving the first acquisition request;

[0058] A parameter setting module, used to set the log configuration parameters of the target device according to the received log configuration parameters;

[0059] The log recording module is used to record the operation log of the target device and obtain a log file if it is determined based on the log configuration parameters that the log recording conditions are met.

[0060] Optionally, the log configuration parameters include: at least one of a record name, a record level, an encryption key, and a limit size of different business logs;

[0061] The parameter setting module is specifically used to: for each service of the target device, set the acquired record name of the service as the target name when recording the operation log of the service; set the acquired record level of the service as the level threshold when recording the operation log of the service; set the acquired encryption key as the target key for encryption when recording the operation log of the target device; set the acquired limit size as the storage threshold of the operation log of the target device.

[0062] Optionally, the log recording module is specifically used to: for each business of the target device, when the recording level of the operation log generated by the business is not less than the level threshold, determine that the log recording conditions of the business are met; use the target key to encrypt the operation log generated by the business to obtain an encrypted operation log; record the encrypted operation log to obtain a log file; wherein the name of the operation log of the business in the log file is the target name.

[0063] Optionally, the log recording module is specifically used to: when the recorded log reaches the storage threshold, overwrite the recorded log with the encrypted operation log to record the encrypted operation log and obtain a log file.

[0064] Optionally, the device further comprises:

[0065] A parameter modification module is used to execute, when the log recording module executes, if it is determined based on the log configuration parameters that the log recording conditions are met, record the operation log of the target device, and after obtaining the log file, execute a second acquisition request to the server for obtaining the modified log configuration parameters, so that the server sends the modified log configuration parameters to the target device after receiving the second acquisition request; wherein the modified log configuration parameters are sent to the server by the technician through the management terminal; the modified log configuration parameters include: at least one of the record name, record level, and limit size of different services; and the log configuration parameters of the target device are updated according to the received modified log configuration parameters.

[0066] Optionally, the device further comprises:

[0067] A key update module, configured to, when the log recording module executes and determines that the log recording condition is met based on the log configuration parameters, record the operation log of the target device, and after obtaining the log file, execute a third acquisition request for obtaining an updated encryption key to the server, so that the server sends the updated encryption key to the target device after receiving the third acquisition request; wherein the updated encryption key is generated by the server when a preset update cycle is reached; after receiving the updated encryption key, the updated encryption key is set as the target key for encryption when recording the operation log of the target device;

[0068] or,

[0069] After receiving the updated encryption key sent by the server, the updated encryption key is set as the target key for encryption when recording the operation log of the target device; wherein the updated encryption key is: sent by the technician to the server through the management terminal.

[0070] Optionally, the target device is a control terminal installed with a control application for controlling the operation of the controlled device;

[0071] The device also includes:

[0072] A log upload module is used to execute, if the log recording module determines that the log recording conditions are met based on the log configuration parameters, record the operation log of the target device, and after obtaining the log file, execute and receive the log query request sent by the controlled device; wherein, the log query request is: the controlled device forwards to the control terminal after receiving the log query request sent by the server; sends the log file of the control application in the control terminal to the server, so that the server sends the log file to the management terminal after receiving the log files sent by the control terminal and the controlled device.

[0073] Optionally, the target device is a controlled device running according to a control application installed in the control terminal;

[0074] The device also includes:

[0075] The log upload module is used to record the operation log of the target device if the log recording condition is determined to be met based on the log configuration parameters in the log recording module, and after obtaining the log file, execute the log query request sent by the receiving server; send the log file of the controlled device to the server, and send the log query request to the control terminal, so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request, so that the server sends the log file to the management terminal after receiving the log file sent by the control terminal and the controlled device.

[0076] In a fifth aspect, in order to achieve the above-mentioned purpose, an embodiment of the present application provides a log recording device, the device is applied to a server, the server communicates with a target device, and the device includes:

[0077] A request receiving module, used for receiving a first acquisition request sent by the target device for acquiring log configuration parameters;

[0078] The parameter sending module is used to send the requested log configuration parameters to the target device so that the target device sets the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file.

[0079] Optionally, the device further comprises:

[0080] A parameter modification module is used to receive the modified log configuration parameters sent by the technician through the management terminal after the parameter sending module executes sending the requested log configuration parameters to the target device; after receiving a second acquisition request sent by the target device for obtaining the modified log configuration parameters, send the modified log configuration parameters to the target device, so that the target device updates the log configuration parameters of the target device according to the received modified log configuration parameters; wherein the modified log configuration parameters include: at least one of the record name, record level, and limit size of different services.

[0081] Optionally, the device further comprises:

[0082] a key updating module, configured to generate an updated encryption key when a preset update cycle is reached after the parameter sending module executes to send the requested log configuration parameters to the target device; and after receiving a third acquisition request sent by the target device for acquiring the updated encryption key, send the updated encryption key to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device;

[0083] or,

[0084] After receiving the updated encryption key sent by the technician through the management terminal, the updated encryption key is sent to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

[0085] Optionally, the target device includes: a control terminal installed with a control application for controlling the operation of the controlled device, and a controlled device operating according to the control application installed in the control terminal;

[0086] The device also includes:

[0087] A log acquisition module is used to, after receiving a log query instruction for a controlled device issued by a management terminal, send a log query request to the controlled device so that the controlled device sends the log file of the controlled device to the server, and send the log query request to the control terminal so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request; receive the log files sent by the control terminal and the controlled device, and send the log files to the management terminal.

[0088] Optionally, the log query request carries an identifier of the target device; the identifier of the target device is generated based on a serial number of the target device and a query time.

[0089] The present application also provides an electronic device, including:

[0090] Memory, used to store computer programs;

[0091] The processor is used to implement any of the above-mentioned log recording methods when executing the program stored in the memory.

[0092] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned logging methods is implemented.

[0093] An embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any of the above-described logging methods.

[0094] Beneficial effects of the embodiments of the present application:

[0095] The technical solution provided by the embodiment of the present application is that the target device sends a first acquisition request for obtaining log configuration parameters to the server. After receiving the first acquisition request, the server sends the requested log configuration parameters to the target device. The target device sets the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file. The log file of the target device can be recorded locally on the target device instead of on the server, so there is no need to deploy multiple servers for storing operation logs of different businesses, thereby reducing the log recording cost.

[0096] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0097] In order to more clearly illustrate the embodiments of the present application 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 some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0098] Figure 1 A structure of a log recording system provided in an embodiment of the present application;

[0099] Figure 2 A flowchart of the first log recording method provided in an embodiment of the present application;

[0100] Figure 3 A flow chart of log parameter initialization provided in an embodiment of the present application;

[0101] Figure 4 A log recording flow chart provided for an embodiment of the present application;

[0102] Figure 5 A log pulling timing diagram provided for an embodiment of the present application;

[0103] Figure 6 A parameter modification flow chart provided for an embodiment of the present application;

[0104] Figure 7 A flowchart of the first method of modifying a secret key provided in an embodiment of the present application;

[0105] Figure 8 A flowchart of the second method of modifying a secret key provided in an embodiment of the present application;

[0106] Fig. 9 A flowchart of a second log recording method provided in an embodiment of the present application;

[0107] Fig.10 A structural diagram of a first log recording device provided in an embodiment of the present application;

[0108] Fig.11 A structural diagram of a second log recording device provided in an embodiment of the present application;

[0109] Fig.12 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0110] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0111] In the related art, a distributed storage method is used to record the operation logs of controlled devices and the operation logs of control applications in control terminals. It is necessary to deploy multiple servers for storing operation logs of different services, which increases the log recording cost.

[0112] To solve the above problems, see Figure 1 , Figure 1 The structure of a log recording system provided in an embodiment of the present application includes a server 101 and a target device 102. The target device 102 includes a controlled device 1021 and a control terminal 1022. The control terminal 1022 includes a Windows client 10221, an Android APP 10222, a Hongmeng APP 10223, a Mac client 10224, and an IOS APP 10225.

[0113] Taking the smart home system as an example, Figure 1 The log recording system shown in FIG. 1 is used to illustrate. Server 101 is a server for managing smart home devices. Smart home devices may include: cameras, speakers, sweeping robots, and televisions, etc. The following description takes the sweeping robot as an example of a smart home device.

[0114] The controlled device 1021 is a sweeping robot, and the control terminal 1022 is a terminal installed with a control application for controlling the operation of the sweeping robot. Among them, the Windows client 10221 represents a computer using the Windows operating system, which is installed with a client for controlling the operation of the sweeping robot. The Mac client 10224 uses a computer using the Mac operating system, which is installed with a client for controlling the operation of the sweeping robot. Android APP 10222 is a mobile phone using the Android operating system, which is installed with an APP for controlling the operation of the sweeping robot. Hongmeng APP 10223 is a mobile phone using the Hongmeng operating system, which is installed with an APP for controlling the operation of the sweeping robot. IOS APP 10225 is a mobile phone using the IOS operating system, which is installed with an APP for controlling the operation of the sweeping robot.

[0115] Understandably, Figure 1 This is only an exemplary description and does not limit the logging system of this application to only include Figure 1 For example, the control terminal may include more terminals or fewer terminals.

[0116] The following describes the interaction process between the controlled device and the server.

[0117] The controlled device sends a request to the server for obtaining log configuration parameters. After receiving the request, the server sends the requested log configuration parameters to the controlled device. Correspondingly, the controlled device sets the log configuration parameters of the controlled device according to the received log configuration parameters; if it is determined that the log recording conditions are met based on the log configuration parameters, the operation log of the controlled device is recorded to obtain a log file.

[0118] The following describes the interaction process between the control terminal and the server.

[0119] The control terminal sends a request to the server for obtaining log configuration parameters. After receiving the request sent by the control terminal, the server sends the requested log configuration parameters to the control terminal. Correspondingly, the control terminal sets the log configuration parameters of the control application in the control terminal according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the control application in the control terminal is recorded to obtain a log file.

[0120] Based on the log recording system provided by the embodiment of the present application, the log files of the controlled device are recorded locally on the controlled device, and the log files of the control application in the control terminal are recorded locally on the control terminal, instead of being recorded on the server, so there is no need to deploy multiple servers for storing operation logs of different services, thereby reducing the log recording cost. In addition, the server uniformly sets the log configuration parameters of the controlled device and the control application in the control terminal, thereby improving the convenience of log configuration parameter management.

[0121] See also Figure 2 , Figure 2 A flow chart of a log recording method provided in an embodiment of the present application, the method is applied to Figure 1 The logging system shown, the method may include the following steps:

[0122] S201: The target device sends a first acquisition request for acquiring log configuration parameters to a server.

[0123] S202: After receiving the first acquisition request, the server sends the requested log configuration parameters to the target device.

[0124] S203: The target device sets the log configuration parameters of the target device according to the received log configuration parameters.

[0125] S204: If the target device satisfies the log recording condition based on the log configuration parameters, the operation log of the target device is recorded to obtain a log file.

[0126] Based on the log recording system provided by the embodiment of the present application, the log files of the controlled device are recorded locally on the controlled device, and the log files of the control application in the control terminal are recorded locally on the control terminal, instead of being recorded on the server, so there is no need to deploy multiple servers for storing operation logs of different services, thereby reducing the log recording cost. In addition, the server uniformly sets the log configuration parameters of the controlled device and the control application in the control terminal, thereby improving the convenience of log configuration parameter management.

[0127] For step S201, the target device is a controlled device running according to the control application installed in the control terminal. The controlled device is a smart home device, such as a camera, a speaker, a sweeping robot, and a TV.

[0128] The operation log generated during the operation of the controlled device can be used to optimize, upgrade, locate problems and solve faults of the controlled device. Therefore, the controlled device can record the operation log generated during the operation, and the controlled device sends a first acquisition request for acquiring log configuration parameters to the server.

[0129] The target device is a control terminal installed with a control application for controlling the operation of the controlled device, such as a mobile phone, tablet computer, laptop computer, etc.

[0130] The operation log generated when the control application controls the controlled device can be used to optimize, upgrade, locate problems and solve faults of the control application and the controlled device. Therefore, the control terminal can record the operation log generated when the control application controls the controlled device, and the control terminal sends a first acquisition request for acquiring log configuration parameters to the server.

[0131] The first acquisition request carries an identifier of the controlled device, for example, a serial number of the controlled device, which is a unique number of the controlled device when it leaves the factory.

[0132] In some embodiments, the log configuration parameters include: module name (ie, record name of different business logs) and log level (ie, record level), log file size (ie, size limit), log key (ie, encryption key), and whether to encrypt.

[0133] The record names of different service logs refer to the names used when recording the operation logs generated by the services of different functions of the target device. For example, if the target device is a controlled device (such as a sweeping robot), the record name of the operation log generated by the start of the sweeping robot is "start", the record name of the operation log generated by the drawing of the sweeping robot is "drawing", and the record name of the operation log generated by the sweeping robot cleaning is "cleaning", etc.

[0134] The target device is a control terminal (such as a sweeping robot). The record name of the operation log generated by the control application in the control terminal for account registration is "registration", the record name of the operation log generated by the control application in the control terminal for account login is "login", and the record name of the operation log generated by the control application in the control terminal for data backup is "backup", etc.

[0135] The record level of different service logs refers to the level threshold that needs to be reached when recording the operation logs generated by the services of different functions of the target device. The operation logs generated by services of different functions are divided into different record levels according to the content. For example, the record levels are in the order from low to high: debug, info, warn, error, and fatal.

[0136] The debug level operation log includes debugging information. The info level operation log includes the return value of the target device interface. The warn level operation log includes common warning information, such as network anomalies, interface errors, etc. The error level operation log includes system-level error information, such as folder access permissions, database file anomalies, etc. The fatal level operation log includes disaster-level error information, such as software crashes, etc.

[0137] See Table 1, which is a LogLevel table of various services of different control terminals provided in an embodiment of the present application.

[0138] Table 1

[0139]

[0140]

[0141] The encryption parameters include whether to encrypt the operation log of the target device and the structure of the encryption parameters used to encrypt the operation log.

[0142] {

[0143] Windows:{isEncode:true,EncodeKey:'XXX'},mac:{isEncode:true,EncodeKey:'XXX'},ios:{isEncode:true,EncodeKey:'XXX'},and riod:{isEncode:true,EncodeKey:'XXX'},Harmony:{isEncode:true,EncodeKey:'XXX*'}linux:{isEncode:true,EncodeKey:'XXX'},

[0144] }

[0145] Among them, isEncode (encryption or not) is true (true) indicates encryption, and isEncode is false (false) indicates no encryption. The value "XXX" of EncodeKey (encoding keyword) represents the key. The specific value of the key is set by the developer. The above information indicates that the control terminals of the Windows operating system, Mac operating system, IOS operating system, Andriod operating system, Harmony operating system and Linux operating system are encrypted when recording logs, and the encryption key is "XXX". The encryption keys of the above-mentioned control terminals can be the same, which is convenient for the server to uniformly manage the keys and for developers of different control terminals to view the operation logs of other control terminals. The encryption keys of the above-mentioned control terminals can also be different to improve the security of the log files.

[0146] The log file size is used to limit the size of the log file that is covered and rolled. That is, when the recorded log reaches the limit size, the newly generated operation log is recorded by overwriting the recorded log. The limit size of the log file is in M ​​(megabytes). The limit sizes of log files of different control terminals are as follows:

[0147] {

[0148] Windows:{size:20},mac:{size:20},ios:{size:5},andriod:{size:5},Harmony:{size:5},linux:{size:10},

[0149] }

[0150] The above information indicates that the limit size of the control terminal log record for the Windows operating system and the Mac operating system is 20M; the limit size of the control terminal log record for the IOS operating system, the Andriod operating system, and the Harmony operating system is 5M; the limit size of the above log files is only for illustrative purposes, and the limit size of the log file recorded by each control terminal is set according to demand, and is not specifically limited in the embodiments of this application.

[0151] In some embodiments, when the target device is a control terminal, the control terminal obtains log configuration parameters from the server each time it detects that the control application is started. When the target device is a controlled device, the controlled device obtains log configuration parameters from the server each time it is started.

[0152] For step S202, the server records the log configuration parameters of each controlled device. The log configuration parameters are sent to the server by the developer through the management terminal. The management terminal is a terminal used by the developer to communicate with the server, such as a computer.

[0153] After receiving the first acquisition request from the target device, the server sends the requested log configuration parameters of the controlled device to the target device.

[0154] The log configuration parameters for the same controlled device are the same, which can achieve unified management of the log configuration parameters of the controlled device. Whether it is a mobile phone, device, or PC (Personal Computer) client, the same log configuration parameters are used, which facilitates log tracking and recording when multiple control terminals operate the controlled device at the same time.

[0155] For step S203, when the target device is a controlled device, the controlled device sets the log configuration parameters for recording the operation log of the controlled device according to the log configuration parameters returned by the server. When the target device is a control terminal, the control terminal sets the log configuration parameters for recording the operation log of the control application in the control terminal according to the log configuration parameters returned by the server.

[0156] Correspondingly, step S203 may include the following steps: for each service of the target device, setting the acquired record name of the service as the target name when recording the operation log of the service; setting the acquired record level of the service as the level threshold when recording the operation log of the service; setting the acquired encryption key as the target key for encryption when recording the operation log of the target device; setting the acquired limit size as the storage threshold of the operation log of the target device.

[0157] When the target device is a controlled device, the services of the target device include various service functions provided by the controlled device. When the target device is a control terminal, the services of the target device include various service functions provided by the control application in the control terminal.

[0158] The target device sets the acquired record name of each service as the target name when recording the operation log of each service. And sets the acquired record level of each service as the level threshold when recording the operation log of each service. For example, the target name and level threshold of each service are set according to the above Table 1. The target device can also determine whether encryption is required when recording the log based on the acquired log configuration parameters, and when it is determined that encryption is required, the acquired encryption key is set as the target key for encryption when recording the operation log of the target device. And the acquired limit size is set as the storage threshold of the operation log of the target device.

[0159] See also Figure 3 , Figure 3 A flowchart of log parameter initialization provided in an embodiment of the present application, the method comprises the following steps:

[0160] S301: Start.

[0161] S302: Obtain configuration parameters from the server.

[0162] S303: Set the global module log level table.

[0163] S304: Set the log file size.

[0164] S305: Set whether to encrypt the variable.

[0165] S306: Set the encryption key.

[0166] S307: End.

[0167] After the target device is started, it obtains the log configuration parameters from the server and sets them in the global module log level table, which is shown in Table 1 above. Then, the target device initializes the size of the log file, that is, sets the storage threshold of the target device's operation log, and sets the encryption variable and encryption key, that is, based on the obtained log configuration parameters, determines whether encryption is required when recording the log, and when it is determined that encryption is required, the obtained encryption key is set as the target key for encryption when recording the target device's operation log.

[0168] Based on the above processing, the log configuration parameters are set with the help of the server, and other control terminals obtain unified log configuration parameters by accessing the server, which can realize unified management of the log configuration parameters of the controlled devices, and can also customize proprietary log configuration parameters for each end. In addition, a unified log module name and encryption key are used, and the same log configuration parameters are used for mobile phones, device terminals, and PC clients. When encountering multi-terminal problems, developers at any end can view the logs and analyze which end the problem lies, which facilitates log tracking records when multiple control terminals operate controlled devices at the same time. For example, the log file size can be configured uniformly through the server, or different values ​​can be set according to the needs of the platform itself. The amount of logs that can be saved in the local log file can be modified by configuring the log file size.

[0169] For step S204, the log recording condition is: the recording level of the operation log generated by the service is not less than the level threshold of the service.

[0170] In some embodiments, step S204 may include the following steps: for each service of the target device, when the record level of the operation log generated by the service is not less than the level threshold, determine that the log recording condition of the service is met. Use the target secret key to encrypt the operation log generated by the service to obtain an encrypted operation log. Record the encrypted operation log to obtain a log file. The name of the operation log of the service in the log file is the target name.

[0171] For each service, after generating the operation log of the service, the target device determines the record level based on the content of the operation log of the service, and determines that the log record condition of the service is met when the record level of the operation log generated by the service is not less than (i.e., greater than or equal to) the level threshold of the service. For example, if the operation log generated by the service is debug information, the record level of the operation log of the service is debug, and the level threshold of the service in the log configuration parameter is info, then it is determined that the log record condition of the service is met.

[0172] Then, the target device determines whether the operation log needs to be encrypted, and if the operation log needs to be encrypted, the target key is used to encrypt the operation log generated by the service to obtain the encrypted operation log. Then, the encrypted operation log is recorded according to the target name of the service to obtain a log file.

[0173] When the operation log does not need to be encrypted, the encrypted operation log is directly recorded according to the target name of the business to obtain a log file.

[0174] When recording the operation log of the service, if the recorded log reaches the storage threshold, the operation log of the service is recorded in a manner that the operation log to be recorded overwrites the recorded log to obtain a log file.

[0175] When the operation log needs to be encrypted, the operation log to be recorded is the encrypted operation log. When the operation log does not need to be encrypted, the operation log to be recorded is the unencrypted operation log.

[0176] See also Figure 4 , Figure 4 A log recording flow chart provided for an embodiment of the present application.

[0177] S401: Start.

[0178] S402: Determine whether the log level is not less than the configured level threshold, if yes, execute step S403, if no, execute step S406.

[0179] S403: Determine whether to encrypt, if yes, execute step S404, if not, execute step S405.

[0180] S404: Use ciphertext encryption.

[0181] S405: Direct writing.

[0182] S406: End.

[0183] After the target device detects the log record instruction, it first determines whether the log level (i.e., record level) of this module (i.e., business) is greater than or equal to the configured level threshold. If the log level is less than the configured level threshold, the process ends directly without logging. If the log level is greater than or equal to the configured level threshold, it continues to determine whether the operation log needs to be encrypted.

[0184] If the operation log does not need to be encrypted, the plaintext log content is directly written into the file. If the operation log needs to be encrypted, it is encrypted using the target key, and the encrypted ciphertext (i.e. the encrypted operation log) is written into the file.

[0185] Based on the above processing, the logs are not uploaded in real time, but recorded in the form of local files on each control terminal. There is no need for multiple servers for storing different business logs, which reduces the log storage cost.

[0186] In some embodiments, after step S204, the method may further include the following steps: after receiving the log query instruction for the controlled device issued by the management terminal, the server sends a log query request to the controlled device. The controlled device receives the log query request sent by the server. The controlled device sends the log file of the controlled device to the server, and sends the log query request to the control terminal. After receiving the log query request, the control terminal sends the log file of the control application in the control terminal to the server. After receiving the log files sent by the control terminal and the controlled device, the server sends the log file to the management terminal.

[0187] A long connection is established between the controlled device and the server, and a long connection is also established between the controlled device and each control terminal. The long connection may be an HTTP (Hypertext Transfer Protocol) connection.

[0188] When the developer needs to query the operation log of the controlled device, the developer sends a log query instruction for the controlled device to the server through the management terminal. After receiving the query instruction, the server sends a log query request to the controlled device. The log query request carries the identification of the controlled device; the identification of the controlled device is generated based on the serial number and query time of the controlled target device. For example, the serial number and query time of the controlled target device are processed using MD5 (Message Digest Algorithm 5) to obtain the identification of the controlled device.

[0189] After receiving the log query request sent by the server, the controlled device sends the log file of the controlled device to the server. In addition, the controlled device also controls the terminal to send a log query request. Correspondingly, after receiving the log query request, the control terminal sends the log file of the control application in the control terminal to the server. Furthermore, after receiving the log files sent by the control terminal and the controlled device, the server sends the log files to the management terminal for developers to view.

[0190] See also Figure 5 , Figure 5 A log pulling timing diagram provided in an embodiment of the present application.

[0191] The server sends a pull instruction to the controlled device through a long connection. The pull instruction carries a pull id (Identity document). The pull id is generated based on the serial number and query time of the controlled device. After receiving the pull instruction, the controlled device sends a log pull notification to each control terminal connected to the controlled device. The pull notification contains the log pull id. Each control terminal includes: a control terminal with a Windows client installed, a control terminal with a Mac client installed, a control terminal with an Android client installed, a control terminal with an IOS client installed, and a control terminal with a Hongmeng client installed.

[0192] At the same time, the controlled device packages the local log file and uploads the device log, that is, uploads the log file and the pull ID to the server. After receiving the pull notification sent by the controlled device, each control terminal also packages the local client log file and uploads the client log, that is, uploads the log file, the pull ID and the serial number of the controlled device to the server.

[0193] After receiving the log files uploaded by the controlled devices and each control terminal, the server will classify and archive all log files according to the pull ID and device serial number, and send them to the management terminal for display and download by developers. The server classifies and archives log files, that is, according to the controlled device and pull time, the log files of the same controlled device in the same period of time are classified into one category.

[0194] Based on the above processing, there is no need to upload log files to the server all the time. When developers need to view logs and analyze problems, they can enter the device serial number on the server's management page (i.e., management terminal) to allow the server to use the controlled device as a relay to pull the controlled device's log files from the controlled device and each control terminal, avoiding interference from other non-related log files. In addition, the management terminal provides a one-click download function for all platforms related to the controlled device, allowing developers to download and view the log files of all platforms related to the controlled device.

[0195] In some embodiments, after step S204, the method may further include the following steps: the server receives the modified log configuration parameters sent by the technician through the management terminal. The target device sends a second acquisition request for obtaining the modified log configuration parameters to the server. After receiving the second acquisition request for obtaining the modified log configuration parameters sent by the target device, the server sends the modified log configuration parameters to the target device. The target device updates the log configuration parameters of the target device according to the received modified log configuration parameters. The modified log configuration parameters include at least one of the record name, record level, and limit size of different services.

[0196] When the log configuration parameters need to be modified, the developer sends the modified log configuration parameters to the server through the management terminal. For example, when a new business function is added to the controlled device, the developer can send the record name, record level and other parameters of the new business function to the server through the management terminal. Or, when the new business function is just launched, it may run unstably and require more log files for problem analysis. The record level of the new business function is set to a lower level, such as setting the record level to info. After the new business function has been online for a period of time, the operation becomes relatively stable, and some basic log files are not needed for problem analysis. The record level of the business function can be adjusted to a higher level, such as changing the record level to warn. The previous info-level logs will not be recorded. The recorded logs can be reduced by increasing the record level of the business function.

[0197] Correspondingly, the server receives the modified log configuration parameters sent by the technician through the management terminal. After startup, the target device obtains the latest log configuration parameters, i.e., the modified log configuration parameters, from the server. That is, the target device sends a second acquisition request to the server for obtaining the modified log configuration parameters.

[0198] Furthermore, after receiving the second acquisition request sent by the target device for acquiring the modified log configuration parameter, the server sends the modified log configuration parameter to the target device. The target device updates the log configuration parameter of the target device according to the received modified log configuration parameter. The process of updating the log configuration parameter of the target device is consistent with the process of setting the log configuration parameter, and reference can be made to the introduction of the aforementioned embodiment.

[0199] See also Figure 6 , Figure 6 A parameter modification flow chart provided for an embodiment of the present application.

[0200] S601: Start.

[0201] S602: Modify the log configuration parameters on the server.

[0202] S603: Parameter release.

[0203] S604: Each terminal activates the application.

[0204] S605: Re-acquire the latest parameters from the server.

[0205] S606: End.

[0206] When the log configuration parameters need to be modified, the developer modifies the log configuration parameters on the server through the management terminal and publishes the parameters, that is, sends the modified log configuration parameters to the server. Each terminal starts the application, that is, the controlled device starts, and the control application in the control terminal starts. After starting, the target device re-acquires the latest log configuration parameters from the server, and updates the log configuration parameters of the target device according to the modified log configuration parameters.

[0207] Based on the above processing, it is only necessary to modify the log configuration parameters on the server, and each control terminal can automatically obtain the latest log configuration parameters. There is no need to modify the log configuration parameters for each control terminal separately, which facilitates unified management of the log configuration parameters of each control terminal.

[0208] In some embodiments, the encryption key used to encrypt the operation log of the target device can also be modified. The encryption key can be modified in two ways: one is that the developer manually modifies the encryption key, and the other is that the server automatically generates the encryption key. The following describes the two methods respectively.

[0209] In one implementation, after step S204, the method may further include the following steps: after receiving the updated encryption key sent by the technician through the management terminal, the server sends the updated encryption key to the target device. After receiving the updated encryption key sent by the server, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

[0210] To improve the security of log files, developers can modify the encryption key used to encrypt the operation logs recorded in the server. After receiving the updated encryption key sent by the technician through the management terminal, the server actively sends the updated encryption key to the controlled device. Correspondingly, after receiving the updated encryption key sent by the server, the controlled device sets the updated encryption key as the target key for encryption when recording the operation log of the target device. After the controlled device sends the updated encryption key sent by the server to each control terminal, each control terminal sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

[0211] See also Figure 7 , Figure 7 A flowchart for modifying a secret key provided in an embodiment of the present application.

[0212] S701: Start.

[0213] S702: Modify the secret key on the server front-end management page.

[0214] S703: Determine whether the device is online, if yes, execute step S706, if not, execute step S704.

[0215] S704: After the device is started, it actively obtains the information from the server.

[0216] S705: Other terminal applications actively obtain information from the server when they are started.

[0217] S706: Send a key modification notification via a persistent connection.

[0218] S707: Send notification to each terminal application via a long connection.

[0219] S708: Each program uses the new key to encrypt the log content.

[0220] S709: End.

[0221] The developer modifies the key on the server front-end management page (management terminal), that is, the developer sends the updated encryption key to the server through the management terminal. The server determines whether the device is online, that is, whether the long connection with the controlled device is disconnected. If the device is not online, that is, the long connection with the controlled device has been disconnected, the server does not process it. Subsequently, after the controlled device is started, it actively obtains the updated encryption key from the server. Similarly, each terminal application actively obtains the updated encryption key from the server when it is started. That is, after the control application in each control terminal is started, the control terminal actively obtains the updated encryption key from the server.

[0222] If the device is online, that is, the long connection between the device and the controlled device has not been disconnected, the server sends a key modification notification to the connected controlled device. Specifically, the server sends a key modification notification to the controlled device through a long connection, and the key modification notification carries the updated encryption key. Accordingly, after receiving the updated encryption key sent by the server, the controlled device sets the updated encryption key as the target key for encryption when recording the operation log of the target device. The controlled device sends a notification to each terminal application through a long connection, that is, the controlled device sends a key modification notification to each control terminal, and the notification carries the updated encryption key. Accordingly, after receiving the updated encryption key sent by the controlled device, the control terminal sets the updated encryption key as the target key for encryption when recording the operation log of the control application in the control terminal. The target key is used for encryption when recording the operation log subsequently.

[0223] In some embodiments, after step S204, the method may further include the following steps: the server generates an updated encryption key when a preset update cycle is reached. The target device sends a third acquisition request to the server for obtaining the updated encryption key. After receiving the third acquisition request, the server sends the updated encryption key to the target device. After receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

[0224] The preset update cycle is set by the developer according to the needs. For example, if the preset update cycle is 1 month, the server will generate a random string as the updated encryption key every 1 month.

[0225] After the server automatically generates the updated encryption key, it does not actively push it to the target device. After the target device is started, it sends a third acquisition request to the server for obtaining the updated encryption key. Correspondingly, after receiving the third acquisition request, the server sends the newly generated updated encryption key to the target device. After receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

[0226] See also Figure 8 , Figure 8 A flowchart for modifying a secret key provided in an embodiment of the present application.

[0227] S801: Start.

[0228] S802: Determine whether it is the 1st of each month, if yes, execute step S803, if no, execute step S806.

[0229] S803: Generate a new random key.

[0230] S804: After the device and each terminal application are started, they actively obtain information from the server.

[0231] S805: Each application uses the new key to encrypt the log content.

[0232] S806: End.

[0233] At 0:00 on the 1st of each month, the server generates a new random key to update the key, and saves the updated encryption key on the server without pushing the key. After startup, the controlled device sends a third acquisition request to the server for obtaining the updated encryption key. After receiving the third acquisition request, the server sends the newly generated updated encryption key to the controlled device, and the controlled device sets the updated encryption key as the target key when recording the operation log.

[0234] After startup, the control terminal to which each terminal application belongs sends a third acquisition request to the server for obtaining the updated encryption key. After receiving the third acquisition request, the server sends the newly generated updated encryption key to the control terminal, and the control terminal sets the updated encryption key as the target key when recording the operation log, and uses the target key for encryption when recording the operation log subsequently.

[0235] Based on the above processing, the encryption key of the server configuration log file can be modified regularly, that is, the encryption key can be uniformly configured for each control terminal, or different encryption keys can be set according to different platforms, so as to facilitate the unified modification of encryption keys on multiple platforms and increase the security of log file encryption.

[0236] See also Fig. 9 , Fig. 9 A flowchart of a log recording method provided in an embodiment of the present application. Fig. 9 The solid lines between the devices represent long connections, that is, long connections are between the server and the controlled device, and between the controlled device and each control terminal. Fig. 9 The dotted lines between the devices indicate short connections, that is, short connections are between the server and each control terminal.

[0237] The control terminals include: the control terminal belonging to the Windows client, the control terminal belonging to the Mac client, the control terminal belonging to the Android APP, the control terminal belonging to the Hongmeng APP, and the control terminal belonging to the IOS APP.

[0238] Step ①, when each control terminal is initialized, it accesses the server through a short connection to obtain the log configuration parameters, and then initializes the log configuration in each control terminal. The initialization content includes: log module name, module log level, log file size, log key and other information.

[0239] Step ②: When the developer pulls logs from the server, the server first notifies the controlled device through a long connection and generates a unique pull ID.

[0240] Step ③: The controlled device sends the log pull notification and pull ID to the control terminal through a long connection with each control terminal.

[0241] Step ④: Each control terminal sends the local log file and pull ID to the server through a short connection

[0242] Based on the log recording method provided by the embodiment of the present application, with the help of the server configuration log configuration parameters, other control terminals obtain unified log configuration parameters by accessing the server, and can also customize proprietary configuration parameters for each end. In addition, by using a unified log module name and encryption key, when encountering multi-terminal problems, developers at any end can view the log and analyze which end the problem lies in, without the need for multiple platforms to maintain logs separately, saving time and labor costs. In addition, through the connection between the controlled device and each control terminal, the log of each control terminal is pulled to the server, and it is not necessary to upload it to the server all the time, and avoid interference from other non-related logs, which can solve the problem of difficulty in locating problems caused by the clutter of server logs.

[0243] See also Fig.10 , Fig.10 A structural diagram of a log recording device provided in an embodiment of the present application, wherein the device is applied to a target device, the target device communicates with a server, and the device includes:

[0244] The request sending module 1001 is used to send a first acquisition request for acquiring log configuration parameters to the server, so that the server sends the requested log configuration parameters to the target device after receiving the first acquisition request;

[0245] The parameter setting module 1002 is used to set the log configuration parameters of the target device according to the received log configuration parameters;

[0246] The log recording module 1003 is used to record the operation log of the target device and obtain a log file if it is determined based on the log configuration parameters that the log recording condition is met.

[0247] Optionally, the log configuration parameters include: at least one of a record name, a record level, an encryption key, and a limit size of different business logs;

[0248] The parameter setting module 1002 is specifically used to: for each service of the target device, set the acquired record name of the service as the target name when recording the operation log of the service; set the acquired record level of the service as the level threshold when recording the operation log of the service; set the acquired encryption key as the target key for encryption when recording the operation log of the target device; set the acquired limit size as the storage threshold of the operation log of the target device.

[0249] Optionally, the log recording module 1003 is specifically used to: for each business of the target device, when the recording level of the operation log generated by the business is not less than the level threshold, determine that the log recording condition of the business is met; use the target key to encrypt the operation log generated by the business to obtain an encrypted operation log; record the encrypted operation log to obtain a log file; wherein the name of the operation log of the business in the log file is the target name.

[0250] Optionally, the log recording module 1003 is specifically used to: when the recorded log reaches the storage threshold, use the encrypted operation log to overwrite the recorded log, record the encrypted operation log, and obtain a log file.

[0251] Optionally, the device further comprises:

[0252] A parameter modification module is used to execute, in the log recording module 1003, if it is determined that the log recording conditions are met based on the log configuration parameters, to record the operation log of the target device, and after obtaining the log file, execute a second acquisition request to the server for obtaining the modified log configuration parameters, so that the server sends the modified log configuration parameters to the target device after receiving the second acquisition request; wherein the modified log configuration parameters are sent to the server by the technician through the management terminal; the modified log configuration parameters include: the record name, record level, and at least one of the limit size of different services; the log configuration parameters of the target device are updated according to the received modified log configuration parameters.

[0253] Optionally, the device further comprises:

[0254] A key update module, configured to, when the log recording module 1003 executes, if it is determined based on the log configuration parameters that the log recording condition is met, record the operation log of the target device, and after obtaining the log file, execute sending a third acquisition request for obtaining an updated encryption key to the server, so that the server sends the updated encryption key to the target device after receiving the third acquisition request; wherein the updated encryption key is generated by the server when a preset update cycle is reached; after receiving the updated encryption key, setting the updated encryption key as the target key for encryption when recording the operation log of the target device;

[0255] or,

[0256] After receiving the updated encryption key sent by the server, the updated encryption key is set as the target key for encryption when recording the operation log of the target device; wherein the updated encryption key is: sent by the technician to the server through the management terminal.

[0257] Optionally, the target device is a control terminal installed with a control application for controlling the operation of the controlled device;

[0258] The device also includes:

[0259] A log upload module is used to execute in the log recording module 1003 if it is determined that the log recording conditions are met based on the log configuration parameters, record the operation log of the target device, and after obtaining the log file, execute and receive the log query request sent by the controlled device; wherein the log query request is: the controlled device forwards to the control terminal after receiving the log query request sent by the server; sends the log file of the control application in the control terminal to the server, so that the server sends the log file to the management terminal after receiving the log files sent by the control terminal and the controlled device.

[0260] Optionally, the target device is a controlled device running according to a control application installed in the control terminal;

[0261] The device also includes:

[0262] The log upload module is used to execute the log query request sent by the receiving server after the log recording module 1003 determines that the log recording conditions are met based on the log configuration parameters, and records the operation log of the target device. The log file is sent to the server, and the log query request is sent to the control terminal, so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request, so that the server sends the log file to the management terminal after receiving the log file sent by the control terminal and the controlled device.

[0263] Based on the log recording device provided by the embodiment of the present application, the log files of the controlled device are recorded locally on the controlled device, and the log files of the control application in the control terminal are recorded locally on the control terminal, instead of being recorded on the server, so there is no need to deploy multiple servers for storing operation logs of different services, thereby reducing the log recording cost. In addition, the server uniformly sets the log configuration parameters of the controlled device and the control application in the control terminal, which makes the log configuration parameter management more convenient.

[0264] See also Fig.11 , Fig.11 A structural diagram of a log recording device provided in an embodiment of the present application, wherein the device is applied to a server, the server communicates with a target device, and the device includes:

[0265] The request receiving module 1101 is used to receive a first acquisition request sent by the target device for acquiring log configuration parameters;

[0266] The parameter sending module 1102 is used to send the requested log configuration parameters to the target device so that the target device sets the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file.

[0267] Optionally, the device further comprises:

[0268] A parameter modification module is used to receive the modified log configuration parameters sent by the technician through the management terminal after the parameter sending module 1102 executes sending the requested log configuration parameters to the target device; after receiving the second acquisition request sent by the target device for obtaining the modified log configuration parameters, send the modified log configuration parameters to the target device, so that the target device updates the log configuration parameters of the target device according to the received modified log configuration parameters; wherein the modified log configuration parameters include: at least one of the record name, record level, and limit size of different services.

[0269] Optionally, the device further comprises:

[0270] a key updating module, configured to generate an updated encryption key when a preset update cycle is reached after the parameter sending module 1102 executes sending the requested log configuration parameters to the target device; and after receiving a third acquisition request sent by the target device for acquiring the updated encryption key, send the updated encryption key to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device;

[0271] or,

[0272] After receiving the updated encryption key sent by the technician through the management terminal, the updated encryption key is sent to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

[0273] Optionally, the target device includes: a control terminal installed with a control application for controlling the operation of the controlled device, and a controlled device operating according to the control application installed in the control terminal;

[0274] The device also includes:

[0275] A log acquisition module is used to send a log query request to the controlled device after the parameter sending module 1102 executes sending the requested log configuration parameters to the target device, and after receiving the log query instruction for the controlled device issued by the management terminal, so that the controlled device sends the log file of the controlled device to the server, and send the log query request to the control terminal so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request; receive the log files sent by the control terminal and the controlled device, and send the log files to the management terminal.

[0276] Optionally, the log query request carries an identifier of the target device; the identifier of the target device is generated based on a serial number of the target device and a query time.

[0277] Based on the log recording device provided by the embodiment of the present application, the log files of the controlled device are recorded locally on the controlled device, and the log files of the control application in the control terminal are recorded locally on the control terminal, instead of being recorded on the server, so there is no need to deploy multiple servers for storing operation logs of different services, thereby reducing the log recording cost. In addition, the server uniformly sets the log configuration parameters of the controlled device and the control application in the control terminal, which makes the log configuration parameter management more convenient.

[0278] The present application also provides an electronic device, such as Fig.12 As shown, including:

[0279] The memory 1201 is used to store computer programs; the processor 1202 is used to implement any of the steps of the above-mentioned log recording method when executing the program stored in the memory 1201.

[0280] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 1202, the communication interface, and the memory 1201 communicate with each other via the communication bus.

[0281] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0282] The communication interface is used for communication between the above electronic device and other devices.

[0283] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0284] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0285] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned logging methods are implemented.

[0286] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the log recording methods in the above embodiments.

[0287] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.

[0288] It should be noted that, in this article, relational terms such as first and second, etc. are only used 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", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including 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. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0289] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0290] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A log recording method, characterized in that: The method is applied to a target device, the target device communicates with a server, and the method includes: Sending a first acquisition request for acquiring log configuration parameters to a server, so that the server sends the requested log configuration parameters to the target device after receiving the first acquisition request; Setting the log configuration parameters of the target device according to the received log configuration parameters; If it is determined based on the log configuration parameters that the log recording condition is met, the operation log of the target device is recorded to obtain a log file.

2. The method according to claim 1, characterized in that The log configuration parameters include: at least one of the record name, record level, encryption key, and limit size of different business logs; The step of setting the log configuration parameters of the target device according to the received log configuration parameters includes: For each service of the target device, setting the acquired record name of the service as the target name when recording the operation log of the service; The acquired record level of the service is set as the level threshold when recording the operation log of the service; Setting the obtained encryption key as the target key for encryption when recording the operation log of the target device; The obtained limit size is set as the storage threshold of the operation log of the target device.

3. The method according to claim 2, characterized in that If it is determined based on the log configuration parameters that the log recording condition is met, the operation log of the target device is recorded to obtain a log file, including: For each service of the target device, when the record level of the operation log generated by the service is not less than the level threshold, determining that the log record condition of the service is met; Using the target secret key, encrypt the operation log generated by the business to obtain an encrypted operation log; The encrypted operation log is recorded to obtain a log file; wherein the name of the operation log of the business in the log file is the target name.

4. The method according to claim 3, characterized in that The encrypted operation log is recorded to obtain a log file, including: When the recorded logs reach the storage threshold, the encrypted operation logs are used to overwrite the recorded logs, and the encrypted operation logs are recorded to obtain a log file.

5. The method according to claim 2, characterized in that: If it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes: Sending a second acquisition request for obtaining the modified log configuration parameter to the server, so that the server sends the modified log configuration parameter to the target device after receiving the second acquisition request; wherein the modified log configuration parameter is sent to the server by a technician through a management terminal; and the modified log configuration parameter includes: at least one of a record name, a record level, and a limit size of different services; The log configuration parameters of the target device are updated according to the received modified log configuration parameters.

6. The method according to claim 2, characterized in that If it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes: Sending a third acquisition request for obtaining an updated encryption key to the server, so that the server sends the updated encryption key to the target device after receiving the third acquisition request; wherein the updated encryption key is generated by the server when a preset update cycle is reached; after receiving the updated encryption key, setting the updated encryption key as the target key for encryption when recording the operation log of the target device; or, After receiving the updated encryption key sent by the server, the updated encryption key is set as the target key for encryption when recording the operation log of the target device; wherein the updated encryption key is: sent by the technician to the server through the management terminal.

7. The method according to claim 1, characterized in that The target device is a control terminal installed with a control application for controlling the operation of the controlled device; If it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes: Receiving a log query request sent by the controlled device; wherein the log query request is: the controlled device forwards the log query request sent by the server to the control terminal after receiving the log query request; The log file of the control application in the control terminal is sent to the server, so that the server sends the log file to the management terminal after receiving the log file sent by the control terminal and the controlled device.

8. The method according to claim 1, characterized in that The target device is a controlled device running according to the control application installed in the control terminal; If it is determined based on the log configuration parameters that the log recording condition is met, after recording the operation log of the target device and obtaining the log file, the method further includes: Receive the log query request sent by the server; Send the log file of the controlled device to the server, and send the log query request to the control terminal, so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request, so that the server sends the log file to the management terminal after receiving the log file sent by the control terminal and the controlled device.

9. A log recording method, characterized in that: The method is applied to a server, the server communicates with a target device, and the method includes: Receiving a first acquisition request sent by the target device for acquiring log configuration parameters; The requested log configuration parameters are sent to the target device so that the target device sets the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file.

10. The method according to claim 9, characterized in that After sending the requested log configuration parameters to the target device, the method further includes: Receive the modified log configuration parameters sent by the technician through the management terminal; After receiving a second acquisition request sent by the target device for obtaining the modified log configuration parameters, the modified log configuration parameters are sent to the target device so that the target device updates the log configuration parameters of the target device according to the received modified log configuration parameters; wherein the modified log configuration parameters include: at least one of the record name, record level, and limit size of different services.

11. The method according to claim 9, characterized in that The log configuration parameters include: encryption key; After sending the requested log configuration parameters to the target device, the method further includes: When a preset update cycle is reached, an updated encryption key is generated; after receiving a third acquisition request sent by the target device for acquiring the updated encryption key, the updated encryption key is sent to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device; or, After receiving the updated encryption key sent by the technician through the management terminal, the updated encryption key is sent to the target device, so that after receiving the updated encryption key, the target device sets the updated encryption key as the target key for encryption when recording the operation log of the target device.

12. The method according to claim 9, characterized in that The target device includes: a control terminal installed with a control application for controlling the operation of the controlled device, and a controlled device operating according to the control application installed in the control terminal; After sending the requested log configuration parameters to the target device, the method further includes: After receiving the log query instruction for the controlled device issued by the management terminal, sending a log query request to the controlled device so that the controlled device sends the log file of the controlled device to the server, and sending the log query request to the control terminal so that the control terminal sends the log file of the control application in the control terminal to the server after receiving the log query request; Receive the log files sent by the control terminal and the controlled device, and send the log files to the management terminal.

13. The method according to claim 9, characterized in that The log query request carries the identifier of the target device; the identifier of the target device is generated based on the serial number of the target device and the query time.

14. A logging system, characterized in that: The system comprises: a server and a target device; The target device is used to send a first acquisition request for acquiring log configuration parameters to the server; The server is configured to send the requested log configuration parameter to the target device after receiving the first acquisition request; The target device is further used to set the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file.

15. A log recording device, characterized in that: The device is applied to a target device, the target device communicates with a server, and the device includes: A request sending module, used for sending a first acquisition request for acquiring log configuration parameters to a server, so that the server sends the requested log configuration parameters to the target device after receiving the first acquisition request; A parameter setting module, used to set the log configuration parameters of the target device according to the received log configuration parameters; The log recording module is used to record the operation log of the target device and obtain a log file if it is determined based on the log configuration parameters that the log recording conditions are met.

16. A log recording device, characterized in that: The device is applied to a server, the server communicates with a target device, and the device includes: A request receiving module, used for receiving a first acquisition request sent by the target device for acquiring log configuration parameters; The parameter sending module is used to send the requested log configuration parameters to the target device so that the target device sets the log configuration parameters of the target device according to the received log configuration parameters; if it is determined based on the log configuration parameters that the log recording conditions are met, the operation log of the target device is recorded to obtain a log file.

17. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-8, or 9-13, when executing a program stored in a memory.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 8 or 9 to 13 is implemented.