Log acquisition method, device, computer equipment and storage medium
By using hot-swap drivers and storage devices on the BMC substrate management controller, the server logs are automatically acquired and analyzed in a network-free environment, solving the problem of network dependence in traditional methods and ensuring the feasibility of server failure analysis .
Patent Information
- Application Number
- CN202111550339.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-12-17
AI Technical Summary
Traditional server log file acquisition methods rely on a stable network environment. When the server is down and the network is unstable, log files cannot be obtained, resulting in the failure cause being unable to be analyzed.
By loading hot-swap drivers on the BMC substrate management controller, using hot-swap storage devices for log collection and compression processing, and downloading log files to preset directories, automatic log acquisition in a network-free environment is achieved.
The dependence on the network environment during log collection is eliminated, and the automatic collection and analysis of server logs in the event of network outage or network instability is realized.
Smart Images

Figure CN114416498B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer processing technology, and in particular to a log acquisition method, device, computer equipment, storage medium and computer program product. Background Art
[0002] BMC is an indispensable part of the server motherboard as a control unit responsible for monitoring the normal operation of the motherboard hardware. When the server goes down, the server operation and maintenance personnel can log in to the BMC web management interface to collect server log files and analyze the cause of the server failure based on the obtained log files.
[0003] However, the traditional method of obtaining server log files depends on a stable network environment. When the server crashes and the network is disconnected or the network status is unstable, the operation and maintenance personnel cannot log in to the BMC web to obtain log files. Therefore, a log acquisition method that does not depend on the network environment is urgently needed. Summary of the invention
[0004] Based on this, it is necessary to provide a log acquisition method, apparatus, computer device, computer readable storage medium and computer program product to address the above technical problems.
[0005] In a first aspect, the present application provides a log acquisition method. The method comprises:
[0006] When a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection;
[0007] Compressing and packaging the collected logs to generate compressed files;
[0008] The compressed file is downloaded to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0009] By adopting this method, when the network is disconnected or the network status is unstable, when a server crash occurs, the automatic collection of server logs is realized based on hot-swappable storage devices and a driver pre-deployed in the BMC, and a compressed log file containing various components of the server is obtained, thereby eliminating the dependence on the network environment during the log collection process.
[0010] In one of the embodiments, the hot-swap interface is provided on a server mainboard, and the hot-swap storage device is directly connected to an onboard chip of the BMC via the hot-swap interface.
[0011] In this embodiment, by improving the hardware interface on the server motherboard, the BMC system onboard chip can be directly connected to the hot-swappable storage device, so that by running the hot-swappable driver, the automatic acquisition of server logs can be achieved in the absence of a network environment, and at the same time, the dependence of the log acquisition task on the network environment is eliminated.
[0012] In one of the embodiments, when the hot-swap storage device is connected to the hot-swap interface of the BMC baseboard management controller, before loading and running the hot-swap driver, the method further includes:
[0013] Initialize the kernel system and load the BMC internal driver;
[0014] Running the BMC internal driver to determine whether the hot-swappable storage device is connected according to a preset detection cycle;
[0015] If the hot-pluggable storage device is connected, read the attribute information of the hot-pluggable storage device;
[0016] According to the attribute information of the hot-plug storage device, a log acquisition instruction of a type corresponding to the hot-plug storage device is determined, so that the log collection program is executed according to the log acquisition instruction.
[0017] In this embodiment, the attribute information of the hot-plug storage device can be obtained through the pre-configured hot-plug driver, so as to determine the control instruction corresponding to the hot-plug storage device according to the attribute information, thereby realizing automatic acquisition of the log.
[0018] In one embodiment, before triggering the execution of the log collection program in the BMC to collect logs, the method further includes:
[0019] Based on the hot-plug driver, mounting the storage partition in the hot-plug storage device to a preset directory of the BMC;
[0020] Obtaining the insertion time information of the hot-swappable storage device, and generating a file name containing the insertion time information according to the insertion time information and a preset file naming format;
[0021] A log folder named with the file name is created in the preset directory of the BMC.
[0022] In this embodiment, the hot-swappable storage device is mounted to the BMC preset directory and a log folder is created in advance to achieve connectivity between the hot-swappable storage device and the BMC. In the absence of a network, the log file can be directly downloaded to the mounted log folder to obtain the log file.
[0023] In one embodiment, before compressing and packaging the collected logs to generate a compressed file, the method further includes:
[0024] Monitoring the log collection progress of each component of the server by the log collection program based on the monitoring process of the BMC;
[0025] When all logs of the server components are collected, the step of compressing and packaging the collected logs to generate a compressed file is performed.
[0026] In this embodiment, the monitoring process in the BMC monitors the progress of the log collection program in acquiring the logs of each component of the server, so as to perform real-time detection of the log acquisition process, and at the same time compress and package the acquired logs to reduce the storage space occupied by the hot-swappable storage device mounted under the BMC.
[0027] In one of the embodiments, a button indicator light is pre-set on the server, and when the hot-swappable storage device is connected to the hot-swappable interface of the BMC baseboard management controller, the method further includes:
[0028] Execute the control thread to control the button indicator light to enter a flashing state until the hot-swappable storage device log download is completed;
[0029] Exit the control thread and control the button indicator light to switch the light flashing state.
[0030] In this embodiment, when there is no network setting and the BMC web cannot be logged in, a button indicator light is set on the server and an indicator light control process is added inside the server, thereby realizing the function of prompting the user of the log acquisition process.
[0031] In a second aspect, the present application also provides a log acquisition device. The device comprises:
[0032] A trigger collection module is used to load and run a hot-plug driver program when a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, and trigger the execution of a log collection program in the BMC based on the hot-plug driver program to collect logs;
[0033] A generation module is used to compress and package the collected logs to generate a compressed file;
[0034] The download module is used to download the compressed file to a folder in a preset directory, where the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0035] By adopting this device, when the network is disconnected or the network status is unstable, when the server crashes, the server logs can be automatically collected based on the hot-swappable storage device and the driver pre-deployed in the BMC, and a compressed log file containing various components of the server can be obtained, eliminating the dependence on the network environment during the log collection process.
[0036] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0037] When a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection;
[0038] Compressing and packaging the collected logs to generate compressed files;
[0039] The compressed file is downloaded to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0040] By using this computer device, when the network is disconnected or the network status is unstable, when a server crash occurs, the server logs can be automatically collected based on the hot-swappable storage device and the driver pre-deployed in the BMC, and a compressed log file containing various server components can be obtained, eliminating the dependence on the network environment during the log collection process.
[0041] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0042] When a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection;
[0043] Compressing and packaging the collected logs to generate compressed files;
[0044] The compressed file is downloaded to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0045] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0046] When a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection;
[0047] Compressing and packaging the collected logs to generate compressed files;
[0048] The compressed file is downloaded to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0049] The above-mentioned log acquisition method, device, computer equipment, storage medium and computer program product, when the hot-plug storage device is connected to the hot-plug interface of the BMC baseboard management controller, loads and runs the hot-plug driver, based on the hot-plug driver, triggers the execution of the log collection program in the BMC to collect logs; compresses and packages the collected logs to generate a compressed file; downloads the compressed file to a folder in the preset directory of the BMC, and the folder in the preset directory is created by mounting the partition folder of the hot-plug storage device to the preset directory of the BMC. With this method, when the network is disconnected or the network status is unstable, when the server crashes, based on the hot-plug storage device and the driver pre-deployed in the BMC, the automatic collection of server logs is realized, and a log compression file containing various components of the server is obtained, eliminating the dependence on the network environment during the log collection process. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A flow chart of a log acquisition method in one embodiment;
[0051] Figure 2 A schematic diagram of server mainboard interface connection in one embodiment;
[0052] Figure 3 A flowchart of the steps of initializing and obtaining attribute information of a hot-swappable storage device in one embodiment;
[0053] Figure 4 A schematic diagram of a process of hot-swappable storage device partition mounting steps in one embodiment;
[0054] Figure 5 A flow chart of a log collection step in one embodiment;
[0055] Figure 6 A schematic diagram of a flow chart of a step of controlling a button indicator light to provide a progress prompt in an embodiment;
[0056] Figure 7 An example flow chart of a log acquisition method in an embodiment;
[0057] Figure 8 is a structural block diagram of a log acquisition device in an embodiment;
[0058] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] In one embodiment, Figure 1 As shown, a log acquisition method is provided. This embodiment is described by applying the method to a server. In this embodiment, the method includes the following steps:
[0061] Step 102 , when the hot-plug storage device is connected to the hot-plug interface of the BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection.
[0062] In practice, when a server crashes, it is necessary to obtain the logs of each component in the server, analyze the logs of each component, and then determine the cause of the server crash. In addition, in order to get rid of the dependence on the network environment when acquiring logs, when acquiring server logs, technicians have developed a new hot-swappable interface on the server motherboard, so that the hot-swappable storage device can be directly inserted into the preset hot-swappable interface of the server motherboard, and the hot-swappable storage device can be connected to the BMC (Baseboard Management Controller) onboard chip through this interface. When acquiring logs in the server, when the hot-swappable storage device is inserted into the hot-swappable interface of the server motherboard, the server is triggered to load and run the hot-swappable driver, and based on the drive instructions in the hot-swappable driver, the log collection program in the BMC system is triggered to collect logs.
[0063] The hot-swappable storage device may be, but is not limited to, a USB (Universal Serial BUS) storage device.
[0064] Step 104: compress and package the collected logs to generate a compressed file.
[0065] In implementation, based on the triggering of the hot-swap driver, the BMC system in the server collects and processes logs for each component in the server, for example, logs are obtained for modules or components such as the SEL (System Event Log), hard disk, memory, and CPU (Central Processing Unit) in the server, and then all the collected logs are compressed and packaged to generate a compressed file containing the logs of each component.
[0066] Step 106, downloading the compressed file to a folder in a preset directory.
[0067] The folder of the preset directory is obtained by mounting the partition of the hot-swappable storage device to the preset directory of the BMC and creating the folder.
[0068] In implementation, the server downloads the generated compressed file to a folder in a preset directory under the BMC based on the copy instruction in the driver program, so as to download and obtain the logs of each module or component in the server. Specifically, the folder under the preset directory of the BMC is obtained by mounting the pre-established folder of the hot-swappable storage device to the preset directory of the BMC system after partition mounting between the hot-swappable storage device and the BMC of the server. Therefore, when the generated compressed file is downloaded to the folder in the preset directory of the BMC, the hot-swappable storage device stores the compressed file containing the logs of each component, thereby realizing the automatic acquisition of the logs without a network.
[0069] In the above log acquisition method, when the hot-plug storage device is connected to the hot-plug interface of the BMC, the server loads and runs the hot-plug driver, and based on the hot-plug driver, triggers the execution of the log collection program in the BMC to collect logs. Then, the server compresses and packages the collected logs, generates a compressed file, and downloads the compressed file to a folder in a preset directory. Among them, the folder in the preset directory is obtained by mounting the hot-plug storage device partition to the preset directory of the BMC and creating a folder. Using this method, when the network is disconnected or the network status is unstable, when the server crashes, based on the hot-plug storage device and the driver pre-deployed in the BMC, the automatic collection of server logs is realized, and a log compression file containing various components of the server is obtained, eliminating the dependence on the network environment during the log collection process.
[0070] In one embodiment, the hot-swap interface is provided on the server mainboard, and the hot-swap storage device is directly connected to the onboard chip of the BMC via the hot-swap interface.
[0071] In practice, since BMC is independent of the server motherboard components, it will be set on an independent SOC (System on Chip) board in the server and run in an independent power supply mode. BMC can communicate with various components on the server motherboard and monitor the status of the server motherboard. Therefore, in hardware design, the hot-swap interface that can realize the log acquisition function is connected to the BMC system onboard chip, such as Figure 2 As shown, the pre-developed hot-swap interface on the server motherboard is directly connected to the onboard chip of the BMC. Therefore, when the server is down and there is no network environment, the hot-swap storage device can be directly connected to the BMC system based on the hot-swap interface.
[0072] In this embodiment, by improving the hardware interface on the server mainboard, the BMC system onboard chip can be directly connected to the hot-swappable storage device, so that by running the hot-swappable driver, the automatic acquisition of server logs can be realized in the absence of a network environment, eliminating the dependence of the log acquisition task on the network environment.
[0073] In one embodiment, Figure 3 As shown, the specific processing process of step 102 includes the following steps:
[0074] Step 302: Initialize the kernel system and load the BMC internal driver.
[0075] In practice, after inserting the hot-swappable storage device, the server is triggered to run the U-Boot program to initialize the kernel system. The U-Boot is the boot loader of the embedded system. Based on the initialized kernel system, the server loads the BMC internal driver, through which the subsequent server operation status can be detected.
[0076] In an optional implementation, the loaded BMC internal driver is a driver built into the BMC system, which is used as a part of the hot-swappable driver in the present application to detect and control the hot-swappable storage device. Specifically, the hot-swappable storage device is a USB storage device as an example for explanation, and the internal drivers included in the hot-swappable driver are a USB driver (USB driver), a Hub driver (driver update management tool), and a USB generic driver (generic driver). The server loads the above-listed USB storage device file system driver to detect the inserted USB device.
[0077] Step 304: Run the BMC internal driver program to determine whether the hot-swappable storage device is connected according to a preset detection cycle.
[0078] In implementation, after the BMC system is started, the server runs the added BMC internal driver, and based on the triggering of the internal driver, continuously detects whether the hot-swappable storage device is connected according to a preset detection cycle. Specifically, the server detects whether the USB storage device is inserted through the added Hub driver thread.
[0079] Step 306: If a hot-swappable storage device is connected, read the attribute information of the hot-swappable storage device.
[0080] In implementation, if the server detects that the hot-plug storage device has been connected, the server then reads the attribute information of the hot-plug storage device based on the information acquisition thread in the hot-plug driver in this application. Among them, the attribute information of the hot-plug storage device may include the storage space size of the hot-plug storage device, the file system format of the hot-plug storage device, the hardware serial number of the hot-plug storage device, the storage directory in the hot-plug storage device (i.e., the file hierarchy storage structure of the file tree type), the operating status of the hot-plug device and the insertion time of the hot-plug device, etc. The embodiment of the present application does not limit the attribute information of the hot-plug storage device obtained. Furthermore, the server can record and store the attribute information of the hot-plug storage device obtained, or perform instruction query based on the attribute information of the hot-plug storage device.
[0081] Optionally, if the hot-swappable storage device is not connected, the step of detecting whether the hot-swappable storage device is connected in the above step 304 is repeated.
[0082] Step 308: Determine a log acquisition instruction of a type corresponding to the hot-plug storage device according to the attribute information of the hot-plug storage device, so as to execute a log collection program according to the log acquisition instruction.
[0083] In implementation, the server can determine the target type of log acquisition instruction to be executed in the hot-plug driver according to the read attribute information of the hot-plug storage device, so as to start executing the log collection program according to the log acquisition instruction.
[0084] In this embodiment, the attribute information of the hot-plug storage device can be obtained through the pre-configured hot-plug driver, so as to determine the control instruction corresponding to the hot-plug storage device according to the attribute information, thereby realizing automatic acquisition of the log.
[0085] In one embodiment, Figure 4 As shown, before step 102, the method further includes:
[0086] Step 402: Based on the hot-plug driver, mount the storage partition in the hot-plug storage device to a preset directory of the BMC.
[0087] In implementation, the server mounts the storage partition in the hot-swappable storage device to a preset directory of the BMC based on the triggering of the hot-swappable driver (i.e., the internal driver in the hot-swappable driver). Specifically, the server executes the USB generic driver in the driver, and mounts the USB device file system to the BMC bus file tree based on the storage partition in the USB, so as to establish a storage mapping relationship between the hot-swappable storage device and the BMC.
[0088] Step 404, obtaining the insertion time information of the hot-swappable storage device, and generating a file name including the insertion time information according to the insertion time information and a preset file naming format.
[0089] In implementation, the server obtains the insertion time information of the hot-swappable storage device based on the Hub driver (driver update management tool) in the driver. Then, based on the insertion time information and the preset file naming format, a file name containing the insertion time information is generated. For example, the timestamp record of the insertion time of the hot-swappable storage device is 2021.12.10.08:51:24, then based on the obtained timestamp information of the insertion time, the generated file name is expressed as 20211210085124.
[0090] Step 406: Create a log folder named with the file name in the preset directory of the BMC.
[0091] In implementation, after mounting the hot-swappable storage device to the preset directory of the BMC, the server creates a log folder named with the insertion time of the hot-swappable device as the file name, so as to store the acquired logs.
[0092] In this embodiment, the hot-swappable storage device is mounted to the BMC preset directory and a log folder is created in advance to achieve connectivity between the hot-swappable storage device and the BMC. In the absence of a network, the log file can be directly downloaded to the mounted log folder to obtain the log file.
[0093] In one embodiment, Figure 5 As shown, before step 104, the method further includes:
[0094] Step 502: Based on the monitoring process of the BMC, the log collection program monitors the progress of the log collection on each component of the server.
[0095] In implementation, the server monitors the progress of the log collection program on the logs of various components of the server based on the monitoring process of the BMC. For example, the various components of the server include power supply, hard disk, memory, etc. The above server components are used to provide timely feedback on the log collection process.
[0096] Step 504, when all logs of the server components are collected, the collected logs are compressed and packaged to generate a compressed file.
[0097] In practice, when all logs of the server components are collected, the process of step 104 is executed. Specifically, the process of compressing and packaging the logs of each component in step 104 is as described in the above embodiment, and this application will not repeat it again.
[0098] In this embodiment, the monitoring process in the BMC monitors the progress of the log collection program in acquiring the logs of each component of the server, so as to perform real-time detection of the log acquisition process, and at the same time compress and package the acquired logs to reduce the storage space occupied by the hot-swappable storage device mounted under the BMC.
[0099] In one implementation example, Figure 6 As shown, in order to facilitate the display of log acquisition progress, a button indicator light is pre-set on the server, and the button indicator light is used to output the log acquisition process to the user. Therefore, in the case where the hot-swappable storage device is connected to the hot-swappable interface corresponding to the BMC, the method also includes:
[0100] Step 602, executing the control thread, controlling the button indicator light to enter a flashing state until the hot-swappable storage device log download is completed.
[0101] In the implementation, the server first initializes the control thread of the button indicator light. When it detects that the hot-swappable device has been connected to the hot-swappable interface of the BMC, the server runs the control thread of the initialized button indicator light to control the button indicator light to enter the flashing state, and continuously monitors the download progress of the logs of each component based on the monitoring process in the BMC. During the log acquisition process, the control thread controls the button indicator light to keep the light flashing to remind the user that the log acquisition and download are currently in progress.
[0102] Step 604, exit the control thread, and control the button indicator light to switch the light to a flashing state.
[0103] In implementation, when it is monitored that the acquisition of logs of each component is completed, the server exits the control thread and the control button indicator light changes to a flashing state, that is, the control button indicator light returns to an original state.
[0104] Optionally, the original state of the button indicator light can be the indicator light off state, or the indicator light continuously on (non-flashing) state. The embodiment of the present application does not limit the indicator light mode for the prompt function.
[0105] In this embodiment, when there is no network setting and the BMC web cannot be logged in, a button indicator light is set on the server and an indicator light control process is added inside the server, thereby realizing the function of prompting the user of the log acquisition process.
[0106] In one embodiment, Figure 7 As shown, an example of a log acquisition method is provided, the method comprising:
[0107] Step 701, initialize the kernel system, load the BMC internal driver, and initialize the key light control thread.
[0108] Step 702, run the BMC internal driver program, and determine whether a hot-swappable storage device is connected according to a preset detection cycle. If the hot-swappable storage device is detected to be connected, execute step 703; if the hot-swappable storage device is not detected to be connected, continue to execute step 702.
[0109] Step 703, load and run the hot-plug driver, mount the storage partition in the hot-plug device to the preset directory of the BMC based on the hot-plug driver, and run the button light control thread to control the button indicator light to flash continuously.
[0110] Step 704 , reading the attribute information of the hot-plug storage device, determining the log acquisition instruction of the type corresponding to the hot-plug storage device according to the attribute information, and executing the log collection program based on the log acquisition instruction.
[0111] Step 705, triggering the execution of the log collection program to collect logs of various components of the server. At the same time, the monitoring process in the BMC monitors the log collection progress of the log collection program. When all logs are collected, the collected logs are compressed and packaged to generate a compressed file.
[0112] Step 705, download the compressed file to a folder in a pre-mounted BMC preset directory, exit the button light control thread, and restore the button indicator light to its original state.
[0113] In this embodiment, when the network is disconnected or the network status is unstable, when the server crashes, the server logs are automatically collected based on the hot-swappable storage device and the driver pre-deployed in the BMC, and a compressed log file containing various components of the server is obtained, eliminating the dependence on the network environment during the log collection process, and providing users with a log acquisition process through pre-developed button indicator lights.
[0114] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0115] Based on the same inventive concept, the embodiment of the present application also provides a log acquisition device for implementing the log acquisition method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more log acquisition device embodiments provided below can refer to the limitations on the log acquisition method above, and will not be repeated here.
[0116] In one embodiment, Figure 8 As shown, a log acquisition device 800 is provided, including: a trigger collection module 810, a generation module 820 and a download module 830, wherein:
[0117] The trigger collection module 810 is used to load and run a hot-plug driver program when a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, and trigger the execution of a log collection program in the BMC to collect logs based on the hot-plug driver program;
[0118] The generating module 820 is used to compress and package the collected logs to generate a compressed file;
[0119] The download module 830 is used to download the compressed file to a folder in a preset directory, where the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0120] In one embodiment, the hot-swap interface is provided on the server mainboard, and the hot-swap storage device is directly connected to the onboard chip of the BMC through the hot-swap interface.
[0121] In one embodiment, the apparatus 800 further includes:
[0122] Initialization module, used to initialize the kernel system and load the BMC internal driver;
[0123] A determination module, used for running the BMC internal driver and determining whether the hot-swappable storage device is connected according to a preset detection cycle;
[0124] A reading module, used for reading attribute information of the hot-pluggable storage device if the hot-pluggable storage device is connected;
[0125] The determination module is used to determine the log acquisition instruction of the corresponding type of the hot-pluggable storage device according to the attribute information of the hot-pluggable storage device, so as to execute the log collection program according to the log acquisition instruction.
[0126] In one embodiment, the apparatus 800 further includes:
[0127] A mounting module, used for mounting the storage partition in the hot-plug storage device to a preset directory of the BMC based on the hot-plug driver;
[0128] A naming module, used for obtaining the insertion time information of the hot-swappable storage device, and generating a file name containing the insertion time information according to the insertion time information and a preset file naming format;
[0129] The creation module is used to create a log folder named with the file name under the preset directory of the BMC.
[0130] In one embodiment, the apparatus 800 further includes:
[0131] A monitoring module, used for monitoring the log collection progress of each component of the server by the log collection program based on the monitoring process of the BMC;
[0132] The generation module 820 is used to execute the step of compressing and packaging the collected logs to generate a compressed file when all the logs of the server components are collected.
[0133] In one embodiment, a button indicator light is pre-set on the server, and when the hot-swappable storage device is connected to the hot-swappable interface of the BMC baseboard management controller, the device 800 further includes:
[0134] A control module, used for executing a control thread, controlling the button indicator light to enter a flashing state until the hot-swappable storage device log download is completed;
[0135] The switching module is used to exit the control thread and control the button indicator light to switch the light flashing state.
[0136] By using the above-mentioned log acquisition device 800, when the network is disconnected or the network status is unstable, when the server crashes, the server logs can be automatically collected based on the hot-swappable storage device and the driver pre-deployed in the BMC, and a log compression file containing various components of the server is obtained, eliminating the dependence on the network environment during the log collection process.
[0137] Each module in the above-mentioned log acquisition device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0138] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile 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 the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a log acquisition method is implemented.
[0139] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0140] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0141] When a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection;
[0142] Compressing and packaging the collected logs to generate compressed files;
[0143] The compressed file is downloaded to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0144] In one embodiment, the hot-swap interface is provided on a server mainboard, and the hot-swap storage device is directly connected to an onboard chip of the BMC via the hot-swap interface.
[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0146] Initialize the kernel system and load the BMC internal driver;
[0147] Running the BMC internal driver to determine whether the hot-swappable storage device is connected according to a preset detection cycle;
[0148] If the hot-pluggable storage device is connected, read the attribute information of the hot-pluggable storage device;
[0149] According to the attribute information of the hot-plug storage device, a log acquisition instruction of a type corresponding to the hot-plug storage device is determined, so that the log collection program is executed according to the log acquisition instruction.
[0150] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0151] Based on the hot-plug driver, mounting the storage partition in the hot-plug storage device to a preset directory of the BMC;
[0152] Obtaining the insertion time information of the hot-swappable storage device, and generating a file name containing the insertion time information according to the insertion time information and a preset file naming format;
[0153] A log folder named with the file name is created in the preset directory of the BMC.
[0154] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0155] Monitoring the log collection progress of each component of the server by the log collection program based on the monitoring process of the BMC;
[0156] When all logs of the server components are collected, the step of compressing and packaging the collected logs to generate a compressed file is performed.
[0157] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0158] Execute the control thread to control the button indicator light to enter a flashing state until the hot-swappable storage device log download is completed;
[0159] Exit the control thread and control the button indicator light to switch the light flashing state.
[0160] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0161] When a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection;
[0162] Compressing and packaging the collected logs to generate compressed files;
[0163] The compressed file is downloaded to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating the folder.
[0164] In one embodiment, the hot-swap interface is provided on a server mainboard, and the hot-swap storage device is directly connected to an onboard chip of the BMC via the hot-swap interface.
[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0166] Initialize the kernel system and load the BMC internal driver;
[0167] Running the BMC internal driver to determine whether the hot-swappable storage device is connected according to a preset detection cycle;
[0168] If the hot-pluggable storage device is connected, read the attribute information of the hot-pluggable storage device;
[0169] According to the attribute information of the hot-plug storage device, a log acquisition instruction of a type corresponding to the hot-plug storage device is determined, so that the log collection program is executed according to the log acquisition instruction.
[0170] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0171] Based on the hot-plug driver, mounting the storage partition in the hot-plug storage device to a preset directory of the BMC;
[0172] Obtaining the insertion time information of the hot-swappable storage device, and generating a file name containing the insertion time information according to the insertion time information and a preset file naming format;
[0173] A log folder named with the file name is created in the preset directory of the BMC.
[0174] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0175] Monitoring the log collection progress of each component of the server by the log collection program based on the monitoring process of the BMC;
[0176] When all logs of the server components are collected, the step of compressing and packaging the collected logs to generate a compressed file is performed.
[0177] In one embodiment, a button indicator light is pre-set on the server, and when the hot-swappable storage device is connected to the hot-swappable interface of the BMC baseboard management controller, the computer program further implements the following steps when executed by the processor:
[0178] Execute the control thread to control the button indicator light to enter a flashing state until the hot-swappable storage device log download is completed;
[0179] Exit the control thread and control the button indicator light to switch the light flashing state.
[0180] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0181] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0182] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0183] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0184] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A log acquisition method, characterized in that: The method comprises: When a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, a hot-plug driver is loaded and run, and based on the hot-plug driver, a log collection program in the BMC is triggered to perform log collection; Compressing and packaging the collected logs to generate compressed files; Downloading the compressed file to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating a folder; In the case where the hot-plug storage device is connected to the hot-plug interface of the BMC baseboard management controller, before loading and running the hot-plug driver, the method further includes: Initialize the kernel system and load the BMC internal driver; Running the BMC internal driver to determine whether the hot-swappable storage device is connected according to a preset detection cycle; If the hot-pluggable storage device is connected, read the attribute information of the hot-pluggable storage device; According to the attribute information of the hot-plug storage device, a log acquisition instruction of a type corresponding to the hot-plug storage device is determined, so that the log collection program is executed according to the log acquisition instruction.
2. The method according to claim 1, characterized in that The hot-plug interface is arranged on the server mainboard, and the hot-plug storage device is directly connected to the onboard chip of the BMC via the hot-plug interface.
3. The method according to claim 1, characterized in that Before triggering the execution of the log collection program in the BMC to collect logs, the method further includes: Based on the hot-plug driver, mounting the storage partition in the hot-plug storage device to a preset directory of the BMC; Obtaining the insertion time information of the hot-swappable storage device, and generating a file name containing the insertion time information according to the insertion time information and a preset file naming format; A log folder named with the file name is created in the preset directory of the BMC.
4. The method according to claim 1, characterized in that Before compressing and packaging the collected logs to generate a compressed file, the method further includes: Monitoring the log collection progress of each component of the server by the log collection program based on the monitoring process of the BMC; When all logs of the server components are collected, the step of compressing and packaging the collected logs to generate a compressed file is performed.
5. The method according to claim 1, characterized in that A button indicator light is pre-set on the server, and when the hot-swappable storage device is connected to the hot-swappable interface of the BMC baseboard management controller, the method further includes: Execute the control thread to control the button indicator light to enter a flashing state until the hot-swappable storage device log download is completed; Exit the control thread and control the button indicator light to switch the light flashing state.
6. A log acquisition device, characterized in that: The device comprises: A trigger collection module is used to load and run a hot-plug driver program when a hot-plug storage device is connected to a hot-plug interface of a BMC baseboard management controller, and trigger the execution of a log collection program in the BMC to collect logs based on the hot-plug driver program; A generation module is used to compress and package the collected logs to generate a compressed file; A download module, used for downloading the compressed file to a folder in a preset directory, wherein the folder in the preset directory is obtained by mounting the hot-swappable storage device partition to a preset directory of the BMC and creating a folder; The device also includes: Initialization module, used to initialize the kernel system and load the BMC internal driver; A determination module, used for running the BMC internal driver and determining whether the hot-swappable storage device is connected according to a preset detection cycle; A reading module, used for reading attribute information of the hot-pluggable storage device if the hot-pluggable storage device is connected; The determination module is used to determine the log acquisition instruction of the corresponding type of the hot-pluggable storage device according to the attribute information of the hot-pluggable storage device, so as to execute the log collection program according to the log acquisition instruction.
7. The device according to claim 6, characterized in that The device also includes: A mounting module, used for mounting the storage partition in the hot-plug storage device to a preset directory of the BMC based on the hot-plug driver; A naming module, used for obtaining the insertion time information of the hot-swappable storage device, and generating a file name containing the insertion time information according to the insertion time information and a preset file naming format; The creation module is used to create a log folder named with the file name under the preset directory of the BMC.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Log recording and reading method and device based on flight controller
CN104732611A
Monitoring method and device of server operation state
CN105224436A
BMC log collection method, device and equipment and readable storage medium
CN113672580A
Transmission of log information for device maintenance to a mobile computing device
US20170091062A1
