Log management methods, devices and storage media
By adopting a log file query method with centralized server-side management and format conversion, the problem of low log query efficiency in medical imaging applications is solved, and efficient log file management and secure querying across systems are achieved.
Patent Information
- Application Number
- CN202210713302.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-22
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-06-22
AI Technical Summary
In medical imaging applications, the low efficiency of log querying in various application software makes it difficult to locate problems.
The server receives log files from multiple clients, manages and converts them in a unified manner, and provides query services. Clients with different system environments are deployed on client devices to collect logs and send them to the server for centralized management.
It improves the efficiency of log file querying, reduces the need for frequent logins to multiple different system devices, saves device resources and costs, and ensures data transmission security and query efficiency.
Smart Images

Figure CN115033533B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a log management method, device and storage medium. Background Technology
[0002] A log is a time-ordered collection of operations performed on a specified system object and their results. Each log file consists of log records, and each log record describes a single system event. Log files can record necessary and valuable information for servers, workstations, firewalls, and application software, facilitating system monitoring and allowing users to pinpoint specific problems when they occur.
[0003] Currently, in applications related to medical imaging technology, a considerable number of medical imaging-related software applications are typically used, and these are mostly installed on different devices. During the operation of each application, its logs are also stored on its respective device.
[0004] However, when problems arise during actual medical imaging applications or processing, using the above-mentioned techniques to check the logs of various application software to locate the problem results in low query efficiency. Summary of the Invention
[0005] Therefore, it is necessary to provide a log management method, device, and storage medium that can improve log query efficiency in response to the above-mentioned technical problems.
[0006] Firstly, this application provides a log management method applied to a server, the method comprising:
[0007] The server receives log files sent by multiple clients; each client is deployed on a corresponding client device, and each client device has a corresponding system environment. Each client is deployed in at least two different system environments; the server is deployed in the system environment of any one of the target client devices; the client is used to collect log files on the corresponding client device.
[0008] The server manages each log file and provides query services for each managed log file.
[0009] In one embodiment, the server receives log files sent by multiple clients, including:
[0010] The server receives data transmission requests from each client; each data transmission request includes the corresponding client's verification identifier.
[0011] The server performs validity checks on the corresponding clients based on each verification identifier;
[0012] If the validity of the first client among multiple clients is successfully verified, the server will receive the log file sent by the first client.
[0013] If the validity verification of the second client among multiple clients fails, the server discards the data transmission request sent by the second client and returns a verification failure message to the second client.
[0014] In one embodiment, the server manages the log files, including:
[0015] The server processes all log files into the same file format.
[0016] In one embodiment, the server uniformly processes all log files into the same file format, including:
[0017] The server converts the filenames of each log file into new filenames composed of their respective attribute information, thereby obtaining the target log file corresponding to each log file;
[0018] The log file's attribute information includes at least one of the following: the name of the application software that generated the log file, the Internet Protocol IP address of the client device corresponding to the log file, and the physical MAC address of the client device corresponding to the log file.
[0019] In one embodiment, the server manages the log files, including:
[0020] In response to the log deletion completion message sent by the client, the server performs deletion operations on each log file on the target client device based on the disk usage rate of the target client device and / or the storage duration of each log file;
[0021] The log deletion completion message sent by the client is sent to the server after the logs on the client device have been completely deleted.
[0022] In one embodiment, the server performs deletion operations on each log file on the target client device based on the disk usage rate of the target client device, including:
[0023] If the disk usage of the target client device exceeds the preset threshold, then all log files on the target client device will be deleted.
[0024] In one embodiment, the server performs deletion operations on each log file on the target client device based on the storage duration of each log file, including:
[0025] If the storage time of each log file exceeds the first preset storage time, then each log file on the target client device will be deleted.
[0026] In one embodiment, the above-described deletion operation on each log file on the target client device includes:
[0027] The server deletes log files on the target client device within the second preset storage period.
[0028] In one embodiment, before the server manages the log files, the method further includes:
[0029] The server writes the log file to the designated storage space on the target client device and returns a response message to the client after writing is complete.
[0030] The response message includes information such as successful log writing and the first verification result of the log file. The response message is used to instruct the client to determine whether the corresponding log file on the client device needs to be deleted.
[0031] In one embodiment, the first verification result of the log file is the first hash value of the log file, which is obtained by the server calculating the log file.
[0032] In one embodiment, the method further includes:
[0033] Verify the user's permissions based on the login identifier entered by the user on the browser page;
[0034] If the permission verification is successful, the user is allowed to access each log file.
[0035] Secondly, this application also provides a log management method applied to a client, the method comprising:
[0036] Each client sends a data transmission request to the server; each data transmission request includes a verification identifier for each client, which instructs the server to verify the legitimacy of the client; each client is deployed on a corresponding client device, and each client device is deployed in a corresponding system environment, with each client deployed in at least two different system environments; the server is deployed in the system environment of any one of the target client devices; the client is used to collect log files on the corresponding client device.
[0037] If the validity verification of each client is successful, each client sends its own log file to the server. This log file is used to instruct the server to manage each log file and to provide query services for the managed log files.
[0038] In one embodiment, the method further includes:
[0039] The client receives a response message from the server; this response message includes information about successful log writing and the first verification result of the log file.
[0040] The client retrieves the second verification result corresponding to the log file on the corresponding client device;
[0041] The client determines whether to delete the corresponding log file on the client device by comparing the consistency of the first and second verification results.
[0042] In one embodiment, the client determines whether to delete the corresponding log file on the client device based on a consistency comparison between the first verification result and the second verification result, including:
[0043] If the first verification result and the second verification result are consistent, the client will delete the corresponding log file on the client device.
[0044] In one embodiment, the first verification result is the first hash value of the log file, which is obtained by the server calculating the log file.
[0045] The second verification result is the second hash value of the log file, which is obtained by the client calculating the log file.
[0046] In one embodiment, each of the aforementioned clients sends a data transmission request to the server, including:
[0047] Each client sends a data transmission request to the server at preset time intervals.
[0048] Thirdly, this application also provides a log management device, which includes:
[0049] The receiving module is used to receive log files sent by multiple clients; each client is deployed on a corresponding client device, and each client device has a corresponding system environment. Each client is deployed in at least two different system environments; the server is deployed in the system environment of any one of the target client devices; the client is used to collect log files on the corresponding client device.
[0050] The management module is used to manage various log files and provide query services for the managed log files.
[0051] Fourthly, this application also provides a log management device, which includes:
[0052] The request sending module is used to send data sending requests to the server. Each data sending request includes a verification identifier for each client, which instructs the server to verify the client's legitimacy. Each client is deployed on a corresponding client device, and each client device is deployed in a corresponding system environment. Each client is deployed in at least two different system environments. The server is deployed in the system environment of any one of the target client devices. The client is used to collect log files on the corresponding client device.
[0053] The file sending module is used to send each client's log file to the server if the client's validity is successfully verified. This log file is used to instruct the server to manage each log file and to provide query services for each managed log file.
[0054] Fifthly, this application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and a client and a server are arranged on the device. When the processor executes the computer program, it controls the server to implement the method steps of the first aspect described above.
[0055] Sixthly, this application also provides a computer device including a memory and a processor. The memory stores a computer program, and a client is disposed on the device. When the processor executes the computer program, it controls the client to implement the method steps of the second aspect described above.
[0056] In a seventh aspect, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method steps of the first and second aspects described above.
[0057] Eighthly, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the method steps of the first and second aspects described above.
[0058] The aforementioned log management method, device, and storage medium receive log files from multiple clients via a server, manage these log files, and provide query services for the managed log files. Each client is deployed on a corresponding client device, and each client device has a corresponding system environment. Each client is deployed in at least two different system environments. The server is deployed in the system environment of any target client device. Each client is used to collect log files from its corresponding client device. In this method, since the server device is any of the client devices, no additional equipment needs to be deployed for the server, thus saving equipment resources and costs. Furthermore, since the multiple client devices are deployed in different system environments, cross-system operation of log files is possible. Moreover, by collecting logs from multiple devices deployed in different system environments for centralized management, frequent logins to multiple different system devices are avoided, thereby improving the efficiency of log file querying. Attached Figure Description
[0059] Figure 1 This is an internal structural diagram of a computer device in one embodiment;
[0060] Figure 2 This is a flowchart illustrating a log management method in one embodiment;
[0061] Figure 3 This is a flowchart illustrating the log management method in another embodiment;
[0062] Figure 4 This is a flowchart illustrating the log management method in another embodiment;
[0063] Figure 5 This is a flowchart illustrating the log management method in another embodiment;
[0064] Figure 6 This is a flowchart illustrating the log management method in another embodiment;
[0065] Figure 7 This is a schematic diagram illustrating the specific process of the log management method in another embodiment;
[0066] Figure 8 This is a structural block diagram of a log management device in one embodiment;
[0067] Figure 9 This is a structural block diagram of a log management device in one embodiment. Detailed Implementation
[0068] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0069] The log management method provided in this application embodiment can be applied to computer devices, which can be servers or terminals. Taking a server as an example, its internal structure diagram can be as follows: Figure 1 As shown. This computer device can house both server and client components, or only client components. It also contains a corresponding system environment, such as Windows or Linux; the client or server can run on this system environment. Furthermore, a single computer device can deploy one system environment or multiple different system environments. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media to run. The database stores log data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a log management method.
[0070] Those skilled in the art will understand that Figure 1 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0071] It should be noted that the technical solutions of the following embodiments of this application are all described based on the C / S architecture, where C refers to Client and S refers to Server. The client can interact with the server.
[0072] The following embodiments first describe the technical solution on the server side.
[0073] In one embodiment, such as Figure 2 As shown, a log management method is provided, which can be applied to... Figure 1 Taking a computer device with a server and client deployed on it as an example, the method may include the following steps:
[0074] S202, the server receives log files sent by multiple clients.
[0075] Each client is deployed on its corresponding client device, meaning each client can be deployed on its own client device. At least two clients may be deployed on the same client device, meaning multiple clients can be deployed on one client device.
[0076] Each client device has a corresponding system environment deployed on it; that is, each client device has a system environment deployed on it. This can be one system environment or multiple system environments deployed on it. The system environment here can be, for example, Windows, Linux, etc.
[0077] Each client is deployed in at least two different system environments; that is, at least two of the clients are deployed in two different system environments. The clients deployed in different system environments can be clients that match the corresponding system environment. For example, a client deployed in a Windows system environment could be client.exe, and a client deployed in a Linux system environment could be client.sh. For instance, suppose there are 5 clients, where 3 clients are deployed in the Windows system environment and the other 2 clients are deployed in the Linux system environment.
[0078] Additionally, assuming a client device has only one operating system environment, then only one client application compatible with that system environment can be installed on that device. For example, a client device with only a Windows operating system environment can have only one client application (client.exe) installed, compatible with the Windows operating system environment.
[0079] This assumes that a single client device can host multiple system environments. Therefore, a client program matching the specific system environment can be installed on each environment. In other words, a single client device can host multiple system environments and multiple clients. For example, if a client device can host both Windows and Linux system environments, a matching client.exe can be installed in the Windows environment, and a matching client.sh can be installed in the Linux environment. It's important to note that regardless of the number of system environments installed on the client device, if multiple system environments need to run simultaneously, generally only one system environment can run on the actual machine; the others must run on virtual machines within that machine.
[0080] After installing the client on all the aforementioned client devices, each client can collect log files from its corresponding client device. It's important to note that if a client device has only one system environment and one client installed, then that client will only collect logs generated by applications within that system environment; that is, it will collect logs from that specific client device. Conversely, if a client device has multiple system environments and corresponding clients installed, then each client will collect logs generated by applications within its respective system environment; that is, one client device will correspond to logs collected by multiple clients.
[0081] After the client collects logs from the corresponding client device, each client, once running, can send its collected logs to the server. The server can be deployed in the system environment of any of the target client devices. This target client device has both the client and server installed, and they can interact. The target client device can be a client device with a large memory capacity; in this embodiment, it refers to the computer device.
[0082] S204, the server manages each log file and provides query services for each managed log file.
[0083] In this step, after receiving the log files sent by each client, the server can store each log file in the storage space set for the server on the target client device. Then, the server can manage each log file, which can include management operations such as format conversion, deletion, and verification of log files.
[0084] In addition, the server can also provide users with a query service for each log file. Through this service, users can query the log files received by the server within the storage space set for the server on the target client device.
[0085] As described above, this solution can collect logs from the corresponding client devices after running on the client devices deployed in various system environments, and send them to the communication server. The log files can then be queried on the target client device where the server is located through the services provided on the server. This eliminates the need to repeatedly log in to client devices in multiple different system environments, thereby improving the efficiency of log file retrieval.
[0086] In the aforementioned log management method, a server receives log files sent by multiple clients, manages these log files, and provides query services for the managed log files. Each client is deployed on a corresponding client device, and each client device has a corresponding system environment. Each client is deployed in at least two different system environments. The server is deployed in the system environment of any one of the target client devices. Each client is used to collect log files from its corresponding client device. In this method, since the server device is any of the client devices, no additional equipment needs to be deployed for the server, thus saving equipment resources and costs. Furthermore, since the multiple client devices are deployed in different system environments, cross-system operation of log files is possible. Moreover, by collecting logs from multiple devices deployed in different system environments for centralized management, frequent logins to multiple different system devices are avoided, thereby improving the efficiency of log file querying.
[0087] The above embodiments mention that the server can communicate with multiple clients simultaneously and receive log files sent by each client. Before receiving the log files, the server can also verify each client to determine whether to receive the log files sent by each client. The following embodiments illustrate this process.
[0088] In another embodiment, another log management method is provided, based on the above embodiments, such as... Figure 3 As shown, the above S202 may include the following steps:
[0089] S302, the server receives data transmission requests from each client; each data transmission request includes the corresponding client's verification identifier.
[0090] In this step, after each client runs, it automatically establishes a communication connection with the server. After establishing communication, each client first sends a data transmission request to the server. Each client's data transmission request can include its own client verification identifier, such as a client token or client key.
[0091] S304, the server performs a validity check on the corresponding client based on each verification identifier.
[0092] In this step, after receiving data transmission requests from each client, the server matches each client's verification identifier with the corresponding verification identifier pre-stored on the server to obtain the validity verification result for each client. If the client's verification identifier matches the corresponding verification identifier pre-stored on the server, the client's validity verification is considered successful; otherwise, the client's validity verification is considered to have failed.
[0093] S306 If the validity verification of the first client among multiple clients is successful, the server will receive the log file sent by the first client.
[0094] In this step, if the validity verification of the first client is successful, it indicates that the first client is a legitimate client, and the server can receive the log file sent by the first client.
[0095] S308 If the validity verification of the second client among multiple clients fails, the server discards the data transmission request sent by the second client and returns a verification failure message to the second client.
[0096] In this step, the second client is not the same as the first client. If the validity check of the second client fails, it indicates that the second client is an invalid client. The server can discard the data sending request sent by the second client, return a verification failure message to the second client, and reject the log file sent by the second client to the server.
[0097] In this embodiment, the server receives and verifies the verification identifiers sent by each client. If the verification is successful, the server can receive the log file sent by the client that has successfully verified the identifier. If the verification fails, the server discards the data transmission request of the client that failed the verification and prohibits the client that failed the verification from sending the log file. This can prevent unauthorized clients from sending malicious files to the server and affecting the security of the device on which the server is located. This ensures the security of the log file received by the server and the security of the device on which the server is located, that is, it ensures the security of data transmission between the server and the client.
[0098] The above embodiments mentioned that the server can manage each log file. Management can include various operations. The following embodiments will describe the case where the management operation is to convert the format of the log file.
[0099] In another embodiment, another log management method is provided. Based on the above embodiment, S204 may include the following step A:
[0100] Step A: The server processes all log files into the same file format.
[0101] In this step, after receiving multiple log files from each client, the server can convert the formats of the other log files to the format of one of the log files, thus unifying the processing of all log files into the same file format. Alternatively, it can convert all log files to the same file format, achieving the same file format for all log files. Other format conversion methods are also possible, but no specific limitations are specified here.
[0102] In this embodiment, the server unifies all log files into the same file format, which facilitates unified management of all log files and improves management efficiency. At the same time, the same format makes it easier to search, thereby improving the efficiency of querying log files.
[0103] The following embodiments primarily illustrate a possible implementation where all log files are converted to the same file format. Based on the above embodiments, step A may include the following steps:
[0104] The server converts the filenames of each log file into new filenames composed of their respective attribute information, thus obtaining the target log file corresponding to each log file.
[0105] The log file's attribute information includes at least one of the following: the name of the application software that generated the log file, the Internet Protocol IP address of the client device corresponding to the log file, and the physical MAC address of the client device corresponding to the log file.
[0106] In this step, when each client sends logs to the server, the server can also obtain attribute information such as the IP address and MAC address of the client device corresponding to each client, as well as the application software that generated the log (i.e., the name of the application software that generated the log file). Afterwards, the server can modify the filename of each log file sent by each client according to this attribute information, obtaining the new filenames for each log file. These newly named log files are all recorded as the target log files.
[0107] In addition, when using various attribute information for naming, for example, the application software name, IP address, and MAC address can be concatenated to form a new file name. For example, the application software name-IP address-MAC address can be used as a new file name for a log file.
[0108] It should be noted that this only changes the name of the log file; the actual content of the log file will not be modified.
[0109] In this embodiment, the server obtains the renamed target log file by converting the filenames of each log file into new filenames composed of their corresponding attribute information. This makes it easier to distinguish the origin of each log file, allowing for quick location of the specific application software through the logs during querying, further improving query efficiency.
[0110] The following example illustrates the scenario where a management operation involves deleting log files stored on the target client device where the server resides.
[0111] In another embodiment, another log management method is provided. Based on the above embodiment, S204 may include the following step B:
[0112] Step B: In response to the log deletion completion message sent by the client, the server performs deletion operations on each log file on the target client device based on the disk usage rate of the target client device and / or the storage duration of each log file.
[0113] The log deletion completion message sent by the client is sent to the server after the logs on the client device have been completely deleted.
[0114] In this step, after the client sends its log file to the server, the server can store the received log file in the storage space designated on the target client device. After storage is complete, the client device can delete the sent and stored log file. The client then sends a deletion completion message to the server, which confirms that the log file has been deleted from the client device. Subsequently, the server can perform deletion operations on each log file on the target client device based on the target client device's disk usage and / or the storage duration of each log file.
[0115] Here, the server deletes the log file only after the log sent is deleted on the client device corresponding to the client. This avoids the server accidentally deleting the log file, which could affect subsequent log file queries and other issues.
[0116] The following describes several possible implementation methods for deleting log files on the server side.
[0117] In one possible implementation, if the disk usage of the target client device exceeds a preset usage threshold, then each log file on the target client device is deleted.
[0118] The preset disk usage threshold can be set according to actual conditions, such as 70%, 80%, etc. While continuously storing log files, the server can also monitor or view the current disk usage of the target client device in real time and compare it with the preset threshold. If the disk usage exceeds the preset threshold, log files on the target client device can be deleted; if the disk usage does not exceed the preset threshold, the server can determine the subsequent storage duration or continue storing log files on the target client device.
[0119] In another possible implementation, if the storage time of each log file exceeds a first preset storage time, then each log file on the target client device is deleted.
[0120] The first preset storage duration can also be determined based on the actual storage duration of each log file, such as 6 months, 1 year, 1.5 years, 2 years, etc. While continuously storing log files, the server can also know or view the storage duration of each log file in real time and determine whether the storage duration of each log file exceeds the first preset storage duration. Alternatively, it can determine whether the storage duration of the oldest log file exceeds the first preset storage duration. If it exceeds the first preset storage duration, the log files on the target client device can be deleted; if it does not exceed the first preset storage duration, the log files will continue to be stored on the target client device.
[0121] All of the above mentioned that log files on the target client device can be deleted. Optionally, the server can delete log files within a second preset storage period on the target client device.
[0122] The second preset storage duration can be the same as or different from the first preset duration, or it can be set according to the actual situation. For example, the second preset duration can be the oldest 3 days, the oldest 10 days, etc. When the server needs to delete log files on the client device, it can delete the log files within the second preset storage duration according to the storage duration of each log file. For example, it can delete the log files stored for the oldest 3 days.
[0123] In this embodiment, the server can delete log files on the target client device based on the target client device's disk usage or the log file's storage duration. This effectively deletes log files on the target client device corresponding to the server, reducing disk usage on the target client device. Furthermore, by deleting log files when disk usage exceeds a threshold or when the log file's storage duration exceeds a set duration, the server can quickly and easily determine which logs need to be deleted, improving the accuracy and efficiency of log deletion. Moreover, when deleting logs, log files within a preset storage duration can be deleted, maximizing the retention of the latest log files and facilitating user querying and troubleshooting.
[0124] The above embodiments mention that the server can store and manage the received log files. In practice, in order to facilitate the client device to delete the log files, the server can also send the verification result of the log files back to the client so that the client device can delete the log files. The following embodiments will describe this process.
[0125] In another embodiment, another log management method is provided. Based on the above embodiment, before step S204, the method may further include the following step C:
[0126] Step C: The server writes the log file to the designated storage space on the target client device and returns a response message to the client after writing is complete.
[0127] The response message includes information such as successful log writing and the first verification result of the log file. The response message is used to instruct the client to determine whether the corresponding log file on the client device needs to be deleted.
[0128] Specifically, the storage space set here refers to the storage space that the target client device pre-allocates for storing log files on the server. When the server stores the log file sent by the client into the set storage space, it can first determine whether the log file has been written successfully (for example, by checking if the log file exists in the set storage space; if it exists, the writing was successful; otherwise, the writing failed). After the log file is successfully written, the server can send a response message to the client, including a message indicating that the log file was successfully written and the first verification result of the log file. The message indicating that the log file was successfully written can include the file identifier of the log file and the confirmation that the writing was successful. After receiving this response message, the client can determine whether it needs to delete the log file corresponding to the file identifier on the corresponding client device based on the content of the response message.
[0129] Optionally, the first verification result of the aforementioned log file is the first hash value of the log file, which is calculated by the server. That is, after the server successfully writes the log file, it can use a hash algorithm to calculate the first hash value of the log file, and send the first hash value as part of the response message to the client, so that the client can quickly determine whether the log file needs to be deleted based on the first hash value.
[0130] In this embodiment, after the server completes writing the log file, it can send a response message to the client indicating successful log writing and the first verification result of the log file. The server then instructs the client to determine whether to delete the log file on its corresponding client device. This response message accurately informs the client to delete the log file, improving the accuracy of log file deletion. Furthermore, the first verification result is a first hash value, which allows the client to perform quick and accurate verification using the first hash value, improving the efficiency and accuracy of log deletion.
[0131] The following examples illustrate how users access log files after the server provides log query services to them.
[0132] In another embodiment, another log management method is provided, based on the above embodiments, such as... Figure 4 As shown, the above method may further include the following steps:
[0133] S402 verifies the user's permissions on the browser page based on the login identifier entered by the user.
[0134] Here, the browser page can be a web page on the user's computer or mobile phone. On this web page, the user can enter a login identifier. A computer remotely connected to the device hosting the browser page can then obtain this login identifier and verify the user's permissions using it. The login identifier can be a username, password, mobile phone number, etc.
[0135] S404 If the permission verification is successful, the user is allowed to access each log file.
[0136] In this step, the remotely connected computer device, as mentioned in this embodiment, can verify the user's permissions. For example, it can compare the user's identifier with a preset user identifier. If the comparison is successful, it indicates that the user's permissions have been successfully verified; otherwise, the verification has failed. After the user's permissions are successfully verified, the computer device can allow the user to access the various log files stored on the target client device corresponding to the server.
[0137] In this embodiment, user permissions are verified by the login identifier entered by the user on the browser page, and the user is allowed to access various log files stored on the server when the verification is successful. This can improve the user experience by enabling all users to access logs through a unified entry point, and also ensure the security of access logs.
[0138] In another embodiment, the above-mentioned service-side method steps are all implemented using the Go language. When supporting cross-system environments, Go does not require the installation of additional software for system environment deployment, has stronger compatibility, and can simplify the difficulty of system environment configuration under cross-systems, thereby reducing the difficulty of log management under cross-systems.
[0139] The following embodiments will then describe the technical solution on the client side.
[0140] In one embodiment, such as Figure 5 As shown, a log management method is provided, which can be applied to... Figure 1 Taking a computer device, where only the client is deployed, as an example, the method may include the following steps:
[0141] S502, each client sends a data transmission request to the server.
[0142] Each data transmission request includes a verification identifier for each client, which instructs the server to verify the client's legitimacy. Each client is deployed on a corresponding client device, and each client device is deployed in a corresponding system environment. Each client is deployed in at least two different system environments. The server is deployed in the system environment of any one of the target client devices. The client is used to collect log files on the corresponding client device.
[0143] For details regarding the content and process of sending data requests, please refer to the explanation in S302 above; it will not be repeated here. For the specific arrangements of each client, please refer to the explanation in S202 above; it will also not be repeated here.
[0144] It should be noted that, to avoid issues such as client data transmission failures or server reception failures due to poor network signal, optionally, each client sends a data transmission request to the server at preset time intervals. These preset time intervals can be set according to actual needs, for example, 100ms, 500ms, 1 second, etc. By sending data transmission requests to the server at these preset time intervals, the client ensures successful transmission of requests and successful reception by the server, thereby guaranteeing the successful transmission of subsequent log files between the client and server.
[0145] S504 If the validity verification of each client is successful, each client sends its own log file to the server; the log file is used to instruct the server to manage each log file and to provide query services for each managed log file.
[0146] For an explanation of this step, please refer to the explanations of S204 and S304-S308 above, which will not be repeated here.
[0147] In this embodiment, each client sends a data transmission request to the server. After the server successfully verifies the legitimacy of each client based on the data transmission request, it instructs the server to receive and manage the log files sent by each client, and provides query services for the managed log files. Each client is deployed on a corresponding client device, and each client device has a corresponding system environment. Each client is deployed in at least two different system environments. The server is deployed in the system environment of any target client device. Each client is used to collect log files from its corresponding client device. In this method, since the server device is any of the client devices, no additional equipment needs to be deployed for the server, thus saving equipment resources and costs. Furthermore, since multiple client devices are deployed in different system environments, cross-system operation of log files is possible. Moreover, by collecting and centrally managing logs from multiple devices deployed in different system environments, frequent logins to multiple different system devices are avoided, thus improving log file query efficiency. Furthermore, by allowing log file transmission to the server only after successful client legitimacy verification, the security of data transmission between the client and the server is guaranteed.
[0148] In another embodiment, another log management method is provided, based on the above embodiments, such as... Figure 6 As shown, the above method may further include the following steps:
[0149] S602, the client receives a response message sent by the server; the response message includes the log writing success and the first verification result of the log file.
[0150] For an explanation of this step, please refer to the explanation in step C above, which will not be repeated here.
[0151] S604, the client obtains the second verification result corresponding to the log file on the corresponding client device.
[0152] In this step, after the client receives the response message sent by the server, the log write success message can include the file identifier of the log file that was successfully written and the write success message. The client can obtain the log file corresponding to the file identifier in the log storage space of the corresponding client device, and calculate the second verification result by the verification algorithm.
[0153] S606: The client determines whether to delete the corresponding log file on the client device by comparing the consistency of the first and second verification results.
[0154] In this step, after obtaining the first and second verification results of the log file corresponding to the file identifier, the client can compare the two verification results. Optionally, if the first and second verification results are consistent, the client can delete the corresponding log file on the client device. That is, if the two verification results are consistent, it can be said that the log file successfully written on the server and the log file on the client device are the same log file, so the log file on the client device can be deleted to save memory on the client device.
[0155] Optionally, the first verification result and the second verification result can be the first hash value of the log file, calculated by the server; and the second verification result can be the second hash value of the log file, calculated by the client. Both the first and second hash values can be obtained by calculating the same log file using a hash algorithm.
[0156] In this embodiment, the client receives a response message from the server that includes a successful log write and a first verification result of the log file. The client then compares the first verification result with a second verification result calculated on the log file. The comparison result determines whether to delete the log file on the client device, ensuring that the client does not accidentally delete log files. Furthermore, the log file can be deleted only when the first and second verification results match, ensuring accurate deletion of log files stored on the server and saving memory on the client device. Moreover, comparing two hash values to obtain the consistency comparison result of the first and second verification results improves the efficiency of the client's comparison, thereby improving the efficiency of the client in deleting log files.
[0157] To facilitate a more detailed description of the technical solutions of the embodiments of this application, the following description uses a specific embodiment to illustrate the technical solutions of this application. (See also...) Figure 7 As shown, the specific process of this method is as follows: First, the timer on the client side is triggered, and each client starts up (i.e., the Windows server and Linux server in the figure). It is determined whether it is the log sending time. If it is not the log sending time, the logs currently generated by the application software on the client's corresponding client device are kept locally (i.e., stored on the client's corresponding client device). If it is the log sending time, the client sends the logs (including log files and data sending requests) to the server. At the same time, the server starts a service daemon process to receive the data sending requests sent by the client, and verifies the client's verification identifier (i.e., the token in the figure). If the verification is successful, the server receives the log files sent by the client and converts the names of each log file according to the application software name that generated the log files (i.e., the log module name in the figure) - the IP address of the client's client device - the MAC address of the client's client device to obtain the target log file (i.e., the generated directory structure in the figure).
[0158] Afterwards, the server can write the log file to the target client device's preset storage space (i.e., the corresponding directory in the diagram), and determine whether the log file was written successfully. If the log file writing fails, the server returns a write error to the client and ends the process; if the log file is written successfully, the server calculates the hash value of the log file (i.e., reading the server file hash in the diagram), and returns a log reception success message and the log file hash to the client. Afterwards, the server can start a web-go service, through which users can access the logs in their browser.
[0159] In addition, after the server returns a message to the client indicating that the log file has been successfully received and the hash of the log file, the client can read the hash of the log file returned by the server and compare it with the hash of the same log file on its local machine. If they match, the client deletes the log file stored locally and ends the process. If they do not match, the client continues to save the logs currently generated by the application software locally.
[0160] For the server side, a scheduled task can be started to delete log files on the target client device according to a certain strategy. The strategy may include: checking if disk usage exceeds 80%. If disk usage exceeds 80%, delete the oldest log files (up to three days old). If disk usage does not exceed 80%, check if the oldest log file has been stored for 6 months. If it has, delete the oldest log files (up to three days old). If it has not, continue storing log files without deleting them.
[0161] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0162] Based on the same inventive concept, this application also provides a log management device for implementing the log management method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more log management device embodiments provided below can be found in the limitations of the log management method described above, and will not be repeated here.
[0163] In one embodiment, such as Figure 8 As shown, a log management device is provided for use on a server side, including a receiving module 11 and a management module 12, wherein:
[0164] The receiving module 11 is used to receive log files sent by multiple clients; each client is deployed on a corresponding client device, each client device is deployed on a corresponding system environment, and each client is deployed in at least two different system environments; the server is deployed in the system environment of any one of the target client devices; the client is used to collect log files on the corresponding client device.
[0165] The management module 12 is used to manage each log file and provide query services for each managed log file.
[0166] In another embodiment, another log management device is provided. Based on the above embodiments, the receiving module 11 may include:
[0167] The request receiving unit is used to receive data sending requests from each client; each data sending request includes the corresponding client's verification identifier.
[0168] The verification unit is used to verify the legitimacy of the corresponding client based on each verification identifier;
[0169] The receiving unit is used to receive the log file sent by the first client if the validity verification of the first client among multiple clients is successful.
[0170] The return unit is used to discard the data transmission request sent by the second client if the validity verification of the second client among multiple clients fails, and to return a verification failure message to the second client.
[0171] In another embodiment, another log management device is provided. Based on the above embodiments, the management module 12 may include:
[0172] The format processing unit is used to unify the format of each log file into the same file format.
[0173] Optionally, the above-mentioned format processing unit is specifically used by the server to convert the file names of each log file into new file names composed of their respective attribute information, thereby obtaining the target log file corresponding to each log file; wherein, the attribute information of the log file includes at least one of the following: the name of the application software that generated the log file, the Internet Protocol IP address of the client device corresponding to the log file, and the physical MAC address of the client device corresponding to the log file.
[0174] In another embodiment, another log management device is provided. Based on the above embodiments, the management module 12 may include:
[0175] The deletion unit is used to respond to the log deletion completion message sent by the client, and to delete each log file on the target client device according to the disk usage rate of the target client device and / or the storage duration of each log file; wherein, the log deletion completion message sent by the client is sent to the server after the logs on the corresponding client device have been deleted.
[0176] Optionally, the above deletion unit is specifically used to delete each log file on the target client device if the disk usage rate of the target client device exceeds a preset usage threshold.
[0177] Optionally, the above-mentioned deletion unit is specifically used to delete each log file on the target client device if the storage time of each log file exceeds the first preset storage time.
[0178] Optionally, the above-mentioned deletion unit is specifically used to delete log files within a second preset storage period on the target client device.
[0179] In another embodiment, another log management device is provided. Based on the above embodiments, before the management module 12 manages the log files, the device may further include:
[0180] The writing module is used to write log files to a designated storage space on the target client device and return a response message to the client after writing is complete. The response message includes the log writing success and the first verification result of the log file, and the response message is used to instruct the client to determine whether the corresponding log file on the client device needs to be deleted.
[0181] Optionally, the first verification result of the above log file is the first hash value of the log file, which is obtained by the server calculating the log file.
[0182] In another embodiment, a different log management device is provided, which, based on the above embodiments, may further include:
[0183] The verification module is used to verify a user's permissions on the browser page based on the login identifier entered by the user;
[0184] The access module is used to allow users to access various log files if permission verification is successful.
[0185] In one embodiment, such as Figure 9 As shown, a log management device is provided for a client application, including a request sending module 21 and a file sending module 22, wherein:
[0186] The request sending module 21 is used to send data sending requests to the server. Each data sending request includes a verification identifier for each client, which is used to instruct the server to perform a validity check on the client. Each client is deployed on a corresponding client device, and each client device is deployed in a corresponding system environment. Each client is deployed in at least two different system environments. The server is deployed in the system environment of any one of the target client devices. The client is used to collect log files on the corresponding client device.
[0187] The file sending module 22 is used to send each client's log file to the server if the client's validity is successfully verified. The log file is used to instruct the server to manage each log file and to provide query services for each managed log file.
[0188] In another embodiment, a different log management device is provided, which, based on the above embodiments, may further include:
[0189] The response message receiving module is used to receive response messages sent by the server; the response message includes the log writing success and the first verification result of the log file;
[0190] The acquisition module is used to obtain the second verification result corresponding to the log file on the corresponding client device;
[0191] The deletion module is used to determine whether the corresponding log file on the client device needs to be deleted based on the consistency comparison between the first and second verification results.
[0192] Optionally, the above deletion module may include:
[0193] The deletion unit is used to delete the corresponding log file on the client device if the first verification result and the second verification result are consistent.
[0194] Optionally, the first verification result is the first hash value of the log file, which is calculated by the server on the log file; the second verification result is the second hash value of the log file, which is calculated by the client on the log file.
[0195] In another embodiment, another log management device is provided. Based on the above embodiments, the request sending module 21 may include:
[0196] The request sending unit is used to send data sending requests to the server at preset time intervals.
[0197] Each module in the aforementioned log management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0198] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and a client and a server are disposed on the device. When the processor executes the computer program, it implements the steps in the above-described server-side method embodiments.
[0199] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, a client disposed on the device, and the processor executing the computer program to implement the steps in the client-side method embodiments described above.
[0200] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0201] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0202] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0203] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0204] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0205] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A log management method, characterized in that, The method includes: The server receives log files sent by multiple clients; each client is deployed on a corresponding client device, and each client device is deployed with multiple corresponding system environments and multiple clients, and each client is deployed in at least two different system environments; the server is deployed in the system environment of any one of the target client devices; the client is used to collect log files on the corresponding client device. The server manages each of the log files and provides query services for each of the managed log files.
2. The method according to claim 1, characterized in that, The server receives log files sent by multiple clients, including: The server receives data sending requests from each of the clients; each data sending request includes a verification identifier for the corresponding client. The server performs a legality check on the corresponding client based on each of the verification identifiers; If the validity verification of the first client among the plurality of clients is successful, the server receives the log file sent by the first client; If the validity verification of the second client among the multiple clients fails, the server discards the data transmission request sent by the second client and returns a verification failure message to the second client.
3. The method according to claim 1, characterized in that, The server manages each of the log files, including: The server will process all the log files into the same file format.
4. The method according to claim 1, characterized in that, The server manages each of the log files, including: In response to the log deletion completion message sent by the client, the server performs a deletion operation on each log file on the target client device based on the disk usage rate of the target client device and / or the storage duration of each log file; The log deletion completion message sent by the client is sent to the server after the logs on the client device corresponding to the client have been completely deleted.
5. The method according to claim 1, wherein Before the server manages each of the log files, the method further includes: The server writes the log file to a designated storage space on the target client device and returns a response message to the client after writing is complete. The response message includes a log write success and a first verification result of the log file, and the response message is used to instruct the client to determine whether it is necessary to delete the corresponding log file on the client device.
6. A log management method, characterized in that, The method includes: Each client sends a data transmission request to the server; each data transmission request includes a verification identifier for the client, which instructs the server to perform a validity check on the client; each client is deployed on a corresponding client device, and each client device is configured with multiple corresponding system environments and multiple clients, with each client deployed in at least two different system environments; the server is deployed in the system environment of any one of the target client devices; the client is used to collect log files on the corresponding client device; If the validity verification of each client is successful, each client sends its own log file to the server; the log file is used to instruct the server to manage each log file and provide query services for each managed log file.
7. The method according to claim 6, characterized in that, The method further includes: The client receives a response message sent by the server; the response message includes a successful log write and a first verification result of the log file. The client obtains the second verification result corresponding to the log file on the corresponding client device; The client determines whether to delete the corresponding log file on the client device based on the consistency comparison result of the first verification result and the second verification result.
8. A device comprising a memory and a processor, said memory storing a computer program, characterized in that, The device is equipped with a client and a server, and when the processor executes the computer program, it controls the server to implement the steps of the method according to any one of claims 1 to 5.
9. A device comprising a memory and a processor, the memory storing a computer program, characterized in that, A client is disposed on the device, and when the processor executes the computer program, it controls the client to implement the steps of the method according to any one of claims 6 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Log management method and terminal device based on exception monitoring
CN109284267A
Log collection system, method and device, server and storage medium
CN110519077A
Client log recovery method and device, computer equipment and storage medium
CN113296993A