CN115022163B - Log collection method, device, computer equipment and storage medium - Google Patents
Log collection method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN115022163B CN115022163B CN202210597125.1A CN202210597125A CN115022163B CN 115022163 B CN115022163 B CN 115022163B CN 202210597125 A CN202210597125 A CN 202210597125A CN 115022163 B CN115022163 B CN 115022163B
- Authority
- CN
- China
- Prior art keywords
- serial port
- output
- log information
- target
- serial
- 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.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/069—Management of faults, events, alarms or notifications using logs of notifications; Post-processing of notifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/40—Bus structure
- G06F13/4063—Device-to-bus coupling
- G06F13/4068—Electrical coupling
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0677—Localisation of faults
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0002—Serial port, e.g. RS232C
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0042—Universal serial bus [USB]
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy 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)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Debugging And Monitoring (AREA)
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.
Description
技术领域Technical Field
本申请涉及服务器技术领域,特别是涉及一种日志收集方法、装置、计算机设备、存储介质和计算机程序产品。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
随着服务器的可管理特性越来越受重视,各大服务器生产厂商都在各自的硬件平台上增强了服务器的可管理特性,并在功能上不断强化。IPMI(Intelligent PlatformManagement Interface,智能平台管理接口)时一种智能管理机器设备的标准,是解决服务器的可靠管理问题的有效手段,其核心是一个专用的芯片/控制器,称为BMC(BaseboardManagement Controller,基板管理控制器)。BMC外接一个串口,通过该串口可以实现系统的打印信息的输出,也可以通过该串口获得系统数据,以便于对服务器进行配置和调试。用户可以利用IPMI监视服务器的物理特征,如温度、电压、电扇工作状态、电源供应等。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.
服务器部署运行过程中经常会发生各种故障,传统的故障诊断方式每次都需要登陆OS(operating system,操作系统),修改GRUB(GRand Unified Bootloader,启动引导程序)文件,将OS串口重定向至BIOS(Basic Input Output System,基本输入输出系统)串口。这种方式需要借助物理串口,连接额外的串口线,先定位异常固件,才能获取相应的日志。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
基于此,有必要针对上述技术问题,提供一种能够自动定位系统异常并收集相应日志的日志收集方法、装置、计算机设备、计算机可读存储介质和计算机程序产品。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.
第一方面,本申请提供了一种日志收集方法,应用于基板管理控制器BMC,所述BMC包括第一串口和第二串口,所述方法包括: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:
获取所述第一串口对应的第一日志信息;Obtain first log information corresponding to the first serial port;
根据所述第一日志信息,检测所述第一串口输出情况;According to the first log information, detecting the output status of the first serial port;
当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息。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.
在其中一个实施例中,所述当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息,包括: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:
当检测到同时有多个所述第一串口输出发生异常时,根据所述第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口;When it is detected that multiple first serial ports output abnormalities at the same time, determine, according to the priorities of the first serial ports, a first target serial port with the highest priority among the first serial ports where the abnormalities occur;
采用所述第二串口输出所述第一目标串口对应的第一目标日志信息。The second serial port is used to output the first target log information corresponding to the first target serial port.
在其中一个实施例中,所述方法还包括:In one embodiment, the method further comprises:
使用串口重定向到网口SOL输出第二目标串口对应的第二目标日志信息,所述第二目标串口为发生异常的第一串口中优先级次最高的串口。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.
在其中一个实施例中,所述方法还包括:In one embodiment, the method further comprises:
获取所述SOL的启动标志位;Obtaining the start flag of the SOL;
根据所述启动标志位确定所述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.
在其中一个实施例中,所述方法还包括:In one embodiment, the method further comprises:
根据所述第一串口的优先级,将所述第二串口输出的第一目标日志信息存储于所述BMC的日志存储空间中。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.
在其中一个实施例中,所述方法还包括:In one embodiment, 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.
第二方面,本申请还提供了一种日志收集装置,应用于基板管理控制器BMC,所述BMC包括第一串口和第二串口,所述装置包括: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:
日志获取模块,用于获取所述第一串口对应的第一日志信息;A log acquisition module, used to acquire first log information corresponding to the first serial port;
异常检测模块,用于根据所述第一日志信息,检测所述第一串口输出情况;an abnormality detection module, used for detecting the output status of the first serial port according to the first log information;
串口切换模块,用于当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息。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.
第三方面,本申请还提供了一种计算机设备。所述计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤: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:
获取所述第一串口对应的第一日志信息;Obtain first log information corresponding to the first serial port;
根据所述第一日志信息,检测所述第一串口输出情况;According to the first log information, detecting the output status of the first serial port;
当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息。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.
第四方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤: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:
获取所述第一串口对应的第一日志信息;Obtain first log information corresponding to the first serial port;
根据所述第一日志信息,检测所述第一串口输出情况;According to the first log information, detecting the output status of the first serial port;
当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息。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.
第五方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤: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:
获取所述第一串口对应的第一日志信息;Obtaining first log information corresponding to the first serial port;
根据所述第一日志信息,检测所述第一串口输出情况;According to the first log information, detecting the output status of the first serial port;
当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息。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.
上述日志收集方法、装置、计算机设备、存储介质和计算机程序产品,获取所述第一串口对应的第一日志信息;根据所述第一日志信息,检测所述第一串口输出情况;当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息。本申请通过设置第一串口和第二串口,根据第一串口对应的第一日志信息检测第一串口的输出情况,在第一串口输出发生异常时,采用第二串口输出该第一串口对应的第一日志信息,可通过第一串口的异常情况实现对服务器的异常固件进行定位,同时还能保障相应异常固件所对应的日志的正常输出,提高了日志收集效率。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
图1为一个实施例中日志收集方法的应用环境图;FIG1 is an application environment diagram of a log collection method in one embodiment;
图2为一个实施例中日志收集方法的流程示意图;FIG2 is a flow chart of a log collection method in one embodiment;
图3为一个实施例中步骤306的流程示意图;FIG3 is a schematic diagram of a flow chart of step 306 in one embodiment;
图4为另一个实施例中日志收集方法的流程示意图;FIG4 is a flow chart of a log collection method in another embodiment;
图5为另一个实施例中日志收集方法的流程示意图;FIG5 is a flow chart of a log collection method in another embodiment;
图6为另一个实施例中日志收集方法的流程示意图;FIG6 is a flow chart of a log collection method in another embodiment;
图7为另一个实施例中日志收集方法的流程示意图;FIG7 is a flow chart of a log collection method in another embodiment;
图8为一个实施例中日志收集装置的结构框图;FIG8 is a block diagram of a log collection device in one embodiment;
图9为一个实施例中计算机设备的内部结构图。FIG. 9 is a diagram showing the internal structure of a computer device in one embodiment.
具体实施方式DETAILED DESCRIPTION
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。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.
在服务器中,有很多系统固件模块在开发或者异常定位时需要进行调试,一种调试方式是通过外接调试线到主板,经过RS232串口输出相应的打印信息,根据所输出的打印信息进行异常定位并调试,即需要通过手动才能定位相应的异常固件;另一种方式是在硬件电路设计时,将系统固件的串口信息并行通过BMC串口重定向到网口进行输出,以BMCAST2500芯片为例,可以将MCP(Management Control Processor,管理控制处理器)、SCP(System Control Processor,系统控制处理器)、ATF(arm-trusted-firmware,arm可信固件)、UEFI(Unified Extensible Firmware Interface,统一可扩展固件接口)等串口的RX、TX信号分别跟BMC的UART1-UART4(串口1至串口4)的TX、RX连通,其中,RX表示信号接收端,例如输入引脚;TX表示信号发送端,例如输出引脚。由于串口重定向输出只能唯一,所以需要通过手动输入SOL命令来进行控制对应重定向串口信息的输出。服务器可以是arm服务器、x86服务器等。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.
针对上述问题,本申请提出了一种日志输出方法。本申请实施例提供的日志输出方法,可以应用于如图1所示的应用环境中。其中,基板管理控制器BMC分别与服务器处理器CPU(central processing unit)、基本输入输出系统BIOS及管理控制处理器MCP连接,基板管理控制器BMC包括第一串口和第二串口,第一串口可以是多个。其中,第一串口分别与服务器处理器CPU、基本输入输出系统BIOS及管理控制处理器MCP连接,并对应输出相应系统的日志。基板管理控制器BMC获取第一串口对应的第一日志信息,根据第一日志信息检测第一串口输出情况,当检测到第一串口输出发生异常时,采用第二串口输出第一串口对应的第一日志信息。在此需要说明的是,不局限于服务器处理器CPU、基本输入输出系统BIOS及管理控制处理器MCP与基板管理控制器BMC连接,还可以是其他的控制器或系统与基板管理控制器BMC连接,进一步地,与基板管理控制器BMC的第一串口进行连接。In view of the above problems, the present application proposes a log output method. The log output method provided by the embodiment of the present application can be applied in the application environment as shown in Figure 1. 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 the log of the corresponding system is outputted 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 the output of the first serial port is detected to be 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.
在一个示例性的实施例中,如图2所示,提供了一种日志输出方法,以该方法应用于图1中的BMC为例进行说明,BMC包括第一串口和第二串口,包括以下步骤202至步骤206。In an exemplary embodiment, as shown in FIG. 2 , a log output method is provided. The method is applied to the BMC in FIG. 1 as an example for explanation. The BMC includes a first serial port and a second serial port. The method includes the following steps 202 to 206 .
步骤202,获取第一串口对应的第一日志信息。Step 202: Obtain first log information corresponding to the first serial port.
其中,第一串口可以是多个。第一串口与其他部件相连接实现通信,但是其他部件与BMC相互独立运行、互不影响,其他部件可以将对应产生的日志通过第一串口输出进行记录或进行分析。其中,其他部件可以是服务器处理器CPU、基本输入输出系统BIOS、管理控制处理器MCP、系统控制处理器SCP、ATF等。对应地,第一日志信息是指与第一串口对应的其他部件在运行过程中所产生的日志信息。一个第一串口对应一种第一日志信息。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 server processor CPU, basic input and output system BIOS, management control processor MCP, 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.
步骤204,根据第一日志信息,检测第一串口输出情况。Step 204: Detect the output status 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. 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.
步骤206,当检测到第一串口输出发生异常时,采用第二串口输出第一串口对应的第一日志信息。Step 206: 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.
当BMC检测到第一串口输出发生异常时,采用第二串口输出第一串口对应的第一日志信息。可选地,当BMC检测到有第一串口输出发生异常时,可向对应的逻辑控制组件发送连接切换命令,使得与该第一串口连接的其他部件切换为与第二串口连接,采用第二串口输出原第一串口对应输出的第一日志信息。通常情况下,第二串口为一个,因此,当同时检测到多个第一串口输出发生异常时,可根据预设条件,从多个第一串口中确定第一目标串口,采用第二串口输出第一目标串口对应的第一目标日志信息。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.
上述日志收集方法中,通过获取第一串口对应的第一日志信息;根据第一日志信息,检测第一串口输出情况;当检测到第一串口输出发生异常时,采用第二串口输出第一串口对应的第一日志信息。本申请实施例通过在BMC中设置第一串口和第二串口,根据第一串口对应的第一日志信息检测第一串口的输出情况,在第一串口输出发生异常时,采用第二串口输出该第一串口对应的第一日志信息,可通过第一串口的异常情况实现对服务器的异常固件进行定位,同时还能保障相应异常固件所对应的日志的正常输出,从而提高了日志收集效率。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 through 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.
在一个实施例中,如图3所示,当检测到第一串口输出发生异常时,采用第二串口输出第一串口对应的第一日志信息的步骤206,包括以下步骤302至步骤304。In one embodiment, as shown in FIG. 3 , when an abnormality is detected in the output of the first serial port, 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 .
步骤302,当检测到同时有多个第一串口输出发生异常时,根据第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口。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.
当BMC检测到同时有多个第一串口输出发生异常时,可根据第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口。其中,可根据第一串口对应的第一日志信息的重要程度或者紧急程度,设定第一串口的优先级,并提前将第一串口的优先级与第一串口的对应关系进行存储,以方便BMC处理时能够及时获取。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.
步骤304,采用第二串口输出第一目标串口对应的第一目标日志信息。Step 304: Use the second serial port to output the first target log information corresponding to the first target serial port.
确定发生异常的第一目标串口后,采用第二串口输出第一目标串口对应的第一目标日志信息。可选地,BMC可发送连接切换命令至对应的逻辑控制组件,例如PLC(Programmable Logic Controller,可编程逻辑控制器)或CPLD(Complex Programmablelogic device,复杂可编程逻辑器件)组件,使得逻辑控制组件将与第一目标串口连接的对象,自动切换至与第二串口连接,使得第二串口可以输出第一目标串口对应的第一目标日志信息。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.
本实施例中,当检测到同时有多个第一串口输出发生异常时,根据第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口,采用第二串口输出第一目标串口对应的第一目标日志信息,可实现在第一串口发生异常时,能够及时将优先级最高的第一目标串口的第一目标日志信息采用第二串口输出,收集第一目标日志信息从而及时分析对应的异常问题,可提高日志收集的质量。在一些实施例中,如图4所示,日志收集方法还包括以下步骤402至步骤406。In this embodiment, when it is detected that multiple first serial ports output 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 first target log information corresponding to the first target serial port is outputted using the second serial port, so that when an abnormality occurs in the first serial port, the first target log information of the first target serial port with the highest priority can be outputted using the second serial port in a timely manner, and the first target log information is collected so as to timely analyze the corresponding abnormal problem, which can improve the quality of log collection. In some embodiments, as shown in FIG4 , the log collection method further includes the following steps 402 to 406.
步骤402,当检测到同时有多个第一串口输出发生异常时,根据第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口。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.
步骤404,采用第二串口输出第一目标串口对应的第一目标日志信息。Step 404: Use the second serial port to output first target log information corresponding to the first target serial port.
步骤406,使用串口重定向到网口SOL输出第二目标串口对应的第二目标日志信息,其中,第二目标串口为发生异常的第一串口中优先级次最高的串口。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.
本实施例中,步骤402至步骤404可参照步骤302至步骤304的描述,在此不再赘述。串口重定向到网口SOL(Serial Over Lan),SOL提供了一种机制,使得远程管理系统的串口控制器通过基于IP网络的IPMI会话能够重定向到本地。通常,串口是修复系统故障和BIOS异常不可或缺的工具。当机器发生故障时,系统管理人员可以通过串口进行BIOS、操作系统和网络的相关配置,修复系统。在以往情形中,管理人员不得不回到嘈杂的机房,重新接入串口,再进行修复工作。SOL为管理人员提供了基于IP的远程系统串口的访问,只要机房内网络不出现故障,管理人员便可以通过任何一台支持SOL的主机访问发生故障的机器的串口。即,串口重定向到网口SOL是通过网络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 IP-based access to the remote system serial port. 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
在一个可选的实施例中,通过IPMI标准的SOL协议在BMC与远端PC(PersonalComputer,个人计算机)之间建立通信连接。在BMC内部建立一个SOL服务,SOL服务可实现两个方向的数据流传输,即,SOL服务可以将第一串口数据传递到远端PC,以及远端PC通过SOL服务将数据传递给第一串口。SOL服务读取第一串口的数据,远端PC打开SOL客户端,SOL客户端向SOL服务发起数据请求,SOL接受到数据请求后,将数据传递到远端PC的SOL客户端,SOL客户端可将接收到的数据显示出来。用户在远端PC的SOL客户端写入数据,SOL客户端将数据通过网络传递给SOL服务,SOL服务接收到数据后将数据传递给第一串口,第一串口即可接收到远端PC输入的数据。In an optional embodiment, a communication connection is established between the BMC and a remote PC (Personal Computer) through the IPMI standard SOL protocol. 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.
本实施例中,当检测到同时有多个第一串口输出发生异常时,根据第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口,采用第二串口输出第一目标串口对应的第一目标日志信息;同时使用串口重定向到网口SOL输出第二目标串口对应的第二目标日志信息,其中,第二目标串口为发生异常的第一串口中优先级次最高的串口,可实现同时打印两个第一串口的日志信息,实现对发生异常的第一串口对应的第一日志信息进行充分收集,从而得到更多的日志信息用于分析异常。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.
在一些可能的实施例中,日志收集方法还包括:In some possible embodiments, the log collection method further includes:
获取SOL的启动标志位;Get the SOL startup flag;
根据启动标志位确定SOL的串口切换模式,其中,串口切换模式包括手动模式和自动模式。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.
本实施例中,SOL的启动标志位,用于确定SOL的启动方式。SOL的启动标志位可通过硬件或函数的形式呈现。BMC可从SOL服务获取,也可以通过网络从远端PC获取。根据SOL的启动标志位确定SOL的串口切换模式,其中,串口切换模式包括手动模式和自动模式。手动模式是在触发使用串口重定向到网口时,手动输入SOL命令,以控制串口信息的输出。自动模式是在触发使用串口重定向到网口时自动切换。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.
在一个可选的实施例中,可通过判断与BMC相连的GPIO(General Purpose InputOutput,通用输入输出口)的标志位,确定SOL的串口切换模式。当GPIO的标志位为1时,代表SOL的串口切换模式为自动模式;当GPIO的标志位为0时,代表SOL的串口切换模式为手动模式。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.
在一个可选的实施例中,可通过标志函数的值确定SOL的串口切换模式。当标志函数的值为1时,代表代表SOL的串口切换模式为自动模式;当标志函数的值为0时,代表SOL的串口切换模式为手动模式。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.
在一个实施例中,日志收集方法还包括:In one embodiment, the log collection method further includes:
根据第一串口的优先级,将第二串口输出的第一目标日志信息存储于BMC的日志存储空间中。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.
本实施例中,根据第一串口的优先级,将第二串口输出的第一目标日志信息存储在BMC的日志存储空间中,从而对日志存储空间中存储的日志信息进行分析以发现异常及调试,其中,存储在日志存储空间的日志数据断电也不会消失,方便后续进行分析。在此需要说明的是,日志存储空间不局限于是BMC自身配置的存储空间,还可以是根据实际应用场景需要增加的存储空间,例如外插的SD卡等。第二串口在同一时间内输出同一种第一日志信息,当该种第一日志信息对应的第一串口输出恢复正常时,则恢复由该第一串口输出对应的第一日志信息,因此,存储空间中可能会存在多个由第二串口输出的第一串口对应的第一日志信息,当达到存储空间的存储空间阈值时,则根据第一串口的优先级,将第二串口输出的第一目标日志信息存储于BMC的日志存储空间中,即,优先存储优先级最高的第一串口对应的第一目标日志信息。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 output of the first serial port 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.
在一个实施例中,如图5所示,日志收集方法还包括以下步骤502至步骤506。In one embodiment, as shown in FIG. 5 , the log collection method further includes the following steps 502 to 506 .
步骤502,获取第一串口输出的异常严重程度,根据异常严重程度获取对应的存储空间阈值。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.
在BMC的日志存储空间中,将日志存储空间根据异常严重程度的等级划分为不同的日志存储子空间,例如,异常严重程度为3个等级,则将日志存储空间平均划分或按比例划分为三个日志存储子空间,即,三个日志存储子空间的大小可以相同,也可以不同。获取第一串口输出的异常严重程度,根据异常严重程度获取对应的存储空间阈值,其中,存储空间阈值不大于异常严重程度对应的日志存储子空间的大小。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 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.
步骤504,检测是否达到存储空间阈值。Step 504, detecting whether the storage space threshold is reached.
通过判断异常严重程度对应的日志存储子空间的大小与相应的存储空间阈值之间的关系,检测异常严重程度对应的日志存储子空间的大小是否达到了存储空间阈值。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.
步骤506,当达到存储空间阈值时,则将当前输出的第一日志信息覆盖与异常严重程度对应的存储空间中最先存储的日志信息。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.
当异常严重程度对应的日志存储子空间的大小达到了存储空间阈值时,则将当前输出的第一日志信息覆盖日志存储子空间中最先存储的日志信息。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.
本实施例中,通过获取第一串口输出的异常严重程度,根据异常严重程度获取对应的存储空间阈值,检测对应的存储空间的实际存储情况是否达到了存储空间阈值,当达到存储空间阈值时,将当前输出的第一日志信息覆盖对应的存储空间中最先存储的日志信息,可实现对日志存储空间的最大化利用,同时对所收集的日志进行尽量长时间的存储。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.
在一个实施例中,如图6所示,日志收集方法包括以下步骤602至步骤612。In one embodiment, as shown in FIG. 6 , the log collection method includes the following steps 602 to 612 .
步骤602,获取第一串口对应的第一日志信息。Step 602: Obtain first log information corresponding to the first serial port.
步骤604,根据第一日志信息,检测第一串口输出情况。Step 604: Detect the output status of the first serial port according to the first log information.
步骤606,当检测到同时有多个第一串口输出发生异常时,根据第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口。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.
步骤608,采用第二串口输出第一目标串口对应的第一目标日志信息。Step 608: Use the second serial port to output the first target log information corresponding to the first target serial port.
步骤610,使用串口重定向到网口SOL输出第二目标串口对应的第二目标日志信息,其中,第二目标串口为发生异常的第一串口中优先级次最高的串口。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.
步骤612,根据第一串口的优先级,将第二串口输出的第一目标日志信息存储于BMC的日志存储空间中。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.
在一个实施例中,以AST2500为例,BMC共设有5个物理串口,依次为UART1、UART2、UART3、UART4、UART5,其中,UART1外接BIOS/OS,UART2外接MCP,UART3外接SCP,UART4外接ATF,UART5为BMC串口,即UART1~UART4为第一串口,UART5为第二串口。在此需要说明的是,除了第二串口外,第一串口与其他部件之间的连接对应关系在此不作具体限定。当BMC检测到系统处于待机状态以及正常运行状态,维持UART5为BMC串口输出;系统并正常运行时,在网络正常连通的情况下,启动SOL按照默认UART1输出;在系统没有上电时,UART1~UART4无输出。In one embodiment, taking AST2500 as an example, the BMC is provided 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 here 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 state and normal operation state, 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.
当BMC根据第一串口对应的第一日志信息检测到第一串口输出发生异常时,采用第二串口输出第一串口对应的第一日志信息。例如,若BIOS启动出现故障,说明UART1输出出现异常,BMC自动采用UART5输出UART1对应的打印信息。再如,若MCP获取不了CPU温度或电压等,说明UART2的输出出现异常,BMC自动采用UART5输出UART2对应的打印信息。对于同时出现BIOS启动出现故障和MCP获取不了CPU温度或电压的情况,说明UART1和UART2的输出均发生了故障,则根据UART1和UART2的优先级情况,采用UART5输出优先级最高的串口打印信息,若UART1的优先级最高,则采用UART5输出UART1对应的打印信息,由于UART2的优先级次最高,所以使用串口重定向到网口输出UART2对应的打印信息。将UART5输出的日志信息保存在BMC的日志存储空间中。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.
在一个实施例中,日志收集方法的流程示意图如图7所示,当发生异常的系统固件串口有多个时,根据发生异常的系统固件串口的优先级,采用BMC串口输出发生异常的系统固件串口的优先级最高的串口;使用串口重定向到网口SOL输出发生异常的系统固件串口的优先级次高的串口;针对其他发生异常的系统固件串口,例如系统固件串口的优先级排在第三位的串口,可以在异常位置手动接入本地调试线,例如RS232总线进行调试,再通过USB(Universal Serial Bus,通用串行总线)获取并输出对应的日志信息。其中,采用BMC串口输出是通过本地调试线,例如RS232总线,再通过USB获取并输出对应的日志信息;采用串口重定向到网口SOL输出是通过网络从网口输出,最终将串口对应的日志信息发送到远端的PC。In one embodiment, the flow chart of the log collection method is shown in FIG7. 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 position 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.
应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。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 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.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的日志收集方法的日志收集装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个日志收集装置实施例中的具体限定可以参见上文中对于日志收集方法的限定,在此不再赘述。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 solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more log collection device embodiments provided below can refer to the limitations on the log collection method above, and will not be repeated here.
在一个实施例中,如图8所示,提供了一种日志收集装置,应用于基板管理控制器BMC,所述BMC包括第一串口和第二串口,包括:日志获取模块802、异常检测模块804和串口切换模块806,其中:In one embodiment, as shown in FIG. 8 , 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:
日志获取模块802,用于获取所述第一串口对应的第一日志信息;The log acquisition module 802 is used to acquire the first log information corresponding to the first serial port;
异常检测模块804,用于根据所述第一日志信息,检测所述第一串口输出情况;An abnormality detection module 804 is used to detect the output status of the first serial port according to the first log information;
串口切换模块806,用于当检测到所述第一串口输出发生异常时,采用所述第二串口输出所述第一串口对应的第一日志信息。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.
在一个实施例中,所述串口切换模块806,还用于:In one embodiment, the serial port switching module 806 is further used to:
当检测到同时有多个所述第一串口输出发生异常时,根据所述第一串口的优先级,确定发生异常的第一串口中优先级最高的第一目标串口;When it is detected that multiple first serial ports output abnormalities at the same time, determine, according to the priorities of the first serial ports, a first target serial port with the highest priority among the first serial ports where the abnormalities occur;
采用所述第二串口输出所述第一目标串口对应的第一目标日志信息。The second serial port is used to output the first target log information corresponding to the first target serial port.
在一个实施例中,所述装置还包括串口重定向模块,用于:In one embodiment, the device further comprises a serial port redirection module, configured to:
使用串口重定向到网口SOL输出第二目标串口对应的第二目标日志信息,所述第二目标串口为发生异常的第一串口中优先级次最高的串口。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.
在一个实施例中,所述装置还包括SOL标志模块,用于:In one embodiment, the device further comprises a SOL flag module, configured to:
获取所述SOL的启动标志位;Obtaining the start flag of the SOL;
根据所述启动标志位确定所述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.
在一个实施例中,所述装置还包括日志存储模块,用于:In one embodiment, the device further includes a log storage module, which is used to:
根据所述第一串口的优先级,将所述第二串口输出的第一目标日志信息存储于所述BMC的日志存储空间中。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.
在一个实施例中,所述装置还包括异常等级模块,用于:In one embodiment, the device further comprises an abnormality level module, configured to:
获取所述第一串口输出的异常严重程度,根据所述异常严重程度获取对应的存储空间阈值;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.
上述日志收集装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。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.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图9所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储第二串口获取的日志数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种日志收集方法。In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in FIG9 . The computer device includes a processor, a memory, and a network interface connected via a system bus. 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 via a network connection. When the computer program is executed by the processor, a log collection method is implemented.
本领域技术人员可以理解,图9中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art will understand that the structure shown in FIG. 9 is merely a block diagram of a partial 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 shown in the figure, or combine certain components, or have a different arrangement of components.
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各实施例中日志收集方法的步骤。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.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各实施例中日志收集方法的步骤。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.
在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述各实施例中日志收集方法的步骤。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.
需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据。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.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill 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.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments may be arbitrarily combined. 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.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。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 (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210597125.1A CN115022163B (en) | 2022-05-30 | 2022-05-30 | Log collection method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210597125.1A CN115022163B (en) | 2022-05-30 | 2022-05-30 | Log collection method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115022163A CN115022163A (en) | 2022-09-06 |
CN115022163B true CN115022163B (en) | 2024-09-13 |
Family
ID=83070265
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210597125.1A Active CN115022163B (en) | 2022-05-30 | 2022-05-30 | Log collection method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115022163B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116032735B (en) * | 2022-12-16 | 2024-10-22 | 苏州浪潮智能科技有限公司 | A method, device, equipment and medium for determining abnormal information of a switch |
CN116719712B (en) * | 2023-08-09 | 2024-01-19 | 金舟远航(北京)信息产业有限公司 | Processor serial port log output method and device, electronic equipment and storage medium |
CN119025382B (en) * | 2024-08-21 | 2025-09-16 | 重庆赛力斯凤凰智创科技有限公司 | Log extraction method of vehicle-mounted communication terminal, vehicle-mounted communication terminal and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103024088A (en) * | 2012-12-19 | 2013-04-03 | 深圳市广和通实业发展有限公司 | Method for simultaneous communication of double serial ports |
CN113722211A (en) * | 2021-08-11 | 2021-11-30 | 苏州浪潮智能科技有限公司 | BMC (baseboard management controller) debugging method, device and system and embedded equipment |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI614613B (en) * | 2014-09-11 | 2018-02-11 | 廣達電腦股份有限公司 | Server system and associated control method |
CN109947690B (en) * | 2019-03-18 | 2023-05-23 | 联想(北京)有限公司 | Control method and device and electronic equipment |
-
2022
- 2022-05-30 CN CN202210597125.1A patent/CN115022163B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103024088A (en) * | 2012-12-19 | 2013-04-03 | 深圳市广和通实业发展有限公司 | Method for simultaneous communication of double serial ports |
CN113722211A (en) * | 2021-08-11 | 2021-11-30 | 苏州浪潮智能科技有限公司 | BMC (baseboard management controller) debugging method, device and system and embedded equipment |
Also Published As
Publication number | Publication date |
---|---|
CN115022163A (en) | 2022-09-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115022163B (en) | Log collection method, device, computer equipment and storage medium | |
US20070016827A1 (en) | Systems and methods for providing remotely accessible in-system emulation and/or debugging | |
US7788520B2 (en) | Administering a system dump on a redundant node controller in a computer system | |
CN108304299A (en) | Server power-up state monitors system and method, computer storage and equipment | |
US20070255869A1 (en) | Device evaluation using automatic connection path reconfiguration | |
CN109032863A (en) | Determination method, the system of a kind of NVMe solid state hard disk and its failure cause | |
WO2024230401A1 (en) | Baseboard management controller system operation method and apparatus, device, and non-volatile readable storage medium | |
CN109032867A (en) | A kind of method for diagnosing faults, device and equipment | |
CN118245295B (en) | PCIe link status detection method for server and server | |
CN107277193A (en) | A kind of baseboard management controller address management method, device and system | |
WO2024250776A1 (en) | Fault detection method and apparatus for external device | |
WO2020087956A1 (en) | Method, apparatus, device and system for capturing trace of nvme hard disc | |
CN108363477A (en) | Server power-up state monitors system and method, computer storage and equipment | |
CN104239174A (en) | BMC (baseboard management controller) remote debugging system and method | |
CN112463516A (en) | Method and system for collecting and verifying integrity of BMC log | |
CN115080132A (en) | Information processing method, device, server and storage medium | |
CN112486785B (en) | Method, system, terminal and storage medium for positioning downtime phase of server | |
CN114675991A (en) | Method, system, equipment and storage medium for realizing effective positioning of log | |
CN114138574A (en) | Controller testing method, device, server and storage medium | |
CN115599617B (en) | Bus detection method, device, server and electronic equipment | |
CN116974804A (en) | Debugging method, device, equipment and storage medium for managing engine suspension | |
CN116719563A (en) | Memory information acquisition method, device, equipment and storage medium | |
CN116302758A (en) | Power failure detection method, device, communication equipment and readable storage medium | |
CN117112317A (en) | Troubleshooting system, method, electronic device and storage medium | |
CN116719677A (en) | Failure analysis methods, devices, equipment and storage media |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP03 | Change of name, title or address | ||
CP03 | Change of name, title or address |
Address after: No. 809, No. 15 Zhifeng Street, Huangpu District, Guangzhou City, Guangdong Province 510000 Patentee after: Yuxian Microelectronics (Guangzhou) Co.,Ltd. Country or region after: China Address before: 518048 704, building 4, Shenzhen new generation industrial park, No. 136, Zhongkang Road, Meidu community, Meilin street, Futian District, Shenzhen, Guangdong Province Patentee before: Shenzhen Yuxian Microelectronics Co.,Ltd. Country or region before: China |