Log collection method, device, computer equipment and storage medium

By setting the first serial port and the second serial port in the baseboard management controller of the server, log information is automatically detected and output, which solves the problem of low efficiency of traditional fault diagnosis, achieves efficient log collection and storage, and simplifies the fault location process.

CN115022163BActive Publication Date: 2024-09-13SHENZHEN YUXIAN MICROELECTRONICS CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210597125.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2024-09-13
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

The traditional server fault diagnosis method requires manual login to the operating system and locating abnormal firmware through the physical serial port, which is inefficient and inconvenient to collect logs.

Method used

Set up the first serial port and the second serial port in the baseboard management controller BMC. By detecting the output of the first serial port, if there is an abnormality, the second serial port is used to output log information to achieve automatic positioning and log collection, and prioritize storage in the storage space. High-level log information.

Benefits of technology

It improves the efficiency of locating abnormal server firmware and log collection efficiency, ensures the normal output of abnormal firmware logs, and simplifies the fault diagnosis process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115022163B
    Figure CN115022163B
Patent Text Reader

Abstract

The present application relates to a log collection method, device, computer equipment, storage medium and computer program product. The method comprises: obtaining the first log information corresponding to the first serial port; detecting the output of the first serial port according to the first log information; when the output of the first serial port is detected to be abnormal, using the second serial port to output the first log information corresponding to the first serial port. The present application sets a first serial port and a second serial port, detects the output of the first serial port according to the first log information corresponding to the first serial port, and when the output of the first serial port is abnormal, uses the second serial port to output the first log information corresponding to the first serial port. The abnormal firmware of the server can be located through the abnormal situation of the first serial port, and the normal output of the log corresponding to the corresponding abnormal firmware can be guaranteed, thereby improving the efficiency of log collection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of server technology, and in particular to a log collection method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] As the manageability of servers is gaining more and more attention, major server manufacturers have enhanced the manageability of servers on their respective hardware platforms and continuously strengthened their functions. IPMI (Intelligent Platform Management Interface) is a standard for intelligent management of machine equipment and an effective means to solve the problem of reliable management of servers. Its core is a dedicated chip / controller called BMC (Baseboard Management Controller). BMC is connected to an external serial port, through which the system's print information can be output and system data can be obtained to facilitate configuration and debugging of the server. Users can use IPMI to monitor the physical characteristics of the server, such as temperature, voltage, fan working status, power supply, etc.

[0003] Various faults often occur during server deployment and operation. The traditional fault diagnosis method requires logging into the OS (operating system), modifying the GRUB (GRand Unified Bootloader) file, and redirecting the OS serial port to the BIOS (Basic Input Output System) serial port. This method requires the use of a physical serial port, connecting an additional serial port cable, and locating the abnormal firmware before obtaining the corresponding logs. Summary of the invention

[0004] Based on this, it is necessary to provide a log collection method, device, computer equipment, computer-readable storage medium and computer program product that can automatically locate system anomalies and collect corresponding logs in response to the above technical problems.

[0005] In a first aspect, the present application provides a log collection method, which is applied to a baseboard management controller BMC, wherein the BMC includes a first serial port and a second serial port, and the method includes:

[0006] Obtain first log information corresponding to the first serial port;

[0007] According to the first log information, detecting the output status of the first serial port;

[0008] When it is detected that the output of the first serial port is abnormal, the second serial port is used to output first log information corresponding to the first serial port.

[0009] In one embodiment, when the first serial port output is detected to be abnormal, using the second serial port to output first log information corresponding to the first serial port includes:

[0010] When it is detected that multiple first serial ports output abnormalities at the same time, determine, according to the priority of the first serial ports, a first target serial port with the highest priority among the first serial ports where the abnormalities occur;

[0011] The second serial port is used to output the first target log information corresponding to the first target serial port.

[0012] In one embodiment, the method further comprises:

[0013] The serial port is redirected to the network port SOL to output second target log information corresponding to the second target serial port, where the second target serial port is the serial port with the second highest priority among the first serial ports where the exception occurs.

[0014] In one embodiment, the method further comprises:

[0015] Obtain the start flag of the SOL;

[0016] The serial port switching mode of the SOL is determined according to the startup flag, and the serial port switching mode includes a manual mode and an automatic mode.

[0017] In one embodiment, the method further comprises:

[0018] According to the priority of the first serial port, the first target log information output by the second serial port is stored in the log storage space of the BMC.

[0019] In one embodiment, the method further comprises:

[0020] Obtaining the severity of the abnormality output by the first serial port, and obtaining a corresponding storage space threshold according to the severity of the abnormality;

[0021] Check whether the storage space threshold is reached;

[0022] When the storage space threshold is reached, the first log information currently outputted will overwrite the log information first stored in the storage space corresponding to the severity of the abnormality.

[0023] In a second aspect, the present application further provides a log collection device, which is applied to a baseboard management controller BMC, wherein the BMC includes a first serial port and a second serial port, and the device includes:

[0024] A log acquisition module, used to acquire first log information corresponding to the first serial port;

[0025] an abnormality detection module, used to detect the output status of the first serial port according to the first log information;

[0026] The serial port switching module is used to use the second serial port to output the first log information corresponding to the first serial port when it is detected that the output of the first serial port is abnormal.

[0027] 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:

[0028] Obtain first log information corresponding to the first serial port;

[0029] According to the first log information, detecting the output status of the first serial port;

[0030] When it is detected that the output of the first serial port is abnormal, the second serial port is used to output first log information corresponding to the first serial port.

[0031] 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:

[0032] Obtain first log information corresponding to the first serial port;

[0033] According to the first log information, detecting the output status of the first serial port;

[0034] When it is detected that the output of the first serial port is abnormal, the second serial port is used to output first log information corresponding to the first serial port.

[0035] 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:

[0036] Obtain first log information corresponding to the first serial port;

[0037] According to the first log information, detecting the output status of the first serial port;

[0038] When it is detected that the output of the first serial port is abnormal, the second serial port is used to output first log information corresponding to the first serial port.

[0039] The above-mentioned log collection method, device, computer equipment, storage medium and computer program product obtain the first log information corresponding to the first serial port; detect the output of the first serial port according to the first log information; when it is detected that the output of the first serial port is abnormal, use the second serial port to output the first log information corresponding to the first serial port. This application sets a first serial port and a second serial port, detects the output of the first serial port according to the first log information corresponding to the first serial port, and when the output of the first serial port is abnormal, uses the second serial port to output the first log information corresponding to the first serial port. The abnormal firmware of the server can be located through the abnormal situation of the first serial port, and the normal output of the log corresponding to the corresponding abnormal firmware can be guaranteed, thereby improving the efficiency of log collection. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 An application environment diagram of a log collection method in an embodiment;

[0041] Figure 2 A flow chart of a log collection method in one embodiment;

[0042] Figure 3 is a flow chart of step 306 in one embodiment;

[0043] Figure 4 A flow chart of a log collection method in another embodiment;

[0044] Figure 5 A flow chart of a log collection method in another embodiment;

[0045] Figure 6 A flow chart of a log collection method in another embodiment;

[0046] Figure 7 A flow chart of a log collection method in another embodiment;

[0047] Figure 8 is a structural block diagram of a log collection device in an embodiment;

[0048] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0049] 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.

[0050] In the server, many system firmware modules need to be debugged during development or abnormal location. One debugging method is to connect an external debugging line to the mainboard, output the corresponding print information through the RS232 serial port, and locate and debug the abnormality according to the output print information, that is, the corresponding abnormal firmware needs to be located manually; another method is to redirect the serial port information of the system firmware to the network port for output through the BMC serial port in parallel during hardware circuit design. Taking the BMCAST2500 chip as an example, the RX and TX signals of the serial ports such as MCP (Management Control Processor), SCP (System Control Processor), ATF (arm-trusted-firmware), and UEFI (Unified Extensible Firmware Interface) can be connected to the TX and RX of UART1-UART4 (serial port 1 to serial port 4) of the BMC, respectively, where RX represents the signal receiving end, such as the input pin; TX represents the signal sending end, such as the output pin. Since the serial port redirection output can only be unique, it is necessary to manually enter the SOL command to control the output of the corresponding redirected serial port information. The server can be an arm server, an x86 server, etc.

[0051] In view of the above problems, the present application proposes a log output method. The log output method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Wherein, the baseboard management controller BMC is respectively connected to the server processor CPU (central processing unit), the basic input and output system BIOS and the management control processor MCP, and the baseboard management controller BMC includes a first serial port and a second serial port, and the first serial port can be multiple. Wherein, the first serial port is respectively connected to the server processor CPU, the basic input and output system BIOS and the management control processor MCP, and outputs the log of the corresponding system accordingly. The baseboard management controller BMC obtains the first log information corresponding to the first serial port, detects the output of the first serial port according to the first log information, and when it is detected that the output of the first serial port is abnormal, the second serial port is used to output the first log information corresponding to the first serial port. It should be noted here that it is not limited to the server processor CPU, the basic input and output system BIOS and the management control processor MCP being connected to the baseboard management controller BMC, and other controllers or systems can also be connected to the baseboard management controller BMC, and further, connected to the first serial port of the baseboard management controller BMC.

[0052] In an exemplary embodiment, Figure 2As shown, a log output method is provided, which is applied to Figure 1 Taking the BMC in FIG. 1 as an example, the BMC includes a first serial port and a second serial port, and includes the following steps 202 to 206.

[0053] Step 202: Obtain first log information corresponding to the first serial port.

[0054] Among them, there can be multiple first serial ports. The first serial port is connected to other components to achieve communication, but other components and BMC operate independently and do not affect each other. Other components can record or analyze the corresponding logs generated through the first serial port output. Among them, other components can be a server processor CPU, a basic input and output system BIOS, a management control processor MCP, a system control processor SCP, ATF, etc. Correspondingly, the first log information refers to the log information generated by other components corresponding to the first serial port during operation. One first serial port corresponds to one first log information.

[0055] Step 204: Detect the output status of the first serial port according to the first log information.

[0056] The first log information includes operating parameters, sensor data and other performance data involved in the operation of the corresponding component. By detecting and analyzing the first log information, the output of the corresponding first serial port can be detected. For example, by analyzing the sensor data recorded in the first log information corresponding to the first serial port, it can be determined whether the first serial port is operating normally, thereby detecting the output of the first serial port.

[0057] Step 206: When it is detected that an abnormality occurs in the output of the first serial port, the second serial port is used to output first log information corresponding to the first serial port.

[0058] When the BMC detects that an abnormality has occurred in the output of the first serial port, the second serial port is used to output the first log information corresponding to the first serial port. Optionally, when the BMC detects that an abnormality has occurred in the output of the first serial port, a connection switching command may be sent to the corresponding logic control component, so that other components connected to the first serial port are switched to be connected to the second serial port, and the second serial port is used to output the first log information corresponding to the original first serial port. Normally, there is one second serial port, so when an abnormality is detected in the output of multiple first serial ports at the same time, the first target serial port can be determined from the multiple first serial ports according to preset conditions, and the second serial port can be used to output the first target log information corresponding to the first target serial port.

[0059] In the above log collection method, the first log information corresponding to the first serial port is obtained; the output of the first serial port is detected according to the first log information; when the output of the first serial port is detected to be abnormal, the first log information corresponding to the first serial port is outputted using the second serial port. In the embodiment of the present application, the first serial port and the second serial port are set in the BMC, and the output of the first serial port is detected according to the first log information corresponding to the first serial port. When the output of the first serial port is abnormal, the second serial port is used to output the first log information corresponding to the first serial port. The abnormal firmware of the server can be located through the abnormal situation of the first serial port, and the normal output of the log corresponding to the corresponding abnormal firmware can be guaranteed, thereby improving the efficiency of log collection.

[0060] In one embodiment, Figure 3 As shown, when it is detected that the output of the first serial port is abnormal, step 206 of using the second serial port to output the first log information corresponding to the first serial port includes the following steps 302 to 304.

[0061] Step 302: when it is detected that multiple first serial ports output abnormalities at the same time, determine the first target serial port with the highest priority among the first serial ports where the abnormalities occur according to the priorities of the first serial ports.

[0062] When the BMC detects that multiple first serial ports have output abnormalities at the same time, the first target serial port with the highest priority among the first serial ports with the abnormality can be determined according to the priority of the first serial ports. The priority of the first serial port can be set according to the importance or urgency of the first log information corresponding to the first serial port, and the corresponding relationship between the priority of the first serial port and the first serial port can be stored in advance to facilitate timely acquisition during BMC processing.

[0063] Step 304: Use the second serial port to output first target log information corresponding to the first target serial port.

[0064] After determining the first target serial port where the abnormality occurs, the second serial port is used to output the first target log information corresponding to the first target serial port. Optionally, the BMC may send a connection switching command to a corresponding logic control component, such as a PLC (Programmable Logic Controller) or a CPLD (Complex Programmable Logic Device) component, so that the logic control component automatically switches the object connected to the first target serial port to the second serial port, so that the second serial port can output the first target log information corresponding to the first target serial port.

[0065] In this embodiment, when it is detected that multiple first serial ports have output anomalies at the same time, the first target serial port with the highest priority among the first serial ports having the anomaly is determined according to the priority of the first serial ports, and the first target log information corresponding to the first target serial port is outputted through the second serial port. This can achieve that when an anomaly occurs in the first serial port, the first target log information of the first target serial port with the highest priority can be outputted through the second serial port in a timely manner, and the first target log information can be collected so as to timely analyze the corresponding abnormal problem, thereby improving the quality of log collection. In some embodiments, such as Figure 4 As shown, the log collection method also includes the following steps 402 to 406.

[0066] Step 402: when it is detected that multiple first serial ports output abnormalities at the same time, determine the first target serial port with the highest priority among the first serial ports where the abnormalities occur according to the priorities of the first serial ports.

[0067] Step 404: Use the second serial port to output first target log information corresponding to the first target serial port.

[0068] Step 406: Use the serial port to redirect to the network port SOL to output second target log information corresponding to the second target serial port, wherein the second target serial port is the serial port with the second highest priority among the first serial ports where the exception occurs.

[0069] In this embodiment, steps 402 to 404 can refer to the description of steps 302 to 304, which will not be repeated here. Serial port redirection to network port SOL (Serial Over Lan), SOL provides a mechanism that enables the serial port controller of the remote management system to be redirected to the local through an IPMI session based on the IP network. Generally, the serial port is an indispensable tool for repairing system failures and BIOS anomalies. When a machine fails, the system administrator can use the serial port to perform relevant configurations of the BIOS, operating system, and network to repair the system. In the past, administrators had to return to the noisy computer room, reconnect to the serial port, and then perform repair work. SOL provides administrators with access to the remote system serial port based on IP. As long as the network in the computer room does not fail, the administrator can access the serial port of the failed machine through any host that supports SOL. That is, the serial port redirection to the network port SOL is through the network

[0070] In an optional embodiment, a communication connection is established between the BMC and a remote PC (Personal Computer) through the SOL protocol of the IPMI standard. A SOL service is established inside the BMC, and the SOL service can realize data stream transmission in two directions, that is, the SOL service can transfer the first serial port data to the remote PC, and the remote PC transfers the data to the first serial port through the SOL service. The SOL service reads the data of the first serial port, the remote PC opens the SOL client, the SOL client initiates a data request to the SOL service, and after receiving the data request, the SOL transfers the data to the SOL client of the remote PC, and the SOL client can display the received data. The user writes data in the SOL client of the remote PC, and the SOL client transfers the data to the SOL service through the network. After receiving the data, the SOL service transfers the data to the first serial port, and the first serial port can receive the data input by the remote PC.

[0071] In the present embodiment, when it is detected that there are multiple first serial port outputs with abnormalities at the same time, the first target serial port with the highest priority among the first serial ports where the abnormality occurs is determined according to the priority of the first serial port, and the second serial port is used to output the first target log information corresponding to the first target serial port; at the same time, the serial port is redirected to the network port SOL to output the second target log information corresponding to the second target serial port, wherein the second target serial port is the serial port with the second highest priority among the first serial ports where the abnormality occurs, and the log information of the two first serial ports can be printed at the same time, so that the first log information corresponding to the first serial port where the abnormality occurs can be fully collected, thereby obtaining more log information for analyzing the abnormality.

[0072] In some possible embodiments, the log collection method further includes:

[0073] Get the SOL startup flag;

[0074] The serial port switching mode of the SOL is determined according to the startup flag bit, wherein the serial port switching mode includes a manual mode and an automatic mode.

[0075] In this embodiment, the startup flag of SOL is used to determine the startup mode of SOL. The startup flag of SOL can be presented in the form of hardware or function. BMC can obtain it from the SOL service or from a remote PC through the network. The serial port switching mode of SOL is determined according to the startup flag of SOL, wherein the serial port switching mode includes manual mode and automatic mode. In manual mode, when the serial port redirection to the network port is triggered, the SOL command is manually input to control the output of the serial port information. In automatic mode, it is automatically switched when the serial port redirection to the network port is triggered.

[0076] In an optional embodiment, the serial port switching mode of the SOL can be determined by judging the flag bit of the GPIO (General Purpose Input Output) connected to the BMC. When the flag bit of the GPIO is 1, it means that the serial port switching mode of the SOL is automatic mode; when the flag bit of the GPIO is 0, it means that the serial port switching mode of the SOL is manual mode.

[0077] In an optional embodiment, the serial port switching mode of SOL can be determined by the value of the flag function. When the value of the flag function is 1, it represents that the serial port switching mode of SOL is automatic mode; when the value of the flag function is 0, it represents that the serial port switching mode of SOL is manual mode.

[0078] In one embodiment, the log collection method further includes:

[0079] According to the priority of the first serial port, the first target log information output by the second serial port is stored in the log storage space of the BMC.

[0080] In this embodiment, according to the priority of the first serial port, the first target log information output by the second serial port is stored in the log storage space of the BMC, so that the log information stored in the log storage space is analyzed to find abnormalities and debugging, wherein the log data stored in the log storage space will not disappear even if the power is off, which is convenient for subsequent analysis. It should be noted that the log storage space is not limited to the storage space configured by the BMC itself, but can also be a storage space added according to the actual application scenario, such as an external SD card, etc. The second serial port outputs the same first log information at the same time. When the first serial port output corresponding to the first log information returns to normal, the first log information corresponding to the output of the first serial port is restored. Therefore, there may be multiple first log information corresponding to the first serial port output by the second serial port in the storage space. When the storage space threshold of the storage space is reached, the first target log information output by the second serial port is stored in the log storage space of the BMC according to the priority of the first serial port, that is, the first target log information corresponding to the first serial port with the highest priority is stored first.

[0081] In one embodiment, Figure 5 As shown, the log collection method also includes the following steps 502 to 506.

[0082] Step 502, obtaining the severity of the abnormality output by the first serial port, and obtaining a corresponding storage space threshold according to the severity of the abnormality.

[0083] In the log storage space of the BMC, the log storage space is divided into different log storage subspaces according to the level of abnormal severity. For example, if the abnormal severity is 3 levels, the log storage space is evenly divided or proportionally divided into three log storage subspaces, that is, the sizes of the three log storage subspaces can be the same or different. The abnormal severity output by the first serial port is obtained, and the corresponding storage space threshold is obtained according to the abnormal severity, wherein the storage space threshold is not greater than the size of the log storage subspace corresponding to the abnormal severity.

[0084] Step 504, detecting whether the storage space threshold is reached.

[0085] By judging the relationship between the size of the log storage subspace corresponding to the severity of the abnormality and the corresponding storage space threshold, it is detected whether the size of the log storage subspace corresponding to the severity of the abnormality has reached the storage space threshold.

[0086] Step 506: When the storage space threshold is reached, the first log information currently outputted will overwrite the log information first stored in the storage space corresponding to the severity of the abnormality.

[0087] When the size of the log storage subspace corresponding to the severity of the abnormality reaches the storage space threshold, the first log information currently outputted will overwrite the log information first stored in the log storage subspace.

[0088] In this embodiment, by obtaining the severity of the abnormality output by the first serial port, the corresponding storage space threshold is obtained according to the severity of the abnormality, and it is detected whether the actual storage situation of the corresponding storage space has reached the storage space threshold. When the storage space threshold is reached, the first log information currently output will overwrite the log information first stored in the corresponding storage space, so as to maximize the utilization of the log storage space and store the collected logs for as long as possible.

[0089] In one embodiment, Figure 6 As shown, the log collection method includes the following steps 602 to 612.

[0090] Step 602: Obtain first log information corresponding to the first serial port.

[0091] Step 604: Detect the output status of the first serial port according to the first log information.

[0092] Step 606: When it is detected that multiple first serial ports output abnormalities at the same time, determine the first target serial port with the highest priority among the first serial ports where the abnormalities occur according to the priorities of the first serial ports.

[0093] Step 608: Use the second serial port to output the first target log information corresponding to the first target serial port.

[0094] Step 610: Use the serial port to redirect to the network port SOL to output second target log information corresponding to the second target serial port, wherein the second target serial port is the serial port with the second highest priority among the first serial ports where the exception occurs.

[0095] Step 612: store the first target log information output by the second serial port in the log storage space of the BMC according to the priority of the first serial port.

[0096] In one embodiment, taking AST2500 as an example, the BMC is equipped with 5 physical serial ports, namely UART1, UART2, UART3, UART4, and UART5, wherein UART1 is externally connected to BIOS / OS, UART2 is externally connected to MCP, UART3 is externally connected to SCP, UART4 is externally connected to ATF, and UART5 is the BMC serial port, that is, UART1 to UART4 are the first serial ports, and UART5 is the second serial port. It should be noted that, except for the second serial port, the connection correspondence between the first serial port and other components is not specifically limited here. When the BMC detects that the system is in standby mode and normal operation mode, UART5 is maintained as the BMC serial port output; when the system is operating normally, when the network is normally connected, SOL is started according to the default UART1 output; when the system is not powered on, UART1 to UART4 have no output.

[0097] When the BMC detects that the output of the first serial port is abnormal according to the first log information corresponding to the first serial port, the second serial port is used to output the first log information corresponding to the first serial port. For example, if the BIOS startup fails, it means that the output of UART1 is abnormal, and the BMC automatically uses UART5 to output the print information corresponding to UART1. For another example, if the MCP cannot obtain the CPU temperature or voltage, it means that the output of UART2 is abnormal, and the BMC automatically uses UART5 to output the print information corresponding to UART2. For the situation where the BIOS startup fails and the MCP cannot obtain the CPU temperature or voltage at the same time, it means that the outputs of UART1 and UART2 are both faulty. According to the priority of UART1 and UART2, UART5 is used to output the serial port print information with the highest priority. If UART1 has the highest priority, UART5 is used to output the print information corresponding to UART1. Since UART2 has the second highest priority, the serial port is redirected to the network port to output the print information corresponding to UART2. The log information output by UART5 is saved in the log storage space of the BMC.

[0098] In one embodiment, the flow chart of the log collection method is as follows: Figure 7As shown, when there are multiple system firmware serial ports with abnormalities, according to the priority of the system firmware serial ports with abnormalities, the BMC serial port is used to output the serial port with the highest priority of the system firmware serial port with abnormalities; the serial port is redirected to the network port SOL to output the serial port with the second highest priority of the system firmware serial port with abnormalities; for other system firmware serial ports with abnormalities, such as the serial port with the third highest priority of the system firmware serial port, a local debugging line, such as an RS232 bus, can be manually connected at the abnormal location for debugging, and then the corresponding log information is obtained and output through USB (Universal Serial Bus). Among them, the BMC serial port output is through the local debugging line, such as the RS232 bus, and then the corresponding log information is obtained and output through USB; the serial port redirection to the network port SOL output is output from the network port through the network, and finally the log information corresponding to the serial port is sent to the remote PC.

[0099] 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.

[0100] Based on the same inventive concept, the embodiment of the present application also provides a log collection device for implementing the log collection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more log collection device embodiments provided below can refer to the limitations on the log collection method above, and will not be repeated here.

[0101] In one embodiment, Figure 8 As shown, a log collection device is provided, which is applied to a baseboard management controller BMC, wherein the BMC includes a first serial port and a second serial port, including: a log acquisition module 802, an abnormality detection module 804 and a serial port switching module 806, wherein:

[0102] The log acquisition module 802 is used to acquire first log information corresponding to the first serial port;

[0103] An abnormality detection module 804 is used to detect the output status of the first serial port according to the first log information;

[0104] The serial port switching module 806 is configured to use the second serial port to output first log information corresponding to the first serial port when an abnormality is detected in the output of the first serial port.

[0105] In one embodiment, the serial port switching module 806 is further used to:

[0106] When it is detected that multiple first serial ports output abnormalities at the same time, determine, according to the priority of the first serial ports, a first target serial port with the highest priority among the first serial ports where the abnormalities occur;

[0107] The second serial port is used to output the first target log information corresponding to the first target serial port.

[0108] In one embodiment, the device further comprises a serial port redirection module, configured to:

[0109] The serial port is redirected to the network port SOL to output second target log information corresponding to the second target serial port, where the second target serial port is the serial port with the second highest priority among the first serial ports where the exception occurs.

[0110] In one embodiment, the device further comprises a SOL flag module, configured to:

[0111] Obtain the start flag of the SOL;

[0112] The serial port switching mode of the SOL is determined according to the startup flag, and the serial port switching mode includes a manual mode and an automatic mode.

[0113] In one embodiment, the device further includes a log storage module, which is used to:

[0114] According to the priority of the first serial port, the first target log information output by the second serial port is stored in the log storage space of the BMC.

[0115] In one embodiment, the device further comprises an abnormality level module, configured to:

[0116] Obtaining the severity of the abnormality output by the first serial port, and obtaining a corresponding storage space threshold according to the severity of the abnormality;

[0117] Check whether the storage space threshold is reached;

[0118] When the storage space threshold is reached, the first log information currently outputted will overwrite the log information first stored in the storage space corresponding to the severity of the abnormality.

[0119] Each module in the above-mentioned log collection 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.

[0120] 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 log data obtained by the second serial port. 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 collection method is implemented.

[0121] 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.

[0122] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps of the log collection method in the above embodiments when executing the computer program.

[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the log collection method in the above embodiments are implemented.

[0124] In one embodiment, a computer program product is provided, including a computer program, which implements the steps of the log collection method in the above embodiments when executed by a processor.

[0125] 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.

[0126] 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.

[0127] 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.

[0128] 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 collection method, characterized in that: Applied to a baseboard management controller BMC, the BMC includes a first serial port and a second serial port, the first serial port includes a plurality of serial ports; the method includes: Obtaining first log information corresponding to the first serial port; the first log information refers to log information generated by a component connected to the first serial port during operation; According to the first log information, detecting the output status of the first serial port; When it is detected that the outputs of the plurality of first serial ports are abnormal at the same time, a first target serial port is determined from the plurality of first serial ports according to a preset condition, and the second serial port is used to output first log information corresponding to the first target serial port.

2. The method according to claim 1, characterized in that The determining a first target serial port from the plurality of first serial ports according to a preset condition, and using the second serial port to output first log information corresponding to the first target serial port, includes: Determine, according to the priority of the first serial port, a first target serial port with the highest priority among the first serial ports where the abnormality occurs; The second serial port is used to output the first target log information corresponding to the first target serial port.

3. The method according to claim 2, characterized in that The method further comprises: The serial port is redirected to the network port SOL to output second target log information corresponding to the second target serial port, where the second target serial port is the serial port with the second highest priority among the first serial ports where the exception occurs.

4. The method according to claim 3, characterized in that The method further comprises: Obtain the start flag of the SOL; The serial port switching mode of the SOL is determined according to the startup flag, and the serial port switching mode includes a manual mode and an automatic mode.

5. The method according to claim 3, characterized in that: The method further comprises: According to the priority of the first serial port, the first target log information output by the second serial port is stored in the log storage space of the BMC.

6. The method according to claim 5, characterized in that The method further comprises: Obtaining the severity of the abnormality output by the first serial port, and obtaining a corresponding storage space threshold according to the severity of the abnormality; Check whether the storage space threshold is reached; When the storage space threshold is reached, the first log information currently outputted will overwrite the log information first stored in the storage space corresponding to the severity of the abnormality.

7. A log collection device, characterized in that: Applied to a baseboard management controller BMC, the BMC includes a first serial port and a second serial port, the first serial port includes a plurality of serial ports; the device includes: A log acquisition module, used to acquire first log information corresponding to the first serial port; the first log information refers to log information generated by a component connected to the first serial port during operation; an abnormality detection module, used to detect the output status of the first serial port according to the first log information; The serial port switching module is used to determine a first target serial port from the multiple first serial ports according to a preset condition when abnormal output of multiple first serial ports is detected at the same time, and use the second serial port to output the first log information corresponding to the first target serial port.

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 6 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 6 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 6 are implemented.

Citation Information

Patent Citations

  • Method for simultaneous communication of double serial ports

    CN103024088A

  • Control method and device and electronic equipment

    CN109947690A

  • BMC debugging method, device and system and embedded equipment

    CN113722211A

  • High density serial over LAN managment system

    US20160080210A1