CN115022163A - Log collection method and device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN115022163A
CN115022163A CN202210597125.1A CN202210597125A CN115022163A CN 115022163 A CN115022163 A CN 115022163A CN 202210597125 A CN202210597125 A CN 202210597125A CN 115022163 A CN115022163 A CN 115022163A
Authority
CN
China
Prior art keywords
serial port
output
log information
abnormal
log
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210597125.1A
Other languages
Chinese (zh)
Inventor
陈吉宝
罗勇
彭亮
谭凌云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yuxian Microelectronics Co ltd
Original Assignee
Shenzhen Yuxian Microelectronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Yuxian Microelectronics Co ltd filed Critical Shenzhen Yuxian Microelectronics Co ltd
Priority to CN202210597125.1A priority Critical patent/CN115022163A/en
Publication of CN115022163A publication Critical patent/CN115022163A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/069Management of faults, events, alarms or notifications using logs of notifications; Post-processing of notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0677Localisation of faults
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a log collection method, a log collection device, a computer device, a storage medium and a computer program product. The method comprises the following steps: acquiring first log information corresponding to the first serial port; detecting the output condition of the first serial port according to the first log information; and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port. According to the application, the first serial port and the second serial port are arranged, the output condition of the first serial port is detected according to the first log information corresponding to the first serial port, when the first serial port is output abnormally, the first log information corresponding to the first serial port is output by the second serial port, abnormal firmware of the server is positioned through the abnormal condition of the first serial port, normal output of logs corresponding to corresponding abnormal firmware can be guaranteed, and log collection efficiency is improved.

Description

Log collection method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of server technologies, and in particular, to a log collection method and apparatus, a computer device, a storage medium, and a computer program product.
Background
With the importance of the manageability features of the servers becoming more and more important, the manageability features of the servers are enhanced on their respective hardware platforms and the functions of the servers are continuously strengthened by the manufacturers of the large servers. IPMI (Intelligent Platform Management Interface) is an effective means for solving the problem of reliable Management of a server, and its core is a dedicated chip/Controller called BMC (Baseboard Management Controller). The BMC is externally connected with a serial port, the output of printing information of the system can be realized through the serial port, and system data can be obtained through the serial port so as to configure and debug the server. The user may utilize the IPMI to monitor the physical characteristics of the server, such as temperature, voltage, fan operating status, power supply, etc.
Various faults often occur in the deployment and operation process of a server, and a conventional fault diagnosis mode needs to log in an OS (operating System) every time, modify a GRUB (boot loader) file, and redirect an OS serial port to a BIOS (Basic Input Output System) serial port. In the method, an additional serial port line is connected by virtue of a physical serial port, and the corresponding log can be obtained only by positioning the abnormal firmware.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a log collection method, apparatus, computer device, computer readable storage medium and computer program product capable of automatically locating system anomalies and collecting corresponding logs.
In a first aspect, the present application provides a log collection method, which is applied to a baseboard management controller BMC, where the BMC includes a first serial port and a second serial port, and the method includes:
acquiring first log information corresponding to the first serial port;
detecting the output condition of the first serial port according to the first log information;
and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port.
In one embodiment, when it is detected that the output of the first serial port is abnormal, outputting, by using the second serial port, first log information corresponding to the first serial port, includes:
when a plurality of first serial ports are detected to output abnormal simultaneously, determining a first target serial port with the highest priority in the abnormal first serial ports according to the priorities of the first serial ports;
and outputting first target log information corresponding to the first target serial port by adopting the second serial port.
In one embodiment, the method further comprises:
and redirecting the serial port to the network port SOL by using the serial port to output second target log information corresponding to a second target serial port, wherein the second target serial port is the serial port with the highest priority level in the abnormal first serial ports.
In one embodiment, the method further comprises:
acquiring a start flag bit of the SOL;
and determining a serial port switching mode of the SOL according to the starting flag bit, wherein the serial port switching mode comprises a manual mode and an automatic mode.
In one embodiment, the method further comprises:
and storing the first target log information output by the second serial port in a log storage space of the BMC according to the priority of the first serial port.
In one embodiment, the method further comprises:
acquiring the abnormal severity of the first serial port output, and acquiring a corresponding storage space threshold according to the abnormal severity;
detecting whether a storage space threshold is reached;
and when the storage space threshold is reached, the first log information which is currently output is covered with the log information which is stored firstly in the storage space corresponding to the abnormal severity.
In a second aspect, the present application further provides a log collection device applied to a BMC, where the BMC includes a first serial port and a second serial port, the device includes:
the log obtaining module is used for obtaining first log information corresponding to the first serial port;
the abnormality detection module is used for detecting the output condition of the first serial port according to the first log information;
and the serial port switching module is used for outputting first log information corresponding to the first serial port by adopting the second serial port when the first serial port output is detected to be abnormal.
In a third aspect, the application also provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor realizes the following steps when executing the computer program:
acquiring first log information corresponding to the first serial port;
detecting the output condition of the first serial port according to the first log information;
and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
acquiring first log information corresponding to the first serial port;
detecting the output condition of the first serial port according to the first log information;
and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
acquiring first log information corresponding to the first serial port;
detecting the output condition of the first serial port according to the first log information;
and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port.
According to the log collection method, the log collection device, the computer equipment, the storage medium and the computer program product, first log information corresponding to the first serial port is obtained; detecting the output condition of the first serial port according to the first log information; and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port. According to the application, the first serial port and the second serial port are arranged, the output condition of the first serial port is detected according to the first log information corresponding to the first serial port, when the first serial port is output abnormally, the first log information corresponding to the first serial port is output by the second serial port, abnormal firmware of the server is positioned through the abnormal condition of the first serial port, normal output of logs corresponding to corresponding abnormal firmware can be guaranteed, and log collection efficiency is improved.
Drawings
FIG. 1 is a diagram of an application environment of a log collection method in one embodiment;
FIG. 2 is a flow diagram that illustrates a method for log collection, according to one embodiment;
FIG. 3 is a flow chart illustrating step 306 in one embodiment;
FIG. 4 is a flowchart illustrating a log collection method according to another embodiment;
FIG. 5 is a flowchart illustrating a log collection method according to another embodiment;
FIG. 6 is a flowchart illustrating a log collection method according to another embodiment;
FIG. 7 is a flowchart illustrating a log collection method according to another embodiment;
FIG. 8 is a block diagram showing the structure of a log collecting apparatus according to an embodiment;
FIG. 9 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In a server, a plurality of system firmware modules need to be debugged during development or abnormal positioning, one debugging mode is that corresponding printing information is output to a mainboard through an external debugging line and an RS232 serial port, and abnormal positioning and debugging are carried out according to the output printing information, namely corresponding abnormal firmware can be positioned manually; in another mode, when a hardware circuit is designed, serial port information of System Firmware is redirected to a network port through a BMC serial port in parallel for output, and taking a BMC AST2500 chip as an example, RX and TX signals of serial ports such as MCP (Management Control Processor), SCP (System Control Processor), ATF (arm-managed-Firmware), UEFI (Extensible Firmware Interface) and the like can be respectively communicated with TX and RX of UART1-UART4 (serial port 1 to serial port 4) of the BMC, where RX represents a signal receiving end, such as an input pin; TX denotes a signal transmitting end, e.g., an output pin. Because the serial port redirection output can only be unique, the output of the corresponding redirection serial port information needs to be controlled by manually inputting an SOL command. The server may be an arm server, an x86 server, or the like.
In order to solve the above problems, the present application provides a log output method. The log output method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. The baseboard management controller BMC is connected to the server processor cpu (central processing unit), the BIOS, and the MCP, and includes a first serial port and a second serial port, where the first serial port may be multiple. The first serial port is respectively connected with the server processor CPU, the basic input and output system BIOS and the management control processor MCP, and correspondingly outputs the log of the corresponding system. The baseboard management controller BMC obtains first log information corresponding to the first serial port, detects output conditions of the first serial port according to the first log information, and outputs the first log information corresponding to the first serial port by adopting the second serial port when detecting that the output of the first serial port is abnormal. It should be noted here that the server processor CPU, the BIOS, and the management control processor MCP are not limited to being connected to the BMC, and other controllers or systems may be connected to the BMC, and further connected to the first serial port of the BMC.
In an exemplary embodiment, as shown in fig. 2, a log output method is provided, which is exemplified by applying the method to the BMC in fig. 1, where the BMC includes a first serial port and a second serial port, and includes the following steps 202 to 206.
Step 202, obtain a first log information corresponding to the first serial port.
Wherein, the first serial port can be a plurality of. The first serial port is connected with other components to achieve communication, but the other components and the BMC run independently and do not affect each other, and the other components can output correspondingly generated logs through the first serial port to record or analyze. Among other components may be a server processor CPU, a basic input output system BIOS, a management control processor MCP, a system control processor SCP, an ATF, etc. Correspondingly, the first log information refers to log information generated by other components corresponding to the first port during operation. A first string corresponds to a first log information.
And step 204, detecting the output condition of the first serial port according to the first log information.
The first log information includes operating parameters, sensor data and other performance data involved in the operation of the corresponding component. The first log information is detected and analyzed, so that the output condition of the corresponding first serial port can be detected, for example, whether the first serial port normally operates can be judged by analyzing the sensor data recorded in the first log information corresponding to the first serial port, and the output condition of the first serial port can be detected.
And step 206, outputting the first log information corresponding to the first serial port by using the second serial port when the first serial port output is detected to be abnormal.
And when the BMC detects that the output of the first serial port is abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port. Optionally, when the BMC detects that the output of the first serial port is abnormal, the BMC may send a connection switching command to the corresponding logic control component, so that the other components connected to the first serial port are switched to be connected to the second serial port, and output the first log information output by the first serial port by using the second serial port. Under a normal condition, one second serial port is adopted, so that when the output of the plurality of first serial ports is detected to be abnormal simultaneously, a first target serial port can be determined from the plurality of first serial ports according to preset conditions, and first target log information corresponding to the first target serial port is output by adopting the second serial port.
In the log collection method, first log information corresponding to a first serial port is obtained; detecting the output condition of the first serial port according to the first log information; and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port. According to the embodiment of the application, the first serial port and the second serial port are arranged in the BMC, the output condition of the first serial port is detected according to the first log information corresponding to the first serial port, when the first serial port is abnormal in output, the second serial port is adopted to output the first log information corresponding to the first serial port, abnormal conditions of the first serial port can be used for positioning abnormal firmware of the server, meanwhile, normal output of logs corresponding to corresponding abnormal firmware can be guaranteed, and therefore log collection efficiency is improved.
In one embodiment, as shown in fig. 3, when it is detected that the first serial port output is abnormal, the step 206 of outputting the first log information corresponding to the first serial port by using the second serial port includes the following steps 302 to 304.
Step 302, when detecting that a plurality of first serial ports output abnormal at the same time, determining a first target serial port with the highest priority in the abnormal first serial ports according to the priority of the first serial ports.
When the BMC detects that a plurality of first serial ports output at the same time are abnormal, a first target serial port with the highest priority in the abnormal first serial ports 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 degree or the emergency degree of the first log information corresponding to the first serial port, and the corresponding relation between the priority of the first serial port and the first serial port is stored in advance, so that the priority can be obtained in time when the BMC processes the first serial port conveniently.
And step 304, outputting the first target log information corresponding to the first target serial port by using the second serial port.
And after the abnormal first target serial port is determined, outputting first target log information corresponding to the first target serial port by adopting the second serial port. Optionally, the BMC may send a connection switching command to a corresponding Logic control component, for example, a PLC (Programmable Logic Controller) or a CPLD (Complex Programmable Logic device) component, so that the Logic control component automatically switches an object connected to the first target serial port to be connected to the second serial port, so that the second serial port may output first target log information corresponding to the first target serial port.
In this embodiment, when it is detected that a plurality of first serial ports output at the same time are abnormal, according to the priority of the first serial ports, the first target serial port with the highest priority in the abnormal first serial ports is determined, and the first target log information corresponding to the first target serial port is output by the second serial port, so that when the first serial ports are abnormal, the first target log information of the first target serial port with the highest priority can be output by the second serial port in time, and the first target log information is collected so as to analyze the corresponding abnormal problem in time, thereby improving the log collection quality. In some embodiments, as shown in fig. 4, the log collection method further includes the following steps 402 to 406.
Step 402, when it is detected that a plurality of first serial ports output at the same time are abnormal, determining a first target serial port with the highest priority in the abnormal first serial ports according to the priority of the first serial ports.
And step 404, outputting first target log information corresponding to the first target serial port by using the second serial port.
And 406, redirecting the serial port to the socket SOL by using the serial port to output second target log information corresponding to a second target serial port, wherein the second target serial port is the serial port with the highest priority level in the abnormal first serial ports.
In this embodiment, the descriptions of step 302 to step 304 may be referred to in step 402 to step 404, which are not repeated herein. The serial port is redirected to a network port SOL (Serial Over lan), and the SOL provides a mechanism to enable a serial port controller of a remote management system to be redirected to the local through an IPMI session based on an IP network. In general, serial ports are an indispensable tool for repairing system failures and BIOS anomalies. When the machine has a fault, system management personnel can carry out the related configuration of the BIOS, the operating system and the network through the serial port to repair the system. In the past situation, a manager has to return to a noisy machine room, re-access the serial port and then perform repair work. The SOL provides the administrator with the access to the serial port of the remote system based on the IP, and the administrator can access the serial port of the failed machine through any host supporting the SOL as long as the network in the machine room does not fail. That is, the redirection of the serial port to the socket SOL is through the network
In an alternative embodiment, the communication link between the BMC and a remote PC (Personal Computer) is established by the SOL protocol of the IPMI standard. An SOL service is established inside the BMC, and the SOL service can realize data stream transmission in two directions, namely, the SOL service can transmit first serial port data to the remote PC, and the remote PC transmits the data to the first serial port through the SOL service. The SOL service reads data of the first serial port, the remote PC opens the SOL client, the SOL client initiates a data request to the SOL service, the SOL receives the data request and transmits the data to the SOL client of the remote PC, and the SOL client can display the received data. A user writes data in an SOL client of a remote PC, the SOL client transmits the data to SOL service through a network, the SOL service transmits the data to a first serial port after receiving the data, and the first serial port can receive the data input by the remote PC.
In this embodiment, when it is detected that a plurality of first serial ports output at the same time are abnormal, according to the priority of the first serial ports, a first target serial port with the highest priority in the abnormal first serial ports is determined, and a second serial port is used to output first target log information corresponding to the first target serial port; and meanwhile, the serial port is used for redirecting to the network port SOL to output second target log information corresponding to a second target serial port, wherein the second target serial port is the serial port with the highest priority level in the abnormal first serial ports, so that the log information of the two first serial ports can be printed simultaneously, the first log information corresponding to the abnormal first serial ports can be fully collected, and more log information can be obtained for analyzing the abnormality.
In some possible embodiments, the log collection method further comprises:
acquiring a start flag bit of SOL;
and determining a serial port switching mode of the SOL according to the starting flag bit, wherein the serial port switching mode comprises a manual mode and an automatic mode.
In this embodiment, the start flag of the SOL is used to determine the start mode of the SOL. The start flag bit of SOL may be presented in the form of hardware or a function. The BMC may be available from SOL services, or from a remote PC via a network. And determining a serial port switching mode of the SOL according to the start flag bit of the SOL, wherein the serial port switching mode comprises a manual mode and an automatic mode. In the manual mode, when the redirection to the internet port by using the serial port is triggered, an SOL command is manually input to control the output of serial port information. The automatic mode is automatically switched when the redirection to the internet port by using the serial port is triggered.
In an alternative embodiment, the serial port switching mode of the SOL may be determined by determining a flag bit of a GPIO (General Purpose Input Output) connected to the BMC. When the flag bit of the GPIO is 1, the mode of serial port switching of the SOL is an automatic mode; and when the flag bit of the GPIO is 0, the serial port switching mode representing the SOL is a manual mode.
In an alternative embodiment, the serial port switching pattern of SOL may be determined by the value of the flag function. When the value of the mark function is 1, representing that the serial port switching mode representing the SOL is an automatic mode; when the value of the flag function is 0, the serial port switching mode representing the SOL is the manual mode.
In one embodiment, the log collection method further comprises:
and storing the first target log information output by the second serial port in a log storage space of the BMC according to the priority of the first serial port.
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 abnormality and debug, wherein the log data stored in the log storage space does not disappear even when the power is off, and subsequent analysis is facilitated. It should be noted that the log storage space is not limited to the storage space configured by the BMC itself, and may also be a storage space that needs to be increased according to an actual application scenario, for example, an extrapolated SD card. The second serial port outputs the same first log information at the same time, when the output of the first serial port corresponding to the first log information is recovered to be normal, the first log information corresponding to the output of the first serial port is recovered, therefore, a plurality of first log information corresponding to the first serial port output by the second serial port may exist in the storage space, when the storage space reaches the storage space threshold value of the storage space, 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, namely, the first target log information corresponding to the first serial port with the highest priority is preferentially stored.
In one embodiment, as shown in fig. 5, the log collection method further includes the following steps 502 to 506.
Step 502, obtaining the abnormal severity of the first serial port output, and obtaining a corresponding storage space threshold according to the abnormal severity.
In the log storage space of the BMC, the log storage space is divided into different log storage subspaces according to the degree of the abnormal severity, for example, if the abnormal severity is 3 degrees, the log storage space is divided into three log storage subspaces on average or in proportion, that is, the three log storage subspaces may be the same or different in size. And acquiring the abnormal severity of the first serial port output, and acquiring a corresponding storage space threshold according to the abnormal severity, wherein the storage space threshold is not larger than the size of the log storage subspace corresponding to the abnormal severity.
Step 504, detecting whether a storage space threshold is reached.
And detecting whether the size of the log storage subspace corresponding to the abnormal severity reaches the storage space threshold value or not by judging the relationship between the size of the log storage subspace corresponding to the abnormal severity and the corresponding storage space threshold value.
In step 506, when the storage space threshold is reached, the first log information which is currently output is overwritten on the log information which is stored first in the storage space corresponding to the abnormal severity.
And when the size of the log storage subspace corresponding to the abnormal severity reaches the storage space threshold, covering the first log information which is output currently to the log storage subspace and is stored firstly.
In this embodiment, by obtaining the abnormal severity of the first serial port output, obtaining the corresponding storage space threshold according to the abnormal severity, detecting whether the actual storage condition of the corresponding storage space reaches the storage space threshold, and when the actual storage condition of the corresponding storage space reaches the storage space threshold, covering the first log information output currently with the log information stored first in the corresponding storage space, the maximum utilization of the log storage space can be achieved, and meanwhile, the collected logs are stored for as long as possible.
In one embodiment, as shown in FIG. 6, the log collection method includes the following steps 602 to 612.
Step 602, a first log information corresponding to the first serial port is obtained.
Step 604, detecting the output condition of the first serial port according to the first log information.
Step 606, when it is detected that a plurality of first serial ports output at the same time are abnormal, determining a first target serial port with the highest priority in the abnormal first serial ports according to the priority of the first serial ports.
And 608, outputting the first target log information corresponding to the first target serial port by using the second serial port.
And step 610, redirecting the serial port to the network port SOL by using the serial port to output second target log information corresponding to a second target serial port, wherein the second target serial port is the serial port with the highest priority level in the abnormal first serial ports.
And step 612, storing the first target log information output by the second serial port in a log storage space of the BMC according to the priority of the first serial port.
In an embodiment, taking AST2500 as an example, the BMC is provided with 5 physical serial ports, which are UART1, UART2, UART3, UART4 and UART5 in sequence, where UART1 is externally connected to the BIOS/OS, UART2 is externally connected to the MCP, UART3 is externally connected to the SCP, UART4 is externally connected to the ATF, UART5 is a BMC serial port, that is, UART1 to UART4 are first serial ports, and UART5 is a 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 herein. When the BMC detects that the system is in a standby state and a normal operation state, the UART5 is maintained to be output by a BMC serial port; when the system normally operates, starting SOL to output according to the default UART1 under the condition that the network is normally connected; when the system is not powered on, the UARTs 1-4 have no output.
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 BMC outputs the first log information corresponding to the first serial port by adopting the second serial port. For example, if the BIOS starts up and fails, which indicates that the UART1 output is abnormal, the BMC automatically outputs the print information corresponding to the UART1 using the UART 5. For another example, if the MCP cannot acquire the CPU temperature, voltage, or the like, which indicates that the output of the UART2 is abnormal, the BMC automatically outputs the print information corresponding to the UART2 using the UART 5. When the condition that the BIOS start fails and the MCP cannot acquire the temperature or the voltage of the CPU at the same time occurs, it is indicated that both the outputs of the UART1 and the UART2 fail, according to the priority conditions of the UART1 and the UART2, the serial port printing information with the highest priority is output by adopting the UART5, if the priority of the UART1 is the highest, the printing information corresponding to the UART1 is output by adopting the UART5, and because the priority of the UART2 is the highest, the serial port is used for redirecting to the network port to output the printing information corresponding to the UART 2. The log information output by the UART5 is saved in the log storage space of the BMC.
In an embodiment, a flow diagram of the log collection method is shown in fig. 7, and when there are multiple abnormal serial ports of the system firmware, the BMC serial port is used to output the serial port with the highest priority of the abnormal serial port of the system firmware according to the priority of the abnormal serial port of the system firmware; redirecting to a serial port with the highest priority of a system firmware serial port with abnormal network port SOL output by using the serial port; for other abnormal system firmware Serial ports, for example, Serial ports with the priority level of the system firmware Serial port arranged at the third position, a local debugging line, for example, an RS232 Bus, may be manually accessed at an abnormal position for debugging, and corresponding log information may be acquired and output through a USB (Universal Serial Bus). The BMC serial port output is adopted to obtain and output corresponding log information through a local debugging line, such as an RS232 bus, and a USB; the redirection from the serial port to the network port SOL output is realized by outputting from the network port through a network, and finally, the log information corresponding to the serial port is sent to a remote PC.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a log collection device for implementing the log collection method mentioned above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the method, so specific limitations in one or more log collection device embodiments provided below can refer to the limitations on the log collection method in the foregoing, and details are not described herein again.
In one embodiment, as shown in fig. 8, there is provided a log collection device applied to a baseboard management controller BMC, where the BMC includes a first serial port and a second serial port, and includes: a log obtaining module 802, an anomaly detection module 804 and a serial port switching module 806, wherein:
a log obtaining module 802, configured to obtain first log information corresponding to the first serial port;
an anomaly detection module 804, configured to detect an output condition of the first serial port according to the first log information;
a serial port switching module 806, configured to output, by using the second serial port, first log information corresponding to the first serial port when it is detected that the output of the first serial port is abnormal.
In an embodiment, the serial port switching module 806 is further configured to:
when a plurality of first serial ports are detected to output abnormal at the same time, determining a first target serial port with the highest priority in the abnormal first serial ports according to the priority of the first serial ports;
and outputting first target log information corresponding to the first target serial port by adopting the second serial port.
In one embodiment, the apparatus further includes a serial port redirection module configured to:
and redirecting the serial port to the network port SOL by using the serial port to output second target log information corresponding to a second target serial port, wherein the second target serial port is the serial port with the highest priority level in the abnormal first serial ports.
In one embodiment, the apparatus further comprises a SOL flag module to:
acquiring a start flag bit of the SOL;
and determining a serial port switching mode of the SOL according to the starting flag bit, wherein the serial port switching mode comprises a manual mode and an automatic mode.
In one embodiment, the apparatus further comprises a log storage module to:
and storing the first target log information output by the second serial port in a log storage space of the BMC according to the priority of the first serial port.
In one embodiment, the apparatus further comprises an exception level module to:
acquiring the abnormal severity of the first serial port output, and acquiring a corresponding storage space threshold according to the abnormal severity;
detecting whether a storage space threshold value is reached;
and when the storage space threshold is reached, the first log information which is currently output is covered with the log information which is stored firstly in the storage space corresponding to the abnormal severity.
Each module in the log collection apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device 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 an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing the log data acquired by the second serial port. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a log collection method.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, which includes 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.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the steps of the log collection method in the embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when being executed by a processor, realizes the steps of the log collection method in the above embodiments.
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 for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases involved in the embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A log collection method is applied to a Baseboard Management Controller (BMC) which comprises a first serial port and a second serial port, and comprises the following steps:
acquiring first log information corresponding to the first serial port;
detecting the output condition of the first serial port according to the first log information;
and when the first serial port output is detected to be abnormal, outputting first log information corresponding to the first serial port by adopting the second serial port.
2. The method according to claim 1, wherein when it is detected that the output of the first serial port is abnormal, outputting the first log information corresponding to the first serial port by using the second serial port comprises:
when a plurality of first serial ports are detected to output abnormal at the same time, determining a first target serial port with the highest priority in the abnormal first serial ports according to the priority of the first serial ports;
and outputting first target log information corresponding to the first target serial port by adopting the second serial port.
3. The method of claim 2, further comprising:
and redirecting the serial port to the network port SOL by using the serial port to output second target log information corresponding to a second target serial port, wherein the second target serial port is the serial port with the highest priority level in the abnormal first serial ports.
4. The method of claim 3, further comprising:
acquiring a start flag bit of the SOL;
and determining a serial port switching mode of the SOL according to the starting flag bit, wherein the serial port switching mode comprises a manual mode and an automatic mode.
5. The method of claim 3, further comprising:
and storing the first target log information output by the second serial port in a log storage space of the BMC according to the priority of the first serial port.
6. The method of claim 5, further comprising:
acquiring the abnormal severity of the first serial port output, and acquiring a corresponding storage space threshold according to the abnormal severity;
detecting whether a storage space threshold value is reached;
and when the storage space threshold is reached, the first log information which is currently output is covered with the log information which is stored firstly in the storage space corresponding to the abnormal severity.
7. The utility model provides a log collection device which characterized in that is applied to baseboard management controller BMC, BMC includes first serial ports and second serial ports, the device includes:
the log obtaining module is used for obtaining first log information corresponding to the first serial port;
the abnormality detection module is used for detecting the output condition of the first serial port according to the first log information;
and the serial port switching module is used for outputting first log information corresponding to the first serial port by adopting the second serial port when the first serial port output is detected to be abnormal.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 6.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 6 when executed by a processor.
CN202210597125.1A 2022-05-30 2022-05-30 Log collection method and device, computer equipment and storage medium Pending CN115022163A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210597125.1A CN115022163A (en) 2022-05-30 2022-05-30 Log collection method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210597125.1A CN115022163A (en) 2022-05-30 2022-05-30 Log collection method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115022163A true CN115022163A (en) 2022-09-06

Family

ID=83070265

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210597125.1A Pending CN115022163A (en) 2022-05-30 2022-05-30 Log collection method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115022163A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719712A (en) * 2023-08-09 2023-09-08 金舟远航(北京)信息产业有限公司 Processor serial port log output method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024088A (en) * 2012-12-19 2013-04-03 深圳市广和通实业发展有限公司 Method for simultaneous communication of double serial ports
US20160080210A1 (en) * 2014-09-11 2016-03-17 Quanta Computer Inc. High density serial over lan managment system
CN109947690A (en) * 2019-03-18 2019-06-28 联想(北京)有限公司 Control method, device and electronic equipment
CN113722211A (en) * 2021-08-11 2021-11-30 苏州浪潮智能科技有限公司 BMC (baseboard management controller) debugging method, device and system and embedded equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024088A (en) * 2012-12-19 2013-04-03 深圳市广和通实业发展有限公司 Method for simultaneous communication of double serial ports
US20160080210A1 (en) * 2014-09-11 2016-03-17 Quanta Computer Inc. High density serial over lan managment system
CN109947690A (en) * 2019-03-18 2019-06-28 联想(北京)有限公司 Control method, device and electronic equipment
CN113722211A (en) * 2021-08-11 2021-11-30 苏州浪潮智能科技有限公司 BMC (baseboard management controller) debugging method, device and system and embedded equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719712A (en) * 2023-08-09 2023-09-08 金舟远航(北京)信息产业有限公司 Processor serial port log output method and device, electronic equipment and storage medium
CN116719712B (en) * 2023-08-09 2024-01-19 金舟远航(北京)信息产业有限公司 Processor serial port log output method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US20070016827A1 (en) Systems and methods for providing remotely accessible in-system emulation and/or debugging
US7801984B2 (en) Diagnostic/remote monitoring by email
CN114546747A (en) BMC cold restart pressure test system and method
CN109428778B (en) Mainboard network connectivity test method and device
CN111078484B (en) Power-off test method, device, equipment and storage medium for system upgrade
CN115022163A (en) Log collection method and device, computer equipment and storage medium
CN112463516A (en) Method and system for collecting and verifying integrity of BMC log
TW201500919A (en) System and method of remote debugging BMC
CN114510381A (en) Fault injection method, device, equipment and storage medium
CN117453036A (en) Method, system and device for adjusting power consumption of equipment in server
CN109947628B (en) Management control method, management control system and server
CN115599617B (en) Bus detection method and device, server and electronic equipment
CN109446002B (en) Jig plate, system and method for grabbing SATA hard disk by server
CN100421381C (en) Method and device for obtaining information of operation and failure state for network equipment
CN115080132A (en) Information processing method, information processing apparatus, server, and storage medium
CN113722211A (en) BMC (baseboard management controller) debugging method, device and system and embedded equipment
CN114490200A (en) Memory test method and device, computer equipment and storage medium
JP4208494B2 (en) Load test system for network server
CN111611138A (en) Log data capturing method and device, computer equipment and storage medium
CN113722185B (en) Domestic computer remote management system
CN116719712B (en) Processor serial port log output method and device, electronic equipment and storage medium
CN109120422B (en) Remote server system capable of obtaining hardware information and management method thereof
TWI473469B (en) Method for detecting network ports
CN115811480A (en) File transmission performance testing method and device, electronic equipment and storage medium
KR20040092248A (en) A remote controlling management system for computer-resources

Legal Events

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