Log query method, device, electronic device, and storage medium

By establishing a long connection protocol between the log server and the log proxy, the problem of inconvenience in log query of electronic devices is solved, efficient remote log query is realized, and the operation process is simplified.

CN111831513BActive Publication Date: 2024-11-01BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202010682893.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-15
Publication Date
2024-11-01
Estimated Expiration
2040-07-15

AI Technical Summary

Technical Problem

In the prior art, electronic device log query is inconvenient and inefficient, especially when remotely obtaining logs, it is necessary to log in to the device one by one, which is cumbersome.

Method used

By establishing a long connection protocol between the log server and the log proxy, communication between the log proxy and the log server is realized, remote electronic device logs are obtained, and the input and processing of log query commands are simplified, without logging into the device one by one.

Benefits of technology

It improves the query efficiency of electronic device logs, simplifies the operation of remote viewing of multiple electronic device logs, and allows you to view the logs of multiple devices at the same time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111831513B_ABST
    Figure CN111831513B_ABST
Patent Text Reader

Abstract

The disclosed embodiments relate to a log query method, device, electronic device, and storage medium. The method includes: obtaining a log query command based on a web page input; according to the log query command, obtaining an electronic device log returned by at least one remote log agent; wherein the log agent establishes a connection with the log server through a long connection protocol for monitoring and obtaining the electronic device log; and transmitting each electronic device log to a web page. The method solves the problem of remotely viewing the electronic device logs of multiple electronic devices, can simplify the operation of remotely viewing the electronic device logs, can view the electronic device logs of multiple electronic devices at the same time, and improves the viewing efficiency of the electronic device logs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a log query method, device, electronic device, and storage medium. Background Art

[0002] With the rapid development of Internet technology, more and more electronic devices are involved in the network system, and the background system is getting larger and larger. In order to ensure the normal operation of the system, it is necessary to check the electronic device logs on multiple electronic devices. For example, when the service is online, it is necessary to search for electronic device logs on electronic devices by keywords to troubleshoot problems.

[0003] In the related art, logs are viewed by following the Secure Shell (SSH) protocol and using a password or an SSH key to log in to each electronic device in turn.

[0004] However, the login of electronic devices may not be successful. If the passwords of various electronic devices are different, it will be difficult to log in. The query operation of electronic device logs is cumbersome and the query efficiency is low, especially it is not convenient to remotely obtain electronic device logs. Summary of the invention

[0005] The embodiments of the present disclosure provide a log query method, device, electronic device, and storage medium to solve the problem of inconvenience and low efficiency of electronic device log query in related technologies. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a log query method is provided, the method being applied to a log service end, comprising:

[0007] Get log query commands based on web page input;

[0008] According to the log query command, obtain the electronic device log returned by at least one remote log agent; wherein the log agent establishes a connection with the log server through a long connection protocol to monitor and obtain the electronic device log;

[0009] The logs of each electronic device are transmitted to the web page.

[0010] Optionally, the step of obtaining a log query command based on a web page input includes:

[0011] The log query command input in the search bar of the web page received through the application layer protocol is obtained.

[0012] Optionally, the step of obtaining the electronic device log returned by at least one remote log agent according to the log query command includes:

[0013] According to at least one electronic device to be monitored corresponding to the log query command, establishing a connection with a log proxy terminal in the electronic device to be monitored based on a long connection protocol;

[0014] Sending the log query command to the log agent of the electronic device to be monitored to obtain the electronic device log returned by at least one remote log agent;

[0015] The electronic device to be monitored includes: a server to be monitored that generates an electronic device log, a computer to be monitored, or a camera device to be monitored.

[0016] Optionally, the log query command includes: at least one name of an electronic device to be monitored and a log storage path in the electronic device to be monitored;

[0017] The step of obtaining the electronic device log returned by at least one remote log agent according to the log query command includes:

[0018] According to the log query command, the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored is obtained; wherein the log agent reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path.

[0019] Optionally, the returned electronic device log is a new log added relative to the last returned log.

[0020] Optionally, after the step of obtaining a log query command based on a web page input, the log query method further includes:

[0021] Checking the access permission of the initiator of the log query command to the electronic device to be monitored;

[0022] If the initiator has access rights to the electronic device to be monitored, then according to the log query command, obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored;

[0023] Otherwise, the electronic device name to be monitored and the log storage path corresponding to the electronic device to be monitored in the log query command are discarded.

[0024] Optionally, the step of checking the access rights of the initiator of the log query command to the electronic device to be monitored includes:

[0025] Querying the electronic device group corresponding to each of the electronic devices to be monitored;

[0026] Checking the access rights of the initiator to the electronic device group;

[0027] If the initiator has access rights to the electronic device group, determining that the initiator has access rights to the electronic device to be monitored;

[0028] Otherwise, it is determined that the initiator does not have the access authority for the electronic device to be monitored.

[0029] According to a second aspect of an embodiment of the present disclosure, a log query method is provided, which is applied to a log agent, and includes:

[0030] Receiving a log query command sent by a remote log server, wherein the log agent establishes a connection with the log server through a long connection protocol;

[0031] According to the log query command, the local electronic device to be monitored is monitored to obtain the electronic device log;

[0032] The electronic device log is returned to the log service end.

[0033] Optionally, the step of monitoring the local electronic device to be monitored to obtain the electronic device log according to the log query command includes:

[0034] Obtaining a log storage path according to the log query command;

[0035] The electronic device log is read from the storage space of the local electronic device to be monitored according to the log storage path.

[0036] Optionally, the electronic device log is a new log added relative to the last returned log.

[0037] According to a third aspect of an embodiment of the present disclosure, a log query method is provided, the method comprising:

[0038] The log service end obtains the log query command input based on the web page, and transmits the log query command to at least one remote log agent end;

[0039] The log agent receives a log query command sent by a remote log server, and monitors the local electronic device to be monitored to obtain the electronic device log according to the log query command;

[0040] The log agent returns the electronic device log to the log server;

[0041] The log service end transmits each of the electronic device logs to the web page, so that the web page displays the electronic device logs;

[0042] The log proxy terminal establishes a connection with the log server terminal through a long connection protocol.

[0043] According to a fourth aspect of an embodiment of the present disclosure, a log query device is provided, which is applied to a log service end and includes:

[0044] An acquisition unit, configured to acquire a log query command input based on a web page;

[0045] A control unit is configured to obtain the electronic device log returned by at least one remote log agent according to the log query command; wherein the log agent establishes a connection with the log server through a long connection protocol to monitor and obtain the electronic device log;

[0046] The transmission unit is configured to transmit each of the electronic device logs to the web page.

[0047] Optionally, the first acquiring unit includes:

[0048] The acquisition subunit is configured to acquire the log query command input in the search bar of the web page received through the application layer protocol.

[0049] Optionally, the second acquiring unit includes:

[0050] An establishing subunit is configured to establish a connection with a log proxy terminal in the electronic device to be monitored based on a long connection protocol according to at least one electronic device to be monitored corresponding to the log query command;

[0051] A sending subunit is configured to send the log query command to the log agent of the electronic device to be monitored, so as to obtain the electronic device log returned by at least one remote log agent;

[0052] The electronic device to be monitored includes: a server to be monitored that generates an electronic device log, a computer to be monitored, or a camera device to be monitored.

[0053] Optionally, the log query command includes: at least one name of an electronic device to be monitored and a log storage path in the electronic device to be monitored;

[0054] The second acquisition unit includes:

[0055] The control subunit is configured to obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored according to the log query command; wherein the log agent reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path.

[0056] Optionally, the returned electronic device log is a new log added relative to the last returned log.

[0057] Optionally, the log query device further includes:

[0058] A checking unit is configured to check the access rights of the initiator of the log query command to the electronic device to be monitored after obtaining the log query command based on the web page input;

[0059] If the initiator has access rights to the electronic device to be monitored, then according to the log query command, obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored;

[0060] Otherwise, the electronic device name to be monitored and the log storage path corresponding to the electronic device to be monitored in the log query command are discarded.

[0061] Optionally, the inspection unit includes:

[0062] A query subunit is configured to query the electronic device group corresponding to each of the electronic devices to be monitored;

[0063] A checking subunit, configured to check the access rights of the initiator to the electronic device group;

[0064] If the initiator has access rights to the electronic device group, determining that the initiator has access rights to the electronic device to be monitored;

[0065] Otherwise, it is determined that the initiator does not have the access authority for the electronic device to be monitored.

[0066] According to a fifth aspect of an embodiment of the present disclosure, a log query device is provided, which is applied to a log agent, including:

[0067] A receiving unit, configured to receive a log query command sent by a remote log server, wherein the log agent establishes a connection with the log server through a long connection protocol;

[0068] A monitoring unit, configured to monitor the local electronic device to be monitored to obtain the electronic device log according to the log query command;

[0069] The returning unit is configured to return the electronic device log to the log service end.

[0070] Optionally, the monitoring unit includes:

[0071] An acquisition subunit, configured to acquire a log storage path according to the log query command;

[0072] The reading subunit is configured to read the electronic device log from the storage space of the local electronic device to be monitored according to the log storage path.

[0073] Optionally, the electronic device log is a new log added relative to the last returned log.

[0074] According to a sixth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0075] processor;

[0076] a memory for storing instructions executable by the processor;

[0077] The processor is configured to execute the instructions to implement the log query method as described in any embodiment of the present disclosure.

[0078] According to a seventh aspect of an embodiment of the present disclosure, a log query system is provided, including:

[0079] A log server and at least one log agent;

[0080] Among them, the log service end is configured with the log query device as described in any embodiment of the present disclosure; the log proxy end is configured with the log query device as described in any embodiment of the present disclosure.

[0081] According to an eighth aspect of an embodiment of the present disclosure, a storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the log query method as described in any embodiment of the present disclosure.

[0082] According to a ninth aspect of an embodiment of the present disclosure, a computer program product is provided. When instructions in the computer program product are executed by a processor of an electronic device, the log query method described in any embodiment of the present disclosure is implemented.

[0083] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0084] A log agent is configured on the electronic device to be monitored, and a log server is configured on the electronic device in transit. Communication between the log agent and the log server is achieved through a long connection protocol, which solves the problem of remotely viewing the electronic device logs of multiple electronic devices to be monitored. Multiple electronic device logs can be obtained through log query commands, without the need to log in to the electronic device to be monitored one by one through a password or secret key, thereby simplifying the operation of remotely viewing the electronic device logs; the electronic device logs of multiple electronic devices can be viewed at the same time, thereby improving the viewing efficiency of the electronic device logs.

[0085] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0087] Figure 1 The figure is a flow chart of a log query method according to an exemplary embodiment.

[0088] Figure 2 The figure is a flow chart of a log query method according to an exemplary embodiment.

[0089] Figure 3 The present invention is a schematic diagram showing authority management of an electronic device to be monitored according to an exemplary embodiment.

[0090] Figure 4 The figure is a flow chart of a log query method according to an exemplary embodiment.

[0091] Figure 5 The figure is a flow chart of a log query method according to an exemplary embodiment.

[0092] Figure 6 The figure is a flow chart of a log query method according to an exemplary embodiment.

[0093] Figure 7 The figure is a block diagram of a log query device according to an exemplary embodiment.

[0094] Figure 8 The figure is a block diagram of a log query device according to an exemplary embodiment.

[0095] Fig. 9 The diagram is a schematic structural diagram of an electronic device according to an exemplary embodiment.

[0096] Fig.10 The diagram is a structural diagram of a log query system according to an exemplary embodiment. DETAILED DESCRIPTION

[0097] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0098] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0099] In a system including multiple electronic devices, there is usually a need to perform log queries on each electronic device in the system, and each electronic device may be located in different locations. The locations of electronic devices are scattered and the number is large, which brings difficulties to log queries. For example, log queries are regularly performed on electronic devices deployed in different locations, such as cameras in the network system of the traffic management department, to troubleshoot electronic device failures; or, based on the need to view logs, such as when a new service of the operating system is launched, log queries are performed on electronic devices deployed in different locations to solve problems that arise in the operating system of the electronic device for the new service. The disclosed embodiment can be applicable to the situation where the electronic device logs of multiple electronic devices are queried with the help of a transit electronic device. The disclosed embodiment configures a log server in the transit electronic device, configures a log proxy in the electronic device whose log is to be queried, and establishes a connection between the log server and the log proxy through a long connection protocol to achieve log queries on multiple remote electronic devices.

[0100] Figure 1 is a flow chart of a log query method according to an exemplary embodiment. Figure 1 As shown, the log query method is used in an electronic device and is executed by a log server configured in the electronic device. The method includes the following steps.

[0101] In step S11, a log query command input based on a web page is obtained.

[0102] Among them, the log query command can be a command for performing log query on one or more electronic devices. The log query command can be in the form of a script program or a string. The log query command can be initiated for a variety of reasons, for example, to maintain the normal operation of the electronic device, a log query command is initiated regularly; or, when an electronic device is abnormal, a log query command is initiated according to the abnormality; or, when a new service is configured in the electronic device, a log query command is initiated to view the operation of the new service, etc. The content of the log query command is used to control the log agent to perform log query, and the expression form of its content can be diverse, for example, the name of the electronic device to be queried, the Internet Protocol (IP) address of the electronic device, or the identifier of the log agent in the electronic device can be specified. Further, the order of the electronic device or the log agent can be specified, and the content of the log query command can be the sequence number of the electronic device or the log agent. For the electronic device that needs to perform log query, the storage path of the electronic device log can be specified, or the log file name storing the electronic device log can be specified.

[0103] In order to facilitate user operation and realize the demand of fast query of electronic device log, the method of obtaining log query command can be to obtain log query command based on web page input. For example, for one or more electronic devices that need to be queried, a character string identifying the electronic device or log agent can be input on the web page. The web page can be a browser page of an intelligent terminal, such as a World Wide Web (Web) page. The intelligent terminal can be a mobile terminal such as a smart phone, a laptop computer, a PDA (personal digital assistant), a PAD (tablet computer), etc., and a fixed terminal such as a desktop computer, etc. By inputting log query commands based on web pages, there is no need for users to write script programs every time they query logs, which is easy to operate and has high log query efficiency.

[0104] In one implementation of the embodiment of the present disclosure, optionally, the step of obtaining a log query command input based on a web page includes: obtaining a log query command input in a search bar of a web page received through an application layer protocol.

[0105] Among them, the application layer protocol is a protocol for establishing a communication connection between a web page and a log server to realize communication. For example, it can be a Hypertext Transfer Protocol (Http), or a full-duplex communication (websocket) protocol, etc., wherein the websocket protocol can be used to realize two-way interaction, and the log can be directly returned when the electronic device log is obtained by the electronic device configured on the log server according to the log query command, and the log query efficiency is relatively high; while the Http protocol needs to access the electronic device configured on the log server with a preset duration to check whether there is an electronic device log, and the log query efficiency is relatively low. The embodiments of the present disclosure include but are not limited to the above-mentioned protocols.

[0106] The search bar is a window for specifying users to enter log query commands in a web page. Prompt content can be set in the search bar to instruct users to enter log query commands in a specified location. The prompt content can be "Please enter the log query command", "Please enter the electronic device identification to be queried" and other content that can prompt the user. The search bar can be set in various ways, it can be a separate input box, or a drop-down menu can be set in the input box. The drop-down menu can be the identification information of the electronic device expanded according to the business classification, or it can be the identification information of related electronic devices recommended based on the content entered by the user. The user can select the electronic device to be queried in the drop-down menu without having to enter the identification information of the electronic device one by one, which can improve the efficiency of log query and the accuracy of the identification information input into the electronic device.

[0107] In order to quickly and accurately find the electronic device log, in one implementation of the present disclosure, optionally, the log query command includes: at least one name of the electronic device to be monitored and a log storage path in the electronic device to be monitored.

[0108] Among them, the name of the electronic device to be monitored is identification information that identifies the electronic device to be monitored or identifies the log agent in the electronic device to be monitored. For example, the identification information of the electronic device to be monitored can be a name pre-named according to the business classification of the electronic device to be monitored, the serial number of the electronic device to be monitored, the IP address of the electronic device to be monitored, the media access control bit (Media Access Control, MAC) address of the electronic device to be monitored, etc.

[0109] The log storage path is information used to indicate the storage location of the log of the electronic device to be monitored. The log storage path can be composed of various ways, such as letters and symbols, or words and symbols. According to the log storage path composed of letters and symbols, the electronic device log can be directly obtained; according to the log storage path composed of words and symbols, the storage location of the electronic device log can be obtained.

[0110] In step S12, according to the log query command, the electronic device log returned by at least one remote log agent is obtained; wherein the log agent establishes a connection with the log server through a long connection protocol to monitor and obtain the electronic device log.

[0111] Among them, the log service end is used to implement the log query command initiator and one or more log proxy ends to perform log query. The log service end can be configured on the electronic device to be transferred, and can play a transfer role. For example, the electronic device to be transferred can be a server, a computer device, etc. The log proxy end is used to obtain the log of the electronic device and return it to the log service end. The log proxy end can be configured on the electronic device to be monitored, and the log proxy end and the electronic device to be monitored can be one-to-one corresponding. The electronic device to be monitored can be an electronic device that needs to query the log. For example, the electronic device to be monitored can be a server to be monitored, a computer to be monitored, or a camera device to be monitored.

[0112] The long connection protocol is a protocol for the log agent to establish a connection with the log server to achieve communication. For example, the User Datagram Protocol (UDP) protocol, or the Transmission Control Protocol (TCP), etc. Among them, the TCP protocol can provide more reliable communication transmission. The connection between the log agent and the log server, and the order of obtaining the log query command can be unrestricted. For example, the connection between the log agent and the log server can be established in advance before the log query command is obtained; or the connection between the log agent and the log server can be established on demand after the log query command is obtained. Before the log query command is obtained, the log agent and the log server establish a connection through the long connection protocol, which can save log query time and improve the efficiency of obtaining electronic device logs.

[0113] In a specific implementation of the embodiment of the present disclosure, the method of obtaining the electronic device log returned by at least one remote log agent terminal can be that the log service terminal sends the log query command to the log agent terminal of the electronic device to be monitored corresponding to the log query command, and the log agent terminal monitors the electronic device log and returns it to the log service terminal. Alternatively, the log service terminal sends the log query command to the log agent terminals of all electronic devices to be monitored, and the log agent terminal monitors the electronic device log according to the electronic device to be monitored corresponding to the log query command, and returns it to the log service terminal. Among them, the log agent terminal monitors the electronic device log of the electronic device to be monitored. If the log query command does not contain the electronic device to be monitored, the electronic device log may not be monitored or the electronic device log may not be returned. The method in which the log service terminal sends the log query command to the log agent terminal of the electronic device to be monitored corresponding to the log query command can reduce the data flow of information interaction and save the occupation of network resources. The method in which the log service terminal sends the log query command to the log agent terminals of all electronic devices to be monitored can improve the efficiency of log query.

[0114] In another specific implementation of the disclosed embodiment, the log agent returns the electronic device log by establishing a connection between the log server and the log agent of the electronic device to be monitored corresponding to the log query command, sending the information corresponding to the log agent in the log query command, such as the log storage path of the electronic device to be monitored where the log agent is located, to the log agent, and the log agent monitors the electronic device log of the electronic device to be monitored according to the log storage path, and returns it to the log server. After obtaining the log query command, the log agent establishes a connection with the log server, and can establish a connection with the log agent of the electronic device to be queried in a targeted manner, saving energy consumption and improving the accuracy of the log query.

[0115] In order to reduce the workload of the log service end, in one implementation of the presently disclosed embodiment, optionally, according to the log query command, the step of obtaining the electronic device log returned by at least one remote log agent end includes: according to at least one electronic device to be monitored corresponding to the log query command, establishing a connection with the log agent end in the electronic device to be monitored based on a long connection protocol; sending the log query command to the log agent end of the electronic device to be monitored to obtain the electronic device log returned by at least one remote log agent end.

[0116] The electronic device to be monitored includes: a server to be monitored that generates electronic device logs, a computer to be monitored, or a camera device to be monitored.

[0117] Among them, the log service end can determine the electronic device to be monitored corresponding to the log query command according to the log query command. For example, the electronic device to be monitored is determined according to the identification information of the electronic device to be monitored in the log query command. The log service end can establish a connection with the log agent end of the electronic device to be monitored corresponding to the log query command through a long connection protocol, such as through a TCP protocol. The log service end sends the log query command to the log agent end of the electronic device to be monitored, which can be to send the entire log query command or to send a portion of the log query command corresponding to the electronic device to be monitored. For example, the log service end sends the log storage path corresponding to the electronic device to be monitored to the corresponding log agent end. The log agent end that receives the log query command monitors the electronic device log of the electronic device to be monitored and returns according to the log query command. It can be realized that the log service end simultaneously obtains the electronic device logs monitored by multiple log agent ends, without the need for users to log in to the electronic devices one by one, and the operation is simple, and the electronic device log acquisition speed is fast and efficient.

[0118] In one implementation of the embodiments of the present disclosure, optionally, according to a log query command, obtaining an electronic device log returned by at least one remote log agent terminal, including: according to the log query command, obtaining an electronic device log returned by at least one remote log agent terminal corresponding to the name of the electronic device to be monitored; wherein the log agent terminal reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path.

[0119] Among them, the log service end can establish a connection with the log agent end in the electronic device to be monitored corresponding to the name of the electronic device to be monitored in the log query command through a long connection protocol such as the TCP protocol. The log service end sends the log storage path in the log query command to the log agent end of the corresponding electronic device to be monitored. The log agent end that receives the log storage path connects to the electronic device log of the electronic device to be monitored according to the log storage path, reads the electronic device log and returns it to the log service end. The log service end can simultaneously obtain the logs of electronic devices monitored by multiple log agents without the need for users to log in to the electronic device. The operation is simple, and the electronic device log acquisition speed is fast and efficient.

[0120] In order for users to quickly check problems through logs, in one implementation of the disclosed embodiment, optionally, the returned electronic device log is a newly added log relative to the last returned log. The newly added log is an electronic device log that is newly added relative to the last returned log. For example, an electronic device log that is newly added after the last log query time, or an electronic device log that is generated after the end time specified in the last log query command. Returning the newly added log can reduce the amount of log queries by users, making it easier for users to quickly find problems through the newly added log.

[0121] In step S13, each electronic device log is transmitted to a web page.

[0122] Among them, the communication connection between the web page and the log server can be based on the application layer protocol suggestion. For example, the Http protocol, or the websocket protocol, etc. The websocket protocol can realize two-way interaction, and the log can be directly returned when the electronic device log is obtained by the electronic device configured on the log server according to the log query command, and the log query efficiency is relatively high; while the Http protocol can access the electronic device configured on the log server at a preset time to check whether there is an electronic device log, and the log query efficiency is relatively low.

[0123] After the electronic device log is transmitted to the web page, the web page can display the electronic log to the user, and can be specifically displayed according to the user's operation. For example, the display order of the electronic device log can be set, and the display order can be based on the order of the electronic device log received by the log server, or based on the query order of the electronic device log in the log query command. It is convenient for users to view the electronic device logs corresponding to each electronic device to be monitored, and users can intuitively and quickly obtain the electronic device logs of the electronic device to be monitored that need to be queried, without other operations, and can directly correspond to the electronic device to be monitored when an abnormality is found in the electronic device log.

[0124] The technical solution of the disclosed embodiment obtains a log query command based on a web page input; according to the log query command, obtains the electronic device log returned by at least one remote log agent; wherein the log agent establishes a connection with the log server through a long connection protocol for monitoring and obtaining the electronic device log; and transmits each electronic device log to a web page, thereby solving the problem of remotely viewing the electronic device logs of multiple electronic devices, simplifying the operation of remotely viewing the electronic device logs, and allowing the electronic device logs of multiple electronic devices to be viewed simultaneously, thereby improving the viewing efficiency of the electronic device logs.

[0125] Figure 2 1 is a flow chart of a log query method according to an exemplary embodiment. This embodiment is a further refinement of the above technical solution. The technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 2 As shown, the log query method includes the following steps.

[0126] In step S21, a log query command input in a search bar of a web page received through an application layer protocol is obtained.

[0127] In one implementation of the embodiments of the present disclosure, optionally, the log query command includes: at least one name of the electronic device to be monitored and a log storage path in the electronic device to be monitored.

[0128] In step S22, the access permission of the initiator of the log query command to the electronic device to be monitored is checked; if the initiator has the access permission to the electronic device to be monitored, step S23 is executed; otherwise, step S25 is executed.

[0129] Among them, the access permission is used to indicate whether the initiator of the log query command can obtain the logs of each electronic device to be obtained in the log query command. The access permission can be uniformly managed through permission management. For example, after the log service end obtains the log query command, it can determine the electronic device to be monitored corresponding to the log query command, and query in the permission management whether the initiator of the log query command has the access permission to the electronic device to be monitored.

[0130] The initiator may be an account used by a user who initiates a log query command, an identifier of a smart terminal, or an IP address logged in by a user, etc. The initiator may also be any combination of the above implementations. For example, when performing an access right check, the IP address from which the log query request is initiated may be checked first. For log query requests that meet a preset IP address, the identifier of the smart terminal from which the log query request is initiated may be further checked. For log query requests that meet a preset smart terminal identifier, the account from which the log query request is initiated may be checked again. Different accounts may have different access rights to the electronic device to be monitored.

[0131] To facilitate the management of user access rights, in one implementation of the presently disclosed embodiment, optionally, the step of checking the electronic device log access rights of the initiator of the log query command includes: querying the electronic device group corresponding to each electronic device to be monitored; checking the initiator's access rights to the electronic device group; if the initiator has the access rights to the electronic device group, determining that the initiator has the access rights to the electronic device to be monitored; otherwise, determining that the initiator does not have the access rights to the electronic device to be monitored.

[0132] The rights management of the electronic devices to be monitored may be managed by grouping, for example, grouping according to business classification, or grouping according to the attributes of the electronic devices to be monitored. Figure 3 FIG. 1 is a schematic diagram showing a permission management of an electronic device to be monitored according to an exemplary embodiment. Figure 3As shown, different initiators may have access rights to one or more electronic device groups. Among them, the electronic devices to be monitored in the two electronic device groups may be partially the same or completely different, which is not specifically limited in the embodiments of the present disclosure. After the log service end obtains the log query command, it can determine the electronic device to be monitored corresponding to the log query command, query the electronic device group to which the electronic device to be monitored belongs through the authority management, and check the access rights of the initiator to the electronic device group. If the initiator has the access rights to the electronic device group, it can be determined that the initiator has the access rights to the electronic device to be monitored; if the initiator does not have the access rights to the electronic device group, it can be determined that the initiator does not have the access rights to the electronic device to be monitored. The authority management is simple and easy to operate, which is convenient for users to manage the authority of electronic devices. If a user (such as an account) is added, the electronic device group can be directly added without adding accessible electronic devices to the newly added users one by one, which is convenient for users to change the access rights.

[0133] In step S23, according to the log query command, the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored is obtained.

[0134] The log agent reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path.

[0135] If the initiator has access rights, the log server can establish a connection with the log agent in the corresponding electronic device to be monitored to obtain the electronic device log monitored by the log agent; or, the log server can obtain the electronic device log obtained by the log agent in the corresponding electronic device to be monitored that has established a connection.

[0136] In one implementation of the embodiments of the present disclosure, optionally, according to a log query command, the step of obtaining an electronic device log returned by at least one remote log agent terminal includes: according to at least one electronic device to be monitored corresponding to the log query command, establishing a connection with the log agent terminal in the electronic device to be monitored based on a long connection protocol; sending the log query command to the log agent terminal of the electronic device to be monitored to obtain the electronic device log returned by at least one remote log agent terminal; wherein the electronic device to be monitored includes: a server to be monitored that generates an electronic device log, a computer to be monitored, or a camera device to be monitored.

[0137] In one implementation of the embodiments of the present disclosure, optionally, the log query command includes: at least one name of the electronic device to be monitored and a log storage path in the electronic device to be monitored; according to the log query command, obtaining the electronic device log returned by at least one remote log agent, including: according to the log query command, obtaining the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored; wherein the log agent reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path.

[0138] In one implementation of the disclosed embodiment, optionally, the returned electronic device log is a newly added log relative to the previously returned log.

[0139] In step S24, each electronic device log is transmitted to a web page so that the web page displays the electronic device log, and the process ends.

[0140] In step S25, the name of the electronic device to be monitored and the log storage path corresponding to the electronic device to be monitored in the log query command are discarded.

[0141] If the initiator does not have access rights, the log server may prompt an exception through the electronic device where it is located to indicate that the initiator does not have access rights and cannot obtain the electronic device log of the electronic device to be monitored corresponding to the log query command. The exception information may be synchronized to a web page to prompt the initiator that the initiator does not have access rights based on the web page.

[0142] The technical solution of the disclosed embodiment is as follows: by obtaining a log query command input into a search bar of a web page received through an application layer protocol; checking the access rights of an initiator of the log query command to the electronic device to be monitored; if the initiator has the access rights to the electronic device to be monitored; obtaining, according to the log query command, a log of an electronic device returned by at least one remote log agent corresponding to the name of the electronic device to be monitored; and transmitting the log of each electronic device to a web page so that the web page displays the log of the electronic device, thereby solving the problem of remotely viewing the logs of multiple electronic devices. While facilitating users to remotely view the logs of electronic devices, it is also convenient for users to manage the access rights to electronic devices. By setting the electronic device group, when adding new users, there is no need to add accessible electronic devices to users one by one, and the operation is simple.

[0143] Figure 4 is a flow chart of a log query method according to an exemplary embodiment. Figure 4 As shown, the log query method is used in the electronic device to be monitored and is executed by a log agent configured in the electronic device to be monitored. The method includes the following steps.

[0144] In step S31, a log query command sent by a remote log server is received, wherein the log agent establishes a connection with the log server through a long connection protocol.

[0145] Among them, the log agent is used to obtain the log of the electronic device and return it to the log server. The log agent can be configured on the electronic device to be monitored, and the log agent and the electronic device to be monitored can be one-to-one. The electronic device to be monitored can be an electronic device that needs to query the log. For example, the electronic device can be a server, a computer, a camera device, etc. in the system. The log agent can receive a log query command sent by the log server that establishes the connection. Exemplarily, the log query command can include the name of the electronic device to be monitored and the log storage path in the electronic device to be monitored. The log agent can receive the log storage path of the electronic device to be monitored where the log agent is located, sent by the log server, to obtain the electronic device log. Exemplarily, the long connection protocol can be a UDP protocol or a TCP protocol, etc.

[0146] In step S32, according to the log query command, the local electronic device to be monitored is monitored to obtain the electronic device log.

[0147] Among them, the log agent can determine whether it is necessary to monitor the local electronic device to be monitored based on the identification information of the electronic device to be monitored in the log query command or the identification information of the log agent. If the log query command contains the identification information of the local electronic device to be monitored or the log agent itself, the log agent monitors the local electronic device to be monitored to obtain the electronic device log. For example, the log agent determines the storage location of the electronic device log according to the log query command, and reads the electronic device log in the storage space of the electronic device.

[0148] In order to simplify the process of obtaining electronic device logs, in one implementation of the presently disclosed embodiment, optionally, according to a log query command, the step of monitoring a local electronic device to be monitored to obtain the electronic device log includes: obtaining a log storage path according to the log query command; and reading the electronic device log from the storage space of the local electronic device to be monitored according to the log storage path.

[0149] Among them, the log agent can receive the log storage path of the electronic device to be monitored where the log agent is located sent by the log service end, or obtain the log storage path of the electronic device to be monitored where the log agent is located according to the log query command. Read the electronic device log from the storage space of the local electronic device to be monitored according to the log storage path. The electronic device log can be quickly obtained.

[0150] In one implementation of the disclosed embodiment, optionally, the electronic device log is a newly added log relative to the previous returned log.

[0151] There are various ways to obtain the newly added logs, for example, through a script program, or through a log keyword command, etc. Exemplarily, through an application programming interface (Application Programming Interface, API), a log acquisition script program is run to read the newly added logs from the storage space of the electronic device to be monitored; or, through commands such as tail and grep, the newly added logs are read from the storage space of the electronic device to be monitored.

[0152] In step S33, the electronic device log is returned to the log service end.

[0153] Among them, the log agent can return the electronic device logs obtained by monitoring, such as new logs, to the connected log server to display them according to the log query command.

[0154] The technical solution of the disclosed embodiment receives a log query command sent by a remote log server, wherein a log agent establishes a connection with the log server through a long connection protocol; according to the log query command, monitors the local electronic device to be monitored to obtain the electronic device log; and returns the electronic device log to the log server, thereby solving the problem of remotely viewing the electronic device logs of multiple electronic devices. By respectively configuring a log agent on each electronic device to be monitored, each log agent can obtain the local electronic device log in parallel and in a timely manner, and return it to the log server, thereby simplifying the operation of remotely viewing the electronic device log and improving the viewing efficiency of the electronic device log.

[0155] Figure 5 is a flow chart of a log query method according to an exemplary embodiment. Figure 5 As shown, the method includes:

[0156] In step S41, the log service end obtains a log query command input based on a web page, and transmits the log query command to at least one remote log agent end.

[0157] In step S42, the log agent receives the log query command sent by the remote log server, and monitors the local electronic device to be monitored to obtain the electronic device log according to the log query command.

[0158] In step S43, the log agent returns the electronic device log to the log server.

[0159] In step S44, the log service end transmits each electronic device log to a web page so that the web page displays the electronic device log.

[0160] The log agent and the log server are connected via a long connection protocol; the electronic device to be monitored includes: a server to be monitored that generates electronic device logs, a computer to be monitored, or a camera device to be monitored.

[0161] The technical solution of the disclosed embodiment configures a log agent on the electronic device to be monitored, configures a log server on the electronic device used for transfer, establishes communication between the log server and the log agent through a long connection protocol, receives a log query command input by a user based on a web page through the log server, obtains the electronic device log of the corresponding electronic device to be monitored according to the log query command through the cooperation of the log server and the log agent, solves the problem of remotely viewing the electronic device logs of multiple electronic devices, facilitates each log agent to obtain the local electronic device log in parallel and in a timely manner, and returns it to the log server, without having to log in to the electronic device to be monitored in turn, and the user only needs to input the log query command based on the web page to realize the electronic device log query, which is convenient for user operation, can simplify the operation of remotely viewing the electronic device log, and can improve the viewing efficiency of the electronic device log.

[0162] Figure 6 is a flow chart of a log query method according to an exemplary embodiment. Figure 6 As shown, the user can establish a connection with the log server on the electronic device used for transfer through the websocket protocol through the web page; the log server (LogServer) can establish a connection with the log agent (LogAgent) of the electronic device to be queried through the TCP protocol. The method includes:

[0163] S501, the user establishes a connection with the log server through the websocket protocol through the web page;

[0164] S502: The user can enter a list of electronic devices whose logs are to be queried and a log storage path on the web page;

[0165] S503, the log server can check whether the user has access rights to each electronic device in the electronic device list, and if the user does not have access rights, an abnormality is prompted; if the user has access rights, continue to execute S504;

[0166] S504, the log server connects to the log proxy of the electronic device that the user needs to access;

[0167] S505, the log proxy terminal connects to the electronic device log file corresponding to the log storage path, for example, by using the tail command or API interface to monitor the newly added log;

[0168] S506: The log agent returns the newly added log to the log server in real time.

[0169] S507: The log server may aggregate the newly added logs of all electronic devices with access rights input by the user, return the web page through the websocket protocol, and display it to the user.

[0170] The technical solution of the embodiment of the present disclosure is that the web page and the log server establish communication based on the websocket protocol, and the log server and the log agent establish connection based on the TCP protocol. The user enters the log query command on the web page, and obtains the electronic device log of the electronic device to be monitored where the corresponding log agent is located according to the log query command and the cooperation between the log server and the log agent, which solves the problem of remotely viewing the electronic device logs of multiple electronic devices, and facilitates each log agent to obtain the local electronic device log in parallel and return it to the log server in time, without the need to log in to the electronic device to be monitored in turn, and the user operation is simple; the authority management of the electronic device is performed through the electronic device group, and the authority management operation is simple, which is convenient for quickly setting the access rights of the corresponding electronic device when adding users; by returning the newly added log, it is convenient for the user to find problems in time through the newly added log, avoid reading a large number of redundant logs, and can also improve the log acquisition speed and reduce the occupation of communication data. On the whole, the technical solution of the embodiment of the present disclosure can simplify the operation of remotely viewing the log of the electronic device, and can improve the viewing efficiency of the log of the electronic device.

[0171] Figure 7 is a block diagram of a log query device according to an exemplary embodiment. Figure 7 The device includes a first acquisition unit 121, a second acquisition unit 122 and a transmission unit 123.

[0172] The first acquisition unit 121 is configured to acquire a log query command input based on a web page;

[0173] The second acquisition unit 122 is configured to acquire the electronic device log returned by at least one remote log agent according to the log query command; wherein the log agent establishes a connection with the log server through a long connection protocol to monitor and obtain the electronic device log;

[0174] The transmission unit 123 is configured to transmit the logs of each electronic device to a web page.

[0175] In an implementation of the embodiment of the present disclosure, optionally, the first acquisition unit 121 includes:

[0176] The acquisition subunit is configured to acquire the log query command input in the search bar of the web page received through the application layer protocol.

[0177] In an implementation of the embodiment of the present disclosure, optionally, the second acquisition unit 122 includes:

[0178] An establishing subunit is configured to establish a connection with a log proxy terminal in the electronic device to be monitored based on a long connection protocol according to at least one electronic device to be monitored corresponding to the log query command;

[0179] A sending subunit is configured to send a log query command to a log agent terminal of the electronic device to be monitored, so as to obtain the electronic device log returned by at least one remote log agent terminal;

[0180] The electronic device to be monitored includes: a server to be monitored that generates electronic device logs, a computer to be monitored, or a camera device to be monitored.

[0181] In one implementation of the embodiment of the present disclosure, optionally, the log query command includes: at least one name of the electronic device to be monitored and a log storage path in the electronic device to be monitored;

[0182] Accordingly, the second acquiring unit 122 includes:

[0183] The control subunit is configured to obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored according to the log query command; wherein the log agent reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path.

[0184] In one implementation of the disclosed embodiment, optionally, the returned electronic device log is a newly added log relative to the previously returned log.

[0185] In one implementation of the embodiment of the present disclosure, optionally, the log query device further includes:

[0186] A checking unit is configured to check the access rights of the initiator of the log query command to the electronic device to be monitored after obtaining the log query command step based on the web page input;

[0187] If the initiator has access rights to the electronic device to be monitored, then according to the log query command, obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored;

[0188] Otherwise, the name of the electronic device to be monitored and the log storage path corresponding to the electronic device to be monitored in the log query command are discarded.

[0189] In one implementation of the embodiment of the present disclosure, optionally, the inspection unit includes:

[0190] A query subunit is configured to query the electronic device group corresponding to each electronic device to be monitored;

[0191] A checking subunit configured to check the access rights of the initiator to the electronic device group;

[0192] If the initiator has access rights to the electronic device group, determining that the initiator has access rights to the electronic device to be monitored;

[0193] Otherwise, it is determined that the initiator does not have the access authority to the electronic device to be monitored.

[0194] Regarding the log query device in the above embodiment, the specific manner in which each unit performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0195] Figure 8 is a block diagram of a log query device according to an exemplary embodiment. Figure 8 The device includes a receiving unit 221, a monitoring unit 222 and a returning unit 223.

[0196] The receiving unit 221 is configured to receive a log query command sent by a remote log server, wherein the log agent establishes a connection with the log server through a long connection protocol;

[0197] The monitoring unit 222 is configured to monitor the local electronic device to be monitored to obtain the electronic device log according to the log query command;

[0198] The returning unit 223 is configured to return the electronic device log to the log server.

[0199] In one implementation of the embodiment of the present disclosure, optionally, the monitoring unit 222 includes:

[0200] An acquisition subunit, configured to acquire a log storage path according to a log query command;

[0201] The reading subunit is configured to read the electronic device log from the storage space of the local electronic device to be monitored according to the log storage path.

[0202] In one implementation of the disclosed embodiment, optionally, the electronic device log is a newly added log relative to the previous returned log.

[0203] Regarding the log query device in the above embodiment, the specific manner in which each unit performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0204] Fig. 9is a schematic diagram showing the structure of an electronic device according to an exemplary embodiment. Fig. 9 As shown, the electronic device includes:

[0205] one or more processors 810,

[0206] Fig. 9 A processor 810 is taken as an example;

[0207] Memory 820;

[0208] The processor 810 and the memory 820 in the device may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.

[0209] The memory 820 is a non-transitory computer-readable storage medium that can be used to store software programs, computer executable programs, and modules, such as program instructions / modules corresponding to a log query method in an embodiment of the present disclosure (for example, the attached Figure 7 The first acquisition unit 121, the second acquisition unit 122 and the transmission unit 123 shown in FIG. Figure 8 The processor 810 executes various functional applications and data processing of the computer device by running the software programs, instructions and modules stored in the memory 820, that is, a log query method of the above method embodiment is implemented, namely:

[0210] Get log query commands based on web page input;

[0211] According to the log query command, the electronic device log returned by at least one remote log agent is obtained; wherein the log agent establishes a connection with the log server through a long connection protocol to monitor and obtain the electronic device log;

[0212] The logs of each electronic device are transmitted to the web page.

[0213] or,

[0214] Receiving a log query command sent by a remote log server, wherein the log agent establishes a connection with the log server through a long connection protocol;

[0215] According to the log query command, the local electronic device to be monitored is monitored to obtain the electronic device log;

[0216] The electronic device log is returned to the log service end.

[0217] The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 820 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 820 may optionally include a memory remotely arranged relative to the processor 810, and these remote memories may be connected to the terminal device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0218] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 820 including instructions, and the instructions can be executed by a processor 810 of an electronic device to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0219] Fig.10 is a structural diagram of a log query system according to an exemplary embodiment. Fig.10 As shown, the log query system includes: a log server (LogServer) 910 and at least one log agent (LogAgent) 920; wherein the log server 910 is configured with a log query device as described in any embodiment of the present disclosure; and the log agent 920 is configured with a log query device as described in any embodiment of the present disclosure.

[0220] In an exemplary embodiment, a computer program product is also provided for use in combination with an electronic device. The computer program product includes a computer-readable storage medium and a computer program mechanism embedded therein. After the program is loaded and executed by a computer, the log query method described in any embodiment of the present disclosure can be implemented.

[0221] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0222] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A log query method, characterized in that: Applied to the log server, the method includes: Obtaining a log query command based on a web page input; the step of obtaining a log query command based on a web page input includes: obtaining a log query command input in a search bar of a web page received through an application layer protocol; the application layer protocol includes: a full-duplex communication protocol websocket; According to the log query command, the electronic device log returned by at least one remote log agent is obtained; wherein the log agent establishes a connection with the log server through a long connection protocol to monitor and obtain the electronic device log; the log agent is set in the electronic device to be monitored; Transmitting each of the electronic device logs to the web page; Wherein, the log query command includes: at least one name of the electronic device to be monitored and a log storage path in the electronic device to be monitored; The step of obtaining the electronic device log returned by at least one remote log agent according to the log query command includes: According to the log query command, obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored; wherein the log agent reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path; After the step of obtaining a log query command based on a web page input, the log query method further includes: Checking the access permission of the initiator of the log query command to the electronic device to be monitored; If the initiator has access rights to the electronic device to be monitored, then according to the log query command, obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored; Otherwise, discard the name of the electronic device to be monitored and the log storage path corresponding to the electronic device to be monitored in the log query command; The initiator includes: the account used by the user who initiates the log query command, the identifier of the smart terminal, and the IP address where the user logs in; Checking the access rights of the initiator of the log query command to the electronic device to be monitored, including: checking the IP address from which the log query request is initiated; for a log query request that meets a preset IP address, checking the identifier of the smart terminal from which the log query request is initiated; for a log query request that meets a preset smart terminal identifier, checking the account from which the log query request is initiated; and having different access rights to the electronic device to be monitored for different accounts.

2. The log query method according to claim 1, characterized in that: The step of obtaining the electronic device log returned by at least one remote log agent terminal according to the log query command includes: According to at least one electronic device to be monitored corresponding to the log query command, establishing a connection with a log proxy terminal in the electronic device to be monitored based on a long connection protocol; Sending the log query command to the log agent of the electronic device to be monitored to obtain the electronic device log returned by at least one remote log agent; The electronic device to be monitored includes: a server to be monitored that generates an electronic device log, a computer to be monitored, or a camera device to be monitored.

3. The log query method according to claim 1, characterized in that: The returned electronic device log is a newly added log relative to the previously returned log.

4. The log query method according to claim 1, characterized in that: The step of checking the access rights of the initiator of the log query command to the electronic device to be monitored includes: Querying the electronic device group corresponding to each of the electronic devices to be monitored; Checking the access rights of the initiator to the electronic device group; If the initiator has access rights to the electronic device group, determining that the initiator has access rights to the electronic device to be monitored; Otherwise, it is determined that the initiator does not have the access authority for the electronic device to be monitored.

5. A log query method, characterized in that: Applied to a log agent, the log agent is arranged in an electronic device to be monitored; the method comprises: Receiving a log query command sent by a remote log server, wherein the log agent establishes a connection with the log server through a long connection protocol; According to the log query command, the local electronic device to be monitored is monitored to obtain the electronic device log; Returning the electronic device log to the log service end; The step of monitoring the local electronic device to be monitored to obtain the electronic device log according to the log query command includes: Obtaining a log storage path according to the log query command; Reading the electronic device log from the storage space of the local electronic device to be monitored according to the log storage path; The electronic device log is a newly added log relative to the previously returned log; wherein, the method for obtaining the newly added log includes: through the application program interface API, running the log acquisition script program to read the newly added log from the storage space of the electronic device to be monitored; or, reading the newly added log from the storage space of the electronic device to be monitored through the tail or grep command.

6. A log query method, characterized in that: include: The log service end obtains the log query command input based on the web page, and transmits the log query command to at least one remote log agent end; The log agent is arranged in the electronic device to be monitored; The step of the log server obtaining a log query command input based on a web page includes: the log server obtaining a log query command input in a search bar of a web page received through an application layer protocol; the application layer protocol includes: a full-duplex communication protocol websocket; The log agent receives a log query command sent by a remote log server, and monitors the local electronic device to be monitored to obtain the electronic device log according to the log query command; The log agent returns the electronic device log to the log server; The log service end transmits each of the electronic device logs to the web page, so that the web page displays the electronic device logs; The log agent establishes a connection with the log server through a long connection protocol; The log query command includes: at least one name of the electronic device to be monitored and a log storage path in the electronic device to be monitored; According to the log query command, monitoring the local electronic device to be monitored to obtain the electronic device log includes: The log agent obtains the log storage path according to the log query command; and reads the electronic device log from the storage space of the local electronic device to be monitored according to the log storage path; The log service end obtains the electronic device log returned by at least one remote log agent end corresponding to the name of the electronic device to be monitored according to the log query command; After the log service end obtains the log query command step based on the web page input, the log query method further includes: The log service end checks the access permission of the initiator of the log query command to the electronic device to be monitored; If the initiator has access rights to the electronic device to be monitored, then according to the log query command, obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored; Otherwise, discard the name of the electronic device to be monitored and the log storage path corresponding to the electronic device to be monitored in the log query command; The initiator includes: the account used by the user who initiates the log query command, the identifier of the smart terminal, and the IP address where the user logs in; The log service end checks the access rights of the initiator of the log query command to the electronic device to be monitored, including: the log service end checks the IP address from which the log query request is initiated; for the log query request that meets the preset IP address, checks the identifier of the smart terminal from which the log query request is initiated; for the log query request that meets the preset smart terminal identifier, checks the account from which the log query request is initiated; and different accounts have different access rights to the electronic device to be monitored.

7. A log query device, characterized in that: Applied to the log service end, the log query device comprises: A first acquisition unit is configured to acquire a log query command input based on a web page; the first acquisition unit includes: an acquisition subunit, configured to acquire a log query command input in a search bar of a web page received through an application layer protocol; the application layer protocol includes: a full-duplex communication protocol websocket; A second acquisition unit is configured to acquire the electronic device log returned by at least one remote log agent according to the log query command; wherein the log agent establishes a connection with the log server through a long connection protocol to monitor and obtain the electronic device log; the log agent is set in the electronic device to be monitored; A transmission unit, configured to transmit each of the electronic device logs to the web page; Wherein, the log query command includes: at least one name of the electronic device to be monitored and a log storage path in the electronic device to be monitored; The second acquisition unit includes: The control subunit is configured to obtain, according to the log query command, an electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored; wherein the log agent reads the electronic device log from the storage space of the electronic device to be monitored according to the log storage path; The log query device also includes: A checking unit is configured to check the access rights of the initiator of the log query command to the electronic device to be monitored after obtaining the log query command based on the web page input; If the initiator has access rights to the electronic device to be monitored, then according to the log query command, obtain the electronic device log returned by at least one remote log agent corresponding to the name of the electronic device to be monitored; Otherwise, discard the name of the electronic device to be monitored and the log storage path corresponding to the electronic device to be monitored in the log query command; The initiator includes: the account used by the user who initiates the log query command, the identifier of the smart terminal, and the IP address where the user logs in; The checking unit is specifically configured to: check the IP address from which the log query request is initiated; for a log query request that matches a preset IP address, check the identifier of the smart terminal from which the log query request is initiated; for a log query request that matches a preset smart terminal identifier, check the account from which the log query request is initiated; and have different access rights to the electronic device to be monitored for different accounts.

8. The log query device according to claim 7, characterized in that: The second acquiring unit includes: An establishing subunit is configured to establish a connection with a log proxy terminal in the electronic device to be monitored based on a long connection protocol according to at least one electronic device to be monitored corresponding to the log query command; A sending subunit is configured to send the log query command to the log agent of the electronic device to be monitored, so as to obtain the electronic device log returned by at least one remote log agent; The electronic device to be monitored includes: a server to be monitored that generates an electronic device log, a computer to be monitored, or a camera device to be monitored.

9. The log query device according to claim 7, characterized in that: The returned electronic device log is a newly added log relative to the previously returned log.

10. The log query device according to claim 7, characterized in that: The inspection unit comprises: A query subunit is configured to query the electronic device group corresponding to each of the electronic devices to be monitored; A checking subunit, configured to check the access rights of the initiator to the electronic device group; If the initiator has access rights to the electronic device group, determining that the initiator has access rights to the electronic device to be monitored; Otherwise, it is determined that the initiator does not have the access authority for the electronic device to be monitored.

11. A log query device, characterized in that: Applied to a log agent, the log agent is arranged in an electronic device to be monitored; the log query device comprises: A receiving unit, configured to receive a log query command sent by a remote log server, wherein the log agent establishes a connection with the log server through a long connection protocol; A monitoring unit, configured to monitor the local electronic device to be monitored to obtain the electronic device log according to the log query command; A returning unit, configured to return the electronic device log to the log service end; The monitoring unit comprises: An acquisition subunit, configured to acquire a log storage path according to the log query command; A reading subunit is configured to read the electronic device log from the storage space of the local electronic device to be monitored according to the log storage path; The electronic device log is a newly added log relative to the previously returned log; wherein, the method for obtaining the newly added log includes: through the application program interface API, running the log acquisition script program to read the newly added log from the storage space of the electronic device to be monitored; or, reading the newly added log from the storage space of the electronic device to be monitored through the tail or grep command.

12. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the command to implement the log query method according to any one of claims 1 to 4, or the log query method according to claim 5.

13. A storage medium, when commands in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the log query method according to any one of claims 1 to 4, or to execute the log query method according to claim 5.

Citation Information

Patent Citations

  • A client buffer update method and device in distributed system

    CN101146127A

  • Method and device for controlling safety access to storage network and switching equipment

    CN102611624A

  • Application log gathering and sending method, device, system and log server

    CN106559241A

  • A log display method and system realized based on a WEB technology

    CN109783754A

  • Log query method and system, log checking system and query terminal

    CN110858192A