CN112231188A - Log capture method and device, computer equipment and storage medium - Google Patents

Log capture method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112231188A
CN112231188A CN202010914613.1A CN202010914613A CN112231188A CN 112231188 A CN112231188 A CN 112231188A CN 202010914613 A CN202010914613 A CN 202010914613A CN 112231188 A CN112231188 A CN 112231188A
Authority
CN
China
Prior art keywords
log
management equipment
grabbing
capturing
connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010914613.1A
Other languages
Chinese (zh)
Inventor
吴豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fibocom Wireless Inc
Original Assignee
Fibocom Wireless Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fibocom Wireless Inc filed Critical Fibocom Wireless Inc
Priority to CN202010914613.1A priority Critical patent/CN112231188A/en
Publication of CN112231188A publication Critical patent/CN112231188A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a log capturing method and device, equipment to be tested and a storage medium. The method comprises the following steps: receiving a log grabbing instruction sent by a management device; responding to the log grabbing instruction, adopting an online grabbing mode to grab log information in real time and feed the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing logs in the online grabbing mode; when the connection with the management equipment is disconnected, the log information corresponding to the log capturing instruction is continuously captured in an offline capturing mode; and acquiring state information in the process of capturing the log information in the off-line capturing mode, and prompting according to the state information. By adopting the method, the completeness of log capture can be ensured.

Description

Log capture method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a log capture management method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, during the development and test of the device or software, the working state and debugging information of the device or software need to be checked through the captured log information. In the traditional log grabbing method, in the process of grabbing log information on line, if the line is disconnected, the completeness of log grabbing cannot be ensured.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a log crawling method, apparatus, computer device and storage medium capable of ensuring the completeness of log crawling.
A method of log crawling, the method comprising:
receiving a log grabbing instruction sent by a management device;
responding to the log grabbing instruction, adopting an online grabbing mode to grab log information in real time and feed the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing logs in the online grabbing mode;
when the connection with the management equipment is disconnected, the log information corresponding to the log capturing instruction is continuously captured in an offline capturing mode;
and acquiring state information in the process of capturing the log information in the off-line capturing mode, and prompting according to the state information.
In one embodiment, the method further comprises:
receiving a device query instruction sent by the management device;
responding to the equipment inquiry instruction, and sending a registration request to the management equipment;
and receiving a connection establishment instruction sent by the management equipment in response to the registration request, and establishing connection with the management equipment.
In an embodiment, the capturing log information in real time by using an online capture mode and feeding the log information back to the management device includes:
extracting log type and format parameters from the log grabbing instruction;
capturing log information corresponding to the log type in real time in an online capturing mode;
generating a log file with a corresponding format according to the captured log information and the format parameters;
and feeding back the log file to the management equipment.
In one embodiment, the log information captured by the offline capture mode is stored locally in a log file form; the state information comprises the size of a log file stored in the local and the residual space of a storage area for storing the log file; the prompting according to the state information comprises:
extracting prompt trigger conditions from the log grabbing instructions;
when the size of the log file stored in the local meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information;
and sending the prompt message to the network server so as to send the prompt message to the management equipment through the network server.
In one embodiment, the log information captured by the offline capture mode is stored locally in a log file form; the method further comprises the following steps:
detecting whether connection with the management equipment is reestablished or not in the process of capturing the log information in the offline capturing mode;
when the connection with the management equipment is reestablished, the log information is captured by switching to the online capture mode;
and sending the log information which is captured in the offline capturing mode and is stored in a log file form to the management equipment.
In one embodiment, the method further comprises:
establishing a monitoring thread;
monitoring a connection port with the management equipment through the monitoring thread;
and if data are not monitored to be transmitted through the connection port within a preset time period, determining that the connection between the management equipment and the management equipment is disconnected.
A log crawling apparatus, the apparatus comprising:
the receiving module is used for receiving a log grabbing instruction sent by the management equipment;
the online grabbing module is used for responding to the log grabbing instruction, adopting an online grabbing mode to grab log information in real time and feed the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing the log in the online grabbing mode;
the switching module is used for switching to continuously capture the log information corresponding to the log capture instruction in an off-line capture mode when the connection with the management equipment is disconnected;
the acquisition module is used for acquiring state information in the process of capturing the log information in the off-line capturing mode;
and the prompting module is used for prompting according to the state information.
In one embodiment, the apparatus further comprises:
the receiving module is further configured to receive an equipment query instruction sent by the management equipment;
a sending module, configured to send a registration request to the management device in response to the device query instruction;
and the receiving module is used for receiving a connection establishment instruction sent by the management equipment in response to the registration request and establishing connection with the management equipment.
In one embodiment, the online grasping module is further configured to:
extracting log type and format parameters from the log grabbing instruction;
capturing log information corresponding to the log type in real time in an online capturing mode;
generating a log file with a corresponding format according to the captured log information and the format parameters;
and feeding back the log file to the management equipment.
In one embodiment, the log information captured by the offline capture mode is stored locally in a log file form; the state information comprises the size of a log file stored in the local and the residual space of a storage area for storing the log file; the prompt module is further configured to:
extracting prompt trigger conditions from the log grabbing instructions;
when the size of the log file stored in the local meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information;
and sending the prompt message to the network server so as to send the prompt message to the management equipment through the network server.
In one embodiment, the log information captured by the offline capture mode is stored locally in a log file form; the device further comprises:
the detection module is used for detecting whether the connection with the management equipment is reestablished or not in the process of capturing the log information in the offline capturing mode;
the switching module is used for switching to the online capturing mode to capture log information when the connection with the management equipment is reestablished;
and the sending module is used for sending the log information which is captured in the offline capturing mode and is stored in a log file form to the management equipment.
In one embodiment, the apparatus further comprises:
the establishing module is used for establishing a monitoring thread;
the monitoring module is used for monitoring a connection port with the management equipment through the monitoring thread;
and the determining module is used for determining that the connection between the determining module and the management equipment is disconnected if data is not monitored to be transmitted through the connection port within a preset time period.
A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the log scraping method when executing the computer program.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the log scraping method.
In the above embodiment, the device to be tested receives the log capture instruction sent by the management device, and in response to the log capture instruction, captures log information in real time by using an online capture mode and feeds the log information back to the management device. In the process of capturing the log information in real time by adopting an online capturing mode, the device to be tested detects whether the connection between the device to be tested and the management device is disconnected or not in real time, and when the connection between the device to be tested and the management device is disconnected, the device to be tested is switched to an offline log capturing mode and continues to capture the log information corresponding to the log capturing instruction, so that the device to be tested does not stop capturing due to the disconnection between the device to be tested and the management device, and the log capturing integrity is ensured. The device to be tested acquires the state information in the process of capturing the log information in an off-line capturing mode, and prompts the management device according to the state information, so that the management device can acquire the current log capturing state in the state of being disconnected with the device to be tested, and the management device can conveniently manage the log capturing process.
Drawings
FIG. 1 is a diagram of an application environment of a log scraping method in one embodiment;
FIG. 2 is a flowchart illustrating a log scraping method according to an embodiment;
FIG. 3 is a flowchart illustrating a log scraping method according to another embodiment;
FIG. 4 is a block diagram showing the structure of a log ripping apparatus according to an embodiment;
FIG. 5 is a block diagram showing the structure of a log ripping apparatus according to another embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The log grabbing method provided by the application can be applied to the application environment shown in fig. 1. After receiving the log capture instruction sent by the management device 102, the device under test 104 captures log information in real time in an online capture manner and feeds the captured log information back to the management device 102. In the process of capturing the log information in the online capturing mode, the device to be tested 104 detects the connection with the management device in real time, and when the connection with the management device is disconnected, the log information is continuously captured by switching to the offline capturing mode.
The management device 102 may be various personal computers, notebook computers, smart phones, tablet computers, and the like.
The device under test 104 may be a terminal or a server. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server can be implemented by an independent server or a server cluster formed by a plurality of servers.
In an embodiment, as shown in fig. 2, a log capture method is provided, which is described by taking the example that the method is applied to the device under test in fig. 1, and includes the following steps:
s202, the device to be tested receives a log grabbing instruction sent by the management device.
The device to be tested is a device for detecting the working state and debugging information of the device by capturing log information during development and test, or a device for detecting software loaded in the device by capturing logs.
The management equipment is used for checking and managing the log information captured by the equipment to be tested and managing the process of capturing the log information by the equipment to be tested in an online capturing mode.
The log capture instruction is an instruction for the management device to instruct the device to be tested to start capturing the log. And the management equipment sends a log grabbing instruction to the equipment to be tested in any mode which can be accepted by the equipment to be tested. For example, the management device may establish a USB connection with the device under test, and send a log capture instruction to the device under test by using the USB connection. For example, the management device may establish a bluetooth connection with the device to be tested, and send a log capture instruction to the device to be tested in the bluetooth connection manner. For example, the management device may establish a TCP/IP network connection with the device under test, and send the log capture instruction to the device under test in a TCP/IP network connection manner.
The log fetching instruction may include a type of the fetched log, a format parameter, a file size of the fetched log, a prompt trigger condition, a log storage mode, a storage path, and the like.
And S204, responding to the log grabbing instruction, grabbing log information in real time by the device to be tested in an online grabbing manner, feeding the log information back to the management device, and detecting the connection between the device to be tested and the management device in real time in the process of grabbing logs in the online grabbing manner.
The log information is information for recording the running activities of software or hardware in the device to be tested or the device to be tested.
The online capture mode is a capture mode for capturing logs under the condition that the connection is established between the equipment to be tested and the management equipment. The device to be tested and the management device can be connected in various communication modes, such as a USB connection, a Bluetooth connection or a network connection.
The feedback to the management device means that the device to be tested transmits the captured log to the management device. The device to be tested can generate a log file according to the captured logs and transmit the log file to the management device, and can also transmit each captured log to the management device in real time, so that the management device generates the log file according to the received logs.
And detecting whether the connection between the equipment to be detected and the management equipment is disconnected in real time in the process of capturing the log in an online capturing mode.
And S206, when the connection with the management equipment is disconnected, the equipment to be tested is switched to continuously capture the log information corresponding to the log capture instruction in an off-line capture mode.
And detecting the connection between the equipment to be detected and the management equipment in real time, switching the online grabbing mode into the offline grabbing mode when detecting that the connection between the equipment to be detected and the management equipment is disconnected, and continuously grabbing the log information corresponding to the log grabbing instruction.
The off-line capture mode is a capture mode for capturing logs under the condition that the connection between the device to be tested and the management device is disconnected.
In the offline capture mode, the log captured in the offline capture mode is stored locally by the device to be tested due to the fact that the connection between the device to be tested and the management device is disconnected.
And S208, the equipment to be tested acquires the state information in the process of capturing the log information in an off-line capturing mode, and prompts according to the state information.
The state information is information of a state related to log capture, and the state information includes information of a log capture mode (on-line capture and off-line capture), a stop or capture state, a size of a captured log, a storage state and the like.
After the equipment to be tested acquires the state information, prompting is carried out on the management equipment according to the state information, so that the management equipment can carry out corresponding processing according to the prompting.
The device to be tested can be prompted in various ways. In one embodiment, the device to be tested sends the prompt message to a network server, and forwards the prompt message to the management device through the network server. The device to be tested may send the prompt message to the network server via a UDP (User Datagram Protocol).
In one embodiment, the device under test prompts in a manner of generating a prompt voice.
In one embodiment, the above S202-S210 may be performed by a log crawling unit in the device under test.
In the above embodiment, the device to be tested receives the log capture instruction sent by the management device, and in response to the log capture instruction, captures log information in real time by using an online capture mode and feeds the log information back to the management device. In the process of capturing the log information in real time in an online capturing mode, the device to be tested detects whether the connection between the device to be tested and the management device is disconnected or not in real time, and when the connection between the device to be tested and the management device is disconnected, the device to be tested is switched to an offline log capturing mode and continues to capture the log information corresponding to the log capturing instruction. After the connection with the management equipment is disconnected, the equipment to be tested continues to capture the log in an offline log capture mode, capture cannot be stopped due to the disconnection with the management equipment, and the log capture integrity is guaranteed. The device to be tested acquires the state information in the process of capturing the log information in an off-line capturing mode, and prompts the management device according to the state information, so that the management device can acquire the current log capturing state in the state of being disconnected with the device to be tested, and the management device can conveniently manage the log capturing process.
In one embodiment, the device to be tested receives a device query instruction sent by the management device; responding to the equipment inquiry instruction, and sending a registration request to the management equipment; and receiving a connection establishment instruction sent by the management equipment in response to the registration request, and establishing connection with the management equipment.
The device query instruction is an instruction for querying whether a device requests to establish a connection with the management device. The management device may transmit the device query instruction at preset time intervals.
And after receiving the equipment query instruction sent by the management equipment, the equipment to be tested sends a registration request to the management equipment.
The registration request is used for requesting to establish connection with the management equipment. The registration request includes an identification mark of the device to be tested.
After receiving the registration request, the management device may extract the identification mark of the device to be tested from the registration request, and determine whether to agree to establish a connection with the device to be tested according to the identification mark. And if the management equipment agrees to establish connection with the equipment to be tested, sending a connection establishment instruction to the equipment to be tested. And the equipment to be tested establishes connection with the management equipment after receiving the connection establishment instruction.
In one embodiment, the method for capturing log information in real time by the device to be tested in an online capture mode and feeding the log information back to the management device includes: extracting log type and format parameters from the log grabbing instruction; adopting an online grabbing mode to grab log information corresponding to the log type in real time; generating a log file with a corresponding format according to the captured log information and the format parameters; and feeding the log file back to the management equipment.
The log type is a type of log which is captured by the log capture instruction and indicates the device to be tested, and the log type comprises a debugging log, an information log, an early warning log, an error information log and the like. The debugging log is a log for recording information for debugging the device to be tested. The information log is a log for recording the normal working information of the equipment to be tested. The early warning log is a log for early warning of a problem that may occur. The error information log is a log generated when a problem occurs in the device under test.
Wherein the format parameter is used for representing the format of the generated log file. The log file may be in a log file format, an Evtx (Engineering Verification Test) file format, or a txt file format.
The log information is information which is captured by the equipment to be tested and is related to the running state and the debugging information.
And the equipment to be tested captures log information corresponding to the log type in real time according to the log capture instruction, screens out the required log type and is convenient to check the log information.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the state information comprises the size of the log file stored in the local and the residual space of the storage area for storing the log file; the prompting of the equipment to be tested according to the state information comprises the following steps: extracting prompt trigger conditions from the log grabbing instructions; when the size of the log file stored in the local storage meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information; and sending a prompt message to the network server so as to send the prompt message to the management equipment through the network server.
Because the connection between the management device and the device to be tested is disconnected in the process of capturing the log information in an off-line manner, the management device cannot acquire the size of the log file stored in the local and the residual space of the storage area for storing the log file through the connection between the management device and the device to be tested.
The size of the log file is the size of the log file stored in the local storage area for storing the log file.
Wherein, the residual space of the storage area for saving the log file is the residual space of the storage area which can also store the log file.
The prompt triggering condition is a condition for judging whether the management equipment is prompted according to the state information by the equipment to be tested. The prompt triggering condition may be that the size of the log file reaches a file size threshold, or that the remaining space of the storage area for storing the log file is reduced to a space threshold, or that the number of generated log files reaches a number threshold, or the like.
The prompt message is a message for prompting the management device according to the state information. The prompt message may include the size of the log file in the storage area where the log file is stored, the size of the remaining space of the storage area, the processing manner that the management device can take, and the like.
The device to be tested prompts the management device through the prompt message, so that the management device can obtain the storage state in the storage area in time and extract the log file from the storage area in time. The log file generated after the storage area is full is prevented from being lost due to ubiquitous storage.
In one embodiment, the log capture instruction includes a processing mode when a storage area for storing the log file cannot meet the storage requirement of the log file, and the processing mode includes a stopping capture mode or a covering original log file and continuing capture mode. If the device to be tested sends a prompt message to the management device to remind the management device that the log file is not extracted from the storage area for storing the log file after the management device extracts the log file from the storage area for storing the log file. And then the equipment to be tested extracts the processing mode from the log grabbing instruction, and stops grabbing or covers the original log file according to the processing mode and continues grabbing.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the method further comprises the following steps: in the process of capturing log information in an off-line capturing mode, detecting whether connection with management equipment is reestablished; when the connection with the management equipment is reestablished, the log information is captured by switching to an online capture mode; and sending the log information which is captured in an off-line capturing mode and is stored in a log file form to the management equipment.
After the device to be tested is connected with the management device again, the log information which is captured in an off-line capturing mode and stored in a log file form when the device to be tested is disconnected with the management device is sent to the management device, so that the management device can store and check the log file in time.
The device to be tested detects the connection between the device to be tested and the management device in real time, when the connection is disconnected, the online grabbing mode is switched to the offline grabbing mode, after the connection is reestablished, the offline grabbing mode is switched to the online grabbing mode, the log grabbing process is not suspended due to the disconnection between the log grabbing mode and the management device, and the log grabbing integrity is guaranteed.
In one embodiment, the device under test may detect whether the connection with the management device is disconnected by sending a test instruction to the management device, and determine that the connection with the management device is disconnected if a reply to the test instruction from the management device is not received within a set time.
In one embodiment, a device under test establishes a monitoring thread; monitoring a connection port of the management equipment through a monitoring thread; and if the data is not monitored to be transmitted through the connection port within the preset time period, determining that the connection between the management equipment and the management equipment is disconnected.
The monitoring thread is a thread for monitoring a connection port between the management device and the monitoring thread.
The device to be tested establishes a monitoring thread to monitor the connection port with the management device, so that when the connection with the management device is disconnected, the log can be timely found and switched to an offline capturing mode to capture the log. The log capturing stop or log file loss caused by the fact that the connection between the log capturing device and the management device cannot be found out in time and is disconnected is avoided.
In one embodiment, as shown in fig. 3, the process of capturing logs by the device under test includes the following steps:
s302, connection between the management equipment and the device is established.
And S304, receiving a log grabbing instruction sent by the management equipment.
S306, responding to the log grabbing instruction, adopting an online grabbing mode to grab log information in real time and feed the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing the log information in the online grabbing mode.
S308, whether the connection with the management equipment is disconnected or not is judged.
S310, keeping an online grabbing mode to grab log information, and sending the generated log information to the management equipment.
And S312, switching to continuously capturing the log information corresponding to the log capturing instruction in an offline capturing mode.
And S314, when the size of the log file stored in the local storage meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information.
And S316, sending the prompting message to the network server so as to send the prompting message to the management equipment through the network server.
And S318, stopping grabbing the log information according to the grabbing stopping instruction.
The specific contents of S302 to S318 may refer to the specific implementation process described above.
It should be understood that although the various steps in the flow charts of fig. 2-3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-3 may include multiple steps or phases that are not necessarily completed at the same time, but may be performed at different times, and the order of execution of the steps or phases is not necessarily sequential, but may be alternated or performed with other steps or at least some of the other steps or phases.
In one embodiment, as shown in fig. 4, there is provided a log crawling apparatus, including: a receiving module 402, an online grabbing module 404, a switching module 406, an obtaining module 408 and a prompting module 410, wherein:
a receiving module 402, configured to receive a log capture instruction sent by a management device;
the online grabbing module 404 is configured to, in response to a log grabbing instruction, grab log information in real time in an online grabbing manner and feed the information back to the management device, and detect connection with the management device in real time in a process of grabbing a log in the online grabbing manner;
the switching module 406 is configured to switch to continuously capture log information corresponding to the log capture instruction in an offline capture manner when the connection with the management device is disconnected;
the obtaining module 408 is configured to obtain state information in the process of capturing log information in an offline capturing manner;
and a prompt module 410, configured to perform a prompt according to the state information.
In the above embodiment, the device to be tested receives the log capture instruction sent by the management device, and in response to the log capture instruction, captures log information in real time by using an online capture mode and feeds the log information back to the management device. In the process of capturing the log information in real time in an online capturing mode, the device to be tested detects whether the connection between the device to be tested and the management device is disconnected or not in real time, and when the connection between the device to be tested and the management device is disconnected, the device to be tested is switched to an offline log capturing mode and continues to capture the log information corresponding to the log capturing instruction. After the connection between the device to be tested and the management device is disconnected, the device to be tested continues to capture the log in an offline log capture mode, the capture of the log cannot be stopped due to the disconnection between the device to be tested and the management device, and the log capture integrity is guaranteed. The device to be tested acquires the state information in the process of capturing the log information in an off-line capturing mode and prompts the management device according to the state information, so that the management device can acquire the current log capturing state in the state of being disconnected with the device to be tested, and the management device can conveniently manage the log capturing process.
In one embodiment, as shown in fig. 5, the apparatus further comprises:
a receiving module 402, configured to receive a device query instruction sent by a management device;
a sending module 412, configured to send a registration request to the management device in response to the device query instruction;
a receiving module 402, configured to receive a connection establishment instruction sent by the management device in response to the registration request, and establish a connection with the management device.
In one embodiment, the online grab module 404 is further configured to:
extracting log type and format parameters from the log grabbing instruction;
adopting an online grabbing mode to grab log information corresponding to the log type in real time;
generating a log file with a corresponding format according to the captured log information and the format parameters;
and feeding the log file back to the management equipment.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the state information comprises the size of the log file stored in the local and the residual space of the storage area for storing the log file; the prompting module 410 is further configured to:
extracting prompt trigger conditions from the log grabbing instructions;
when the size of the log file stored in the local storage meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information;
and sending a prompt message to the network server so as to send the prompt message to the management equipment through the network server.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the device still includes:
the detecting module 414 is configured to detect whether a connection is reestablished with the management device during capturing the log information in an offline capturing manner;
a switching module 406, configured to switch to an online capture mode to capture log information when connection with the management device is reestablished;
the sending module 412 is configured to send the log information captured in the offline capture manner and saved in the form of a log file to the management device.
In one embodiment, the apparatus further comprises:
an establishing module 416, configured to establish a listening thread;
a monitoring module 418, configured to monitor a connection port of the management device through a monitoring thread;
the determining module 420 is configured to determine that the connection with the management device is disconnected if no data is monitored to be transmitted through the connection port within a preset time period.
For the specific definition of the log capture device, reference may be made to the above definition of the log capture method, which is not described herein again. All or part of the modules in the log grabbing device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing log scraping data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a log scraping method.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 7. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a log scraping method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the configurations shown in fig. 6 and 7 are merely block diagrams of some configurations relevant to the present disclosure, and do not constitute a limitation on the computing devices to which the present disclosure may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor when executing the computer program further implementing the steps of: receiving a log grabbing instruction sent by a management device; in response to a log grabbing instruction, adopting an online grabbing mode to grab log information in real time and feed the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing the log in the online grabbing mode; when the connection with the management equipment is disconnected, the log information corresponding to the log capturing instruction is continuously captured in an offline capturing mode; and acquiring state information in the process of capturing the log information in an off-line capturing mode, and prompting according to the state information.
In one embodiment, the processor, when executing the computer program, further performs the steps of: receiving a device query instruction sent by a management device; responding to the equipment inquiry instruction, and sending a registration request to the management equipment; and receiving a connection establishment instruction sent by the management equipment in response to the registration request, and establishing connection with the management equipment.
In one embodiment, the processor, when executing the computer program, further performs the steps of: extracting log type and format parameters from the log grabbing instruction; adopting an online grabbing mode to grab log information corresponding to the log type in real time; generating a log file with a corresponding format according to the captured log information and the format parameters; and feeding the log file back to the management equipment.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the processor, when executing the computer program, further performs the steps of: the state information comprises the size of the log file stored in the local and the residual space of the storage area for storing the log file; the prompting according to the state information comprises the following steps: extracting prompt trigger conditions from the log grabbing instructions; when the size of the log file stored in the local storage meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information; and sending a prompt message to the network server so as to send the prompt message to the management equipment through the network server.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the processor, when executing the computer program, further performs the steps of: the method further comprises the following steps: in the process of capturing log information in an off-line capturing mode, detecting whether connection with management equipment is reestablished; when the connection with the management equipment is reestablished, the log information is captured by switching to an online capture mode; and sending the log information which is captured in an off-line capturing mode and is stored in a log file form to the management equipment.
In one embodiment, the processor, when executing the computer program, further performs the steps of: establishing a monitoring thread; monitoring a connection port of the management equipment through a monitoring thread; and if the data is not monitored to be transmitted through the connection port within the preset time period, determining that the connection between the management equipment and the management equipment is disconnected.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving a log grabbing instruction sent by a management device; in response to a log grabbing instruction, adopting an online grabbing mode to grab log information in real time and feed the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing the log in the online grabbing mode; when the connection with the management equipment is disconnected, the log information corresponding to the log capturing instruction is continuously captured in an offline capturing mode; and acquiring state information in the process of capturing the log information in an off-line capturing mode, and prompting according to the state information.
In one embodiment, the computer program when executed by the processor further performs the steps of: receiving a device query instruction sent by a management device; responding to the equipment inquiry instruction, and sending a registration request to the management equipment; and receiving a connection establishment instruction sent by the management equipment in response to the registration request, and establishing connection with the management equipment.
In one embodiment, the computer program when executed by the processor further performs the steps of: extracting log type and format parameters from the log grabbing instruction; adopting an online grabbing mode to grab log information corresponding to the log type in real time; generating a log file with a corresponding format according to the captured log information and the format parameters; and feeding the log file back to the management equipment.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the computer program when executed by the processor further realizes the steps of: the state information comprises the size of the log file stored in the local and the residual space of the storage area for storing the log file; the prompting according to the state information comprises the following steps: extracting prompt trigger conditions from the log grabbing instructions; when the size of the log file stored in the local storage meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information; and sending a prompt message to the network server so as to send the prompt message to the management equipment through the network server.
In one embodiment, log information captured in an off-line capturing mode is stored locally in a log file form; the computer program when executed by the processor further realizes the steps of: the method further comprises the following steps: in the process of capturing log information in an off-line capturing mode, detecting whether connection with management equipment is reestablished; when the connection with the management equipment is reestablished, the log information is captured by switching to an online capture mode; and sending the log information which is captured in an off-line capturing mode and is stored in a log file form to the management equipment.
In one embodiment, the computer program when executed by the processor further performs the steps of: establishing a monitoring thread; monitoring a connection port of the management equipment through a monitoring thread; and if the data is not monitored to be transmitted through the connection port within the preset time period, determining that the connection between the management equipment and the management equipment is disconnected.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. 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), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A log crawling method, characterized in that the method comprises:
receiving a log grabbing instruction sent by a management device;
responding to the log grabbing instruction, adopting an online grabbing mode to grab log information in real time and feed the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing the log information in the online grabbing mode;
when the connection with the management equipment is disconnected, the log information corresponding to the log capturing instruction is continuously captured in an offline capturing mode;
and acquiring state information in the process of capturing the log information in the off-line capturing mode, and prompting according to the state information.
2. The method of claim 1, further comprising:
receiving a device query instruction sent by the management device;
responding to the equipment inquiry instruction, and sending a registration request to the management equipment;
and receiving a connection establishment instruction sent by the management equipment in response to the registration request, and establishing connection with the management equipment.
3. The method of claim 1, wherein the capturing log information in real time by using an online capture mode and feeding the log information back to the management device comprises:
extracting log type and format parameters from the log grabbing instruction;
capturing log information corresponding to the log type in real time in an online capturing mode;
generating a log file with a corresponding format according to the captured log information and the format parameters;
and feeding back the log file to the management equipment.
4. The method according to claim 1, wherein the log information captured by the offline capture mode is stored locally in a log file form; the state information comprises the size of a log file stored in the local and the residual space of a storage area for storing the log file; the prompting according to the state information comprises:
extracting prompt trigger conditions from the log grabbing instructions;
when the size of the log file stored in the local meets the prompt triggering condition, or the residual space of the storage area for storing the log file meets the prompt triggering condition, generating a prompt message according to the state information;
and sending the prompt message to the network server so as to send the prompt message to the management equipment through the network server.
5. The method according to claim 1, wherein the log information captured by the offline capture mode is stored locally in a log file form; the method further comprises the following steps:
detecting whether connection with the management equipment is reestablished or not in the process of capturing the log information in the offline capturing mode;
when the connection with the management equipment is reestablished, the log information is captured by switching to the online capture mode;
and sending the log information which is captured in the offline capturing mode and is stored in a log file form to the management equipment.
6. The method of claim 1, further comprising:
establishing a monitoring thread;
monitoring a connection port with the management equipment through the monitoring thread;
and if data are not monitored to be transmitted through the connection port within a preset time period, determining that the connection between the management equipment and the management equipment is disconnected.
7. An apparatus for log crawling, the apparatus comprising:
the receiving module is used for receiving a log grabbing instruction sent by the management equipment;
the online grabbing module is used for responding to the log grabbing instruction, grabbing log information in an online grabbing manner in real time and feeding the log information back to the management equipment, and detecting the connection between the log information and the management equipment in real time in the process of grabbing the log information in the online grabbing manner;
the switching module is used for switching to continuously capture the log information corresponding to the log capture instruction in an off-line capture mode when the connection with the management equipment is disconnected;
the acquisition module is used for acquiring state information in the process of capturing the log information in the off-line capturing mode;
and the prompting module is used for prompting according to the state information.
8. The apparatus of claim 7, further comprising:
the receiving module is further configured to receive an equipment query instruction sent by the management equipment;
a sending module, configured to send a registration request to the management device in response to the device query instruction;
and the receiving module is used for receiving a connection establishment instruction sent by the management equipment in response to the registration request and establishing connection with the management equipment.
9. Device under test comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN202010914613.1A 2020-09-03 2020-09-03 Log capture method and device, computer equipment and storage medium Pending CN112231188A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010914613.1A CN112231188A (en) 2020-09-03 2020-09-03 Log capture method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010914613.1A CN112231188A (en) 2020-09-03 2020-09-03 Log capture method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112231188A true CN112231188A (en) 2021-01-15

Family

ID=74115466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010914613.1A Pending CN112231188A (en) 2020-09-03 2020-09-03 Log capture method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112231188A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113411402A (en) * 2021-06-22 2021-09-17 浙江百应科技有限公司 Device monitoring method and device based on adb and electronic device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289476A (en) * 2011-07-29 2011-12-21 河南辉煌科技股份有限公司 Method for recording transaction log
CN103326896A (en) * 2013-06-07 2013-09-25 合一信息技术(北京)有限公司 System and method for collecting information data generated by a user on Internet
US20180165892A1 (en) * 2016-12-13 2018-06-14 Thales Aircraft logbook management
CN109840188A (en) * 2017-11-24 2019-06-04 深圳市优必选科技有限公司 Log obtaining method and terminal thereof
CN110956509A (en) * 2019-12-20 2020-04-03 秒针信息技术有限公司 Outdoor advertisement monitoring method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289476A (en) * 2011-07-29 2011-12-21 河南辉煌科技股份有限公司 Method for recording transaction log
CN103326896A (en) * 2013-06-07 2013-09-25 合一信息技术(北京)有限公司 System and method for collecting information data generated by a user on Internet
US20180165892A1 (en) * 2016-12-13 2018-06-14 Thales Aircraft logbook management
CN109840188A (en) * 2017-11-24 2019-06-04 深圳市优必选科技有限公司 Log obtaining method and terminal thereof
CN110956509A (en) * 2019-12-20 2020-04-03 秒针信息技术有限公司 Outdoor advertisement monitoring method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113411402A (en) * 2021-06-22 2021-09-17 浙江百应科技有限公司 Device monitoring method and device based on adb and electronic device

Similar Documents

Publication Publication Date Title
CN110363020B (en) Screen capturing monitoring method, device, computer equipment and storage medium
CN104980399B (en) File transmission method, client and proxy server
CN110838953B (en) Test method, test system, electronic equipment and storage medium
CN104268055A (en) Program exception monitoring method and device
CN109325349A (en) A kind of method for managing security, terminal device and computer readable storage medium
CN112350861A (en) Log obtaining method and device, computer equipment and storage medium
CN104993961A (en) Equipment control methods, devices and system
CN112217890A (en) Remote assistance method, device, computer equipment and storage medium
CN112348462B (en) Process processing method, apparatus, computer device, and storage medium
CN112333263A (en) Screen capture processing method and device based on hypertext transfer protocol and storage medium
CN110505246B (en) Client network communication detection method, device and storage medium
CN110471852A (en) Online test method, system and electronic equipment
CN112231188A (en) Log capture method and device, computer equipment and storage medium
CN107943662A (en) A kind of information processing method and server
CN113849356A (en) Equipment testing method and device, electronic equipment and storage medium
CN111082996B (en) Automatic configuration method, device and medium for in-band monitoring software
CN111372240A (en) Picture uploading method and device, computer equipment and storage medium
CN114039760B (en) Security testing method and device, computer equipment and storage medium
CN110198230B (en) Application monitoring method and device, storage medium and electronic device
CN116684489A (en) Remote test method, system, device and storage medium
CN113987506A (en) Test method, apparatus, test equipment and storage medium for certification system
CN114138629A (en) Test method, device, equipment and storage medium
CN108768768B (en) Blocking detection method and device for business system and storage medium
CN111475322A (en) Method and device for positioning stuck thread, computer equipment and readable storage medium
CN114546560A (en) Data sharing method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination