Server in-band out-of-band log collection method and device, equipment and medium
By sending in-band and out-of-band logs in parallel to the non-volatile memory of the serial data logger in the server, the limitations of log collection in the prior art are solved, achieving full coverage and efficient storage of the entire log, simplifying the hardware architecture and reducing operation and maintenance costs.
Patent Information
- Application Number
- CN202511630859.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-02-06
AI Technical Summary
The lack of a unified collection architecture that can simultaneously cover in-band and out-of-band logs in existing technologies leads to significant limitations in log collection, especially in the insufficient attention paid to out-of-band logs generated at the server hardware level.
By connecting the output terminals of the baseboard management controller, basic input/output system, and operating system to the input terminal of the serial port data logger, and using a preset transmission channel to send three types of logs in parallel to the non-volatile memory of the serial port data logger, full coverage collection of in-band and out-of-band logs is achieved. This includes starting the basic input/output system to generate the first out-of-band log, the operating system to generate the in-band log, and the baseboard management controller to generate the second out-of-band log. The logs are then sent in parallel to the non-volatile memory through the motherboard's three-pin serial port, RS-232 serial port, and the preset transmission channel.
It achieves full coverage collection of server in-band and out-of-band logs, shortens log collection time, avoids log timing disorder and loss, simplifies log collection hardware architecture, reduces operation and maintenance costs, and improves the stability and reliability of log storage.
Smart Images

Figure CN121478613A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to methods, apparatus, devices and media for collecting in-band and out-of-band logs from servers. Background Technology
[0002] As core equipment of information technology infrastructure, servers play an irreplaceable role in fault diagnosis, performance optimization and security monitoring through their operation logs. In particular, the complete acquisition of in-band and out-of-band logs directly affects operation and maintenance efficiency and the accuracy of fault location.
[0003] Current log processing and collection solutions mostly focus on centralized storage and automated analysis of in-band logs to meet the complex analysis needs brought about by a large number of application and business logs. However, they pay insufficient attention to out-of-band logs generated at the server hardware level and lack a unified collection architecture that can cover both in-band and out-of-band logs, resulting in significant limitations in log collection.
[0004] It is evident that how to achieve full coverage collection of server in-band and out-of-band logs is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this invention is to provide a method, apparatus, device, and medium for collecting in-band and out-of-band logs from a server, achieving full coverage collection of in-band and out-of-band logs. The specific solution is as follows:
[0006] In a first aspect, the present invention discloses a server in-band and out-of-band log collection method, applied to a server side, wherein the server side includes a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger, wherein the output terminals of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input terminal of the serial port data logger; the method includes:
[0007] Start the basic input / output system and control the basic input / output system to perform initialization and load the bootloader to generate the first out-of-band log of the basic input / output system;
[0008] Control the operation of the operating system to generate in-band logs of the operating system;
[0009] The baseboard management controller is started to generate a second out-of-band log for the baseboard management controller;
[0010] The first out-of-band log, the in-band log, and the second out-of-band log are collected using each preset transmission channel, and the first out-of-band log, the in-band log, and the second out-of-band log are sent in parallel and saved to the non-volatile memory of the serial port data logger.
[0011] Optionally, the basic input / output system includes a CMOS memory, and the output of the basic input / output system is connected to the input of the serial data logger via a three-pin serial port on the motherboard; after controlling the basic input / output system to perform initialization and load the boot program to generate the first out-of-band log of the basic input / output system, the system further includes:
[0012] The first out-of-band log is stored in the CMOS memory;
[0013] Accordingly, the first out-of-band log is collected using a preset transmission channel, and the first out-of-band log is sent and saved to the non-volatile memory of the serial port data logger, including:
[0014] The first out-of-band log is collected from the CMOS memory using the first preset transmission channel corresponding to the three-pin serial port of the motherboard, and the first out-of-band log is sent and saved to the non-volatile memory of the serial port data logger using the first preset transmission channel.
[0015] Optionally, the in-band logs are collected using a preset transmission channel, and the in-band logs are sent and saved to the non-volatile memory of the serial port data logger, including:
[0016] Configure the GRUB configuration file of the operating system and add a log redirection instruction corresponding to the motherboard's three-pin serial port to the kernel boot parameters of the operating system;
[0017] The operating system is controlled to output the in-band log to the motherboard's three-pin serial port based on the log redirection instruction, so as to collect the in-band log using the second preset transmission channel corresponding to the motherboard's three-pin serial port, and send and save the in-band log to the non-volatile memory of the serial port data logger.
[0018] Optionally, the baseboard management controller includes a first non-volatile memory, and the output of the baseboard management controller is connected to the input of the serial data logger via an RS-232 serial port; after controlling the baseboard management controller to start and generate the second out-of-band log of the baseboard management controller, the method further includes:
[0019] Store the second out-of-band log into the first non-volatile memory;
[0020] Accordingly, the second out-of-band log is collected using a preset transmission channel, and the second out-of-band log is sent and saved to the non-volatile memory of the serial port data logger, including:
[0021] The second out-of-band log is collected from the first non-volatile memory using the third preset transmission channel corresponding to the RS-232 serial port, and then sent and saved to the non-volatile memory of the serial port data logger using the third preset transmission channel.
[0022] Optionally, the non-volatile memory of the serial port data logger includes a second non-volatile memory and an SD card; the step of sending and saving the first out-of-band log, the in-band log, and the second out-of-band log in parallel to the non-volatile memory of the serial port data logger includes:
[0023] The first out-of-band log, the in-band log, and the second out-of-band log are sent in parallel and saved to the second non-volatile memory of the serial port data logger;
[0024] Based on the transfer time period in the basic input / output system, determine whether the preset persistent storage conditions are met.
[0025] If the preset persistent storage conditions are met, the serial port data logger is controlled to convert the formats of the first out-of-band log, the in-band log, and the second out-of-band log into synchronous data formats that conform to the I2C protocol or the SPI protocol, respectively, to obtain the converted logs.
[0026] The transformed logs are then subjected to lossless compression to obtain compressed logs.
[0027] The compressed log is transmitted to the SD card via the I2C bus or SPI bus to save the compressed log to the SD card, thereby achieving persistent storage of the compressed log;
[0028] Monitor the current remaining capacity of the SD card. If the current remaining capacity is less than a preset capacity threshold, extend the transfer time period to obtain a new transfer time period and generate a capacity alarm message.
[0029] Optionally, the lossless compression of each of the transformed logs to obtain compressed logs includes:
[0030] Sensitive and non-sensitive logs are identified from the transformed logs, and the sensitive logs are encrypted using the AES-128 encryption algorithm to obtain encrypted sensitive logs.
[0031] The non-sensitive logs and the encrypted sensitive logs are losslessly compressed to obtain compressed logs.
[0032] Optionally, saving the first out-of-band log, the in-band log, and the second out-of-band log to the non-volatile memory of the serial port data logger includes:
[0033] The first out-of-band log, the in-band log, and the second out-of-band log are saved to the non-volatile memory of the serial port data logger, and the timestamps of the saving of the first out-of-band log, the in-band log, and the second out-of-band log are recorded.
[0034] Monitor the current log occupancy rate of the non-volatile memory of the serial port data logger;
[0035] If the current log occupancy rate is greater than the preset occupancy rate threshold, the retention time of each log is determined according to the timestamp of each log in the non-volatile memory.
[0036] Logs in the non-volatile memory whose retention time exceeds a preset time threshold are identified as invalid logs and deleted to free up storage space in the non-volatile memory.
[0037] Secondly, the present invention discloses a server in-band and out-of-band log collection device, applied to a server side. The server side includes a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger, wherein the output terminals of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input terminal of the serial port data logger; the device includes:
[0038] The first log generation module is used to start the basic input / output system and control the basic input / output system to perform initialization and loading of the boot program in order to generate the first out-of-band log of the basic input / output system;
[0039] The second log generation module is used to control the operation of the operating system to generate in-band logs of the operating system;
[0040] The third log generation module is used to control the baseboard management controller to start, so as to generate the second out-of-band log of the baseboard management controller;
[0041] The log collection module is used to collect the first out-of-band log, the in-band log, and the second out-of-band log using each preset transmission channel, and to send the first out-of-band log, the in-band log, and the second out-of-band log in parallel and save them to the non-volatile memory of the serial port data logger.
[0042] Thirdly, the present invention discloses an electronic device, comprising:
[0043] Memory, used to store computer programs;
[0044] A processor for executing computer programs to implement the steps of the aforementioned disclosed server in-band and out-of-band log collection method.
[0045] Fourthly, the present invention discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned server in-band and out-of-band log collection method.
[0046] Therefore, this invention is applied to a server-side application, which includes a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger. The outputs of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input of the serial port data logger. The method includes: starting the basic input / output system and controlling it to initialize and load a bootloader to generate a first out-of-band log; controlling the operating system to run to generate an in-band log; controlling the baseboard management controller to start to generate a second out-of-band log; collecting the first out-of-band log, the in-band log, and the second out-of-band log using preset transmission channels, and sending and storing these logs in parallel in the non-volatile memory of the serial port data logger.
[0047] The beneficial effects are as follows: By connecting the output terminals of the baseboard management controller, basic input / output system, and operating system to the input terminal of the serial data logger, and using preset transmission channels to send three types of logs in parallel to the non-volatile memory of the serial data logger, this invention firstly achieves full coverage collection of server in-band logs (operating system logs) and out-of-band logs (first out-of-band log of basic input / output system and second out-of-band log of baseboard management controller); secondly, the parallel transmission mechanism allows the three types of logs to be synchronously transmitted to the storage terminal through their respective preset transmission channels after generation, without waiting for one type of log to complete before starting another, which shortens the overall log collection time and avoids log timing disorder caused by serial transmission, ensuring... The system ensures log sequence integrity while reducing the risk of log loss due to transmission delays. Furthermore, storing logs in non-volatile memory, which retains data even after power failure, ensures that all three types of collected logs are fully preserved even in the event of server crashes or power outages. Finally, unified collection and storage of logs via a serial port data logger eliminates the need for separate log collection and storage links for the baseboard management controller, basic input / output system, and operating system. This simplifies the hardware architecture and operational procedures for log collection, reducing complexity and maintenance costs. The use of non-volatile memory also reduces reliance on external storage devices, improving the stability and reliability of log storage. Attached Figure Description
[0048] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 A flowchart of a server in-band and out-of-band log collection method provided in an embodiment of the present invention;
[0050] Figure 2 A flowchart illustrating a specific server in-band and out-of-band log collection method provided in this embodiment of the invention;
[0051] Figure 3 This is a schematic diagram of a specific server-side structure provided in an embodiment of the present invention;
[0052] Figure 4 This is a schematic diagram of a server in-band and out-of-band log collection device provided in an embodiment of the present invention;
[0053] Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0055] As core equipment of information technology infrastructure, servers play an irreplaceable role in fault diagnosis, performance optimization and security monitoring through their operation logs. In particular, the complete acquisition of in-band and out-of-band logs directly affects operation and maintenance efficiency and the accuracy of fault location.
[0056] Current log processing and collection solutions mostly focus on centralized storage and automated analysis of in-band logs to meet the complex analysis needs brought about by a large number of application and business logs. However, they pay insufficient attention to out-of-band logs generated at the server hardware level and lack a unified collection architecture that can cover both in-band and out-of-band logs, resulting in significant limitations in log collection.
[0057] The terms "comprising" and "having," and any variations thereof, in the specification and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may include steps or units not listed.
[0058] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0059] Next, we will describe in detail a server in-band and out-of-band log collection scheme provided by an embodiment of the present invention. Figure 1 This invention provides a server-side in-band and out-of-band log collection method, applied to a server-side application. The server-side application includes a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger. The outputs of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input of the serial port data logger. The method includes:
[0060] Step S11: Start the basic input / output system and control the basic input / output system to perform initialization and load the bootloader to generate the first out-of-band log of the basic input / output system.
[0061] The Baseboard Management Controller (BMC), Basic Input Output System (BIOS), and Operating System serve as core components for log generation. Their outputs are all connected to the inputs of a serial data logger. The serial data logger receives and stores the logs from each component. This enables real-time, centralized collection of all logs (BMC startup and operation logs, BIOS startup logs, and operating system startup and operation logs) after the server is powered on. This avoids the limitation of traditional single serial ports that can only output a single log channel, preventing log loss due to system crashes or power outages. It eliminates the need for long-term manual serial port monitoring and allows direct acquisition of all logs in the event of a fault (such as a probabilistic downtime), reducing operational complexity and the cost of fault reproduction. It also provides a complete data foundation for subsequent remote log access and intelligent operation and maintenance analysis.
[0062] In this embodiment, the basic input / output system includes a CMOS memory, and the output terminal of the basic input / output system is connected to the input terminal of the serial data logger through a three-pin serial port on the motherboard. After controlling the basic input / output system to perform initialization and loading of the boot program to generate the first out-of-band log of the basic input / output system, the method further includes: storing the first out-of-band log in the CMOS memory.
[0063] The basic input / output system includes a key storage component: CMOS (omplementary metal-oxide-semiconductor) memory. The BIOS output is connected to the input of the serial data logger via a three-pin serial port on the motherboard, forming a log transmission path. For example... Figure 2As shown, after the BIOS completes the server hardware self-test (POST), system hardware initialization (such as processor, memory, storage devices, etc.) and boot program loading, it generates the first out-of-band log, which reflects this series of processes. This first out-of-band log is then stored in the CMOS memory. As a non-volatile memory of the complementary metal-oxide-semiconductor type, CMOS memory can maintain data through a coin cell battery even when the motherboard is without external power supply, ensuring that the stored first out-of-band log is not lost. Furthermore, the log can be subsequently transmitted to a serial data logger via the motherboard's three-pin serial port for centralized storage. In other words, the non-volatile nature of CMOS memory solves the problem of BIOS log loss due to power outages or system crashes. Especially in the event of server "probabilistic downtime," the BIOS boot log before the downtime can still be completely preserved in the CMOS, providing crucial raw data for R&D and testing personnel to trace the root cause of the fault. Furthermore, the connection between the motherboard's three-pin serial port and the serial data logger utilizes existing server hardware interface resources, avoiding redundant costs from additional hardware modifications, and enables parallel collection of BIOS logs and operating system logs (also output via the three-pin serial port), ensuring the integrity of in- and out-of-band log acquisition without relying on multiple acquisitions through a single serial port, thus improving log collection efficiency and the convenience of fault analysis.
[0064] Step S12: Control the operation of the operating system to generate the in-band log of the operating system.
[0065] For example Figure 2 As shown, the process of controlling the operating system to generate its in-band logs is based on the server startup process. After the server is powered on, the basic input / output system first completes the hardware self-test and hardware initialization. Then the BIOS loads the boot program and loads the operating system from the specified boot device (such as hard drive, optical disc or network). After the operating system starts up and enters normal operation, it will generate in-band logs that reflect its own startup process and running status in real time.
[0066] Step S13: Control the baseboard management controller to start, so as to generate the second out-of-band log of the baseboard management controller.
[0067] In this embodiment, the substrate management controller includes a first non-volatile memory, and the output terminal of the substrate management controller is connected to the input terminal of the serial data logger via an RS-232 serial port; after controlling the substrate management controller to start and generate the second out-of-band log of the substrate management controller, the method further includes: storing the second out-of-band log into the first non-volatile memory.
[0068] The baseboard management controller integrates a first non-volatile memory, which can be an NVM (Non-Volatile Memory). The output of the BMC establishes a dedicated data transmission path with the input of the serial data logger through the RS-232 serial port on the back of the server.
[0069] like Figure 2 As shown, according to the server startup logic, after the basic input / output system completes hardware initialization and bootloader loading, and the operating system starts running, the BMC will start independently. The hardware status monitoring, remote management operations, sensor data, alarm events, and other information generated during the startup process and subsequent operation will be integrated to generate a BMC-specific second out-of-band log. After the second out-of-band log is generated, it will first be stored in the first non-volatile memory integrated into the BMC itself to achieve preliminary local retention of the log. At the same time, the log will be transmitted to the serial data logger in real time through the RS-232 serial port to complete centralized storage.
[0070] On the one hand, the non-volatile nature of the first non-volatile memory (i.e., data is not lost after power failure) ensures that the second out-of-band log generated by the BMC will not be lost due to unexpected power outages, system crashes, or other emergencies. Especially in fault scenarios such as "probabilistic downtime," hardware anomaly data recorded by the BMC before the downtime (such as excessive temperature or unstable voltage) can be completely stored in the first non-volatile memory, providing key hardware-level log support for fault tracing. On the other hand, by connecting to the serial data logger via the RS-232 serial port, the existing hardware interface of the server is utilized, avoiding additional modification costs. It also enables the parallel collection of BMC logs, BIOS logs, and operating system logs, solving the limitation of traditional single serial ports that can only output a single log channel. This ensures the real-time performance and integrity of all in-band and out-of-band logs, reduces reliance on manual physical serial port monitoring, and lowers the complexity of operation and maintenance and the cost of fault reproduction.
[0071] Step S14: Collect the first out-of-band log, the in-band log, and the second out-of-band log using each preset transmission channel, and send the first out-of-band log, the in-band log, and the second out-of-band log in parallel and save them to the non-volatile memory of the serial port data logger.
[0072] In the embodiment of the first out-of-band log storage, the first out-of-band log is collected using a preset transmission channel, and the first out-of-band log is sent and saved to the non-volatile memory of the serial port data logger. This includes: collecting the first out-of-band log from the CMOS memory using the first preset transmission channel corresponding to the motherboard's three-pin serial port, and sending and saving the first out-of-band log to the non-volatile memory of the serial port data logger using the first preset transmission channel. Since the BIOS's first out-of-band log is initially stored in the CMOS memory, and there is a hardware path between the CMOS memory and the motherboard's three-pin serial port, the stored first out-of-band log is first read from the CMOS memory through the first preset transmission channel corresponding to the motherboard's three-pin serial port. After the log collection is completed, relying on the real-time data transmission capability of the first preset transmission channel, the read first out-of-band log is directly sent to the serial port data logger and finally saved to the non-volatile memory built into the serial port data logger. The entire process does not rely on external additional hardware and can be completed only through the collaboration of the server's existing motherboard interface and the serial port data logger. It ensures the integrity and persistence of the first out-of-band log. The non-volatile nature of the CMOS memory prevents log loss due to power failure, while the NVM of the serial data logger further realizes centralized log retention, solving the problem of scattered and easily lost BIOS logs in traditional scenarios. It simplifies the log transmission link by using the motherboard's three-pin serial port as a preset channel, eliminating the need to build additional transmission interfaces and reducing hardware modification costs. At the same time, it ensures that the first out-of-band log and the operating system log (which are also transmitted through the three-pin serial port) can be collected in parallel, improving the efficiency of in-band and out-of-band log collection and providing complete data support for fault analysis.
[0073] In an embodiment of in-band log storage, the in-band logs are collected using a preset transmission channel, and the in-band logs are sent and saved to the non-volatile memory of the serial port data logger. This includes: setting the GRUB configuration file of the operating system and adding a log redirection instruction corresponding to the motherboard's three-pin serial port to the kernel boot parameters of the operating system; controlling the operating system to output the in-band logs to the motherboard's three-pin serial port based on the log redirection instruction, so as to collect the in-band logs using a second preset transmission channel corresponding to the motherboard's three-pin serial port, and send and save the in-band logs to the non-volatile memory of the serial port data logger. During the storage of in-band logs (i.e., operating system startup and runtime logs), the operating system's GRUB configuration file is first configured, and a log redirection instruction corresponding to the motherboard's three-pin serial port is added to the operating system kernel startup parameters. This instruction explicitly directs the output of the in-band logs generated by the operating system (including information such as kernel initialization, driver loading, application process execution, and system resource usage) to the specified hardware interface. Subsequently, the operating system is controlled to start and load the configured kernel parameters. Based on the log redirection instruction, the operating system continuously outputs the real-time generated in-band logs to the motherboard's three-pin serial port. At this time, the second preset transmission channel corresponding to the motherboard's three-pin serial port is activated. The in-band logs output from the serial port are collected in real time through this channel, and the log data is transmitted to the serial port data logger. Finally, the in-band logs are saved to the non-volatile memory built into the serial port data logger, realizing the persistent centralized storage of in-band logs. This solution addresses the issues of low efficiency and susceptibility to interruption in-band log collection. By configuring GRUB and directing kernel parameter output, it ensures that all in-band logs from the operating system's boot phase are transmitted without omission. Furthermore, it utilizes non-volatile memory to prevent log loss due to system crashes or power outages. The motherboard's three-pin serial port is reused as the transmission channel, eliminating the need for additional hardware interfaces and reducing hardware modification costs. Simultaneously, it enables the parallel collection of in-band logs and the BIOS's first out-of-band logs (both transmitted via the three-pin serial port). Combined with centralized storage using a serial data logger, it provides complete in-band and out-of-band log data for fault analysis, reducing manual intervention costs.
[0074] In an embodiment of the second out-of-band log storage, the second out-of-band log is collected using a preset transmission channel, and the second out-of-band log is sent and saved to the non-volatile memory of the serial port data logger. This includes: collecting the second out-of-band log from the first non-volatile memory using a third preset transmission channel corresponding to the RS-232 serial port, and sending and saving the second out-of-band log to the non-volatile memory of the serial port data logger using the third preset transmission channel. During the second out-of-band log storage process, since the second out-of-band log generated by the BMC is first stored in its integrated first non-volatile memory, and the output of the BMC is directly associated with the RS-232 serial port on the back of the server, the second out-of-band log (including hardware status monitoring, remote management events, sensor alarms, and other data) that has been retained is first read from the first non-volatile memory through the third preset transmission channel corresponding to the RS-232 serial port. After the log collection is completed, relying on the stable data transmission capability of the third preset transmission channel, the read second out-of-band log is sent to the serial port data logger in real time, and finally saved to the non-volatile memory built into the serial port data logger, realizing the complete link from local storage to centralized retention of the second out-of-band log. This approach ensures the security and continuity of the second out-of-band log. The non-volatile nature of the first non-volatile memory prevents log loss due to abnormal power outages in the BMC. The dedicated transmission channel of the RS-232 serial port ensures that the log transmission process is not interfered with by other components, solving the problem of limited coverage in traditional out-of-band log collection. It achieves separate transmission and centralized integration of out-of-band and in-band logs. The third preset transmission channel does not conflict with the transmission channels used by the BIOS and operating system logs. It not only utilizes the existing hardware interfaces of the server to reduce modification costs, but also provides complete BMC hardware log support for fault analysis through centralized storage of serial port data loggers, reducing the tedious operation of manually connecting to the serial port to obtain logs.
[0075] In each log storage embodiment, the non-volatile memory of the serial port data logger includes a second non-volatile memory and an SD card; the step of sending and saving the first out-of-band log, the in-band log, and the second out-of-band log in parallel to the non-volatile memory of the serial port data logger includes: sending and saving the first out-of-band log, the in-band log, and the second out-of-band log in parallel to the second non-volatile memory of the serial port data logger; determining whether the current condition for persistent storage is met based on the transfer time period in the basic input / output system; if the current condition for persistent storage is met, controlling the serial port data logger. The formats of the first out-of-band log, the in-band log, and the second out-of-band log are respectively converted into synchronous data formats conforming to I2C or SPI protocol transmission to obtain each converted log; each converted log is losslessly compressed to obtain a compressed log; the compressed log is transmitted to the SD card via the I2C bus or SPI bus to save the compressed log to the SD card, realizing persistent storage of the compressed log; the current remaining capacity of the SD card is monitored, and if the current remaining capacity is less than a preset capacity threshold, the transfer time period is extended to obtain a new transfer time period, and a capacity alarm message is generated.
[0076] like Figure 3As shown, during the storage process of each log, the non-volatile memory of the serial data logger includes a second non-volatile memory and an SD card (Secure Digital Memory Card), forming a two-level storage architecture of "temporary cache-persistent storage". The log storage process is carried out in stages and in an orderly manner: First, the first out-of-band log (BIOS log), the in-band log (operating system log), and the second out-of-band log (BMC log) are sent to the serial data logger in parallel through their respective preset transmission channels (motherboard three-pin serial port, RS-232 serial port), and are temporarily saved in the second non-volatile memory to ensure that the multi-source logs are received in real time without loss; then, based on the preset transfer time period in the basic input / output system, it is determined whether the current persistent storage condition is met. The preset persistent storage condition is, for example, when the current time interval reaches a preset time interval. If the condition is met, the serial data logger is first controlled to convert the format of the three types of logs to conform to the I2C (Inter-Integrated Circuit) protocol or SPI (Serial Bus) protocol respectively. The synchronous data format transmitted via the Peripheral Interface (PERIENT) protocol (to adapt to bus transmission requirements) is used to obtain the converted log. The converted log is then subjected to lossless compression to generate compressed logs to save storage space. The compressed logs are then transmitted to the SD card via the I2C or SPI bus for persistent storage. Simultaneously, the serial data logger monitors the remaining capacity of the SD card in real time. If the remaining capacity is less than a preset capacity threshold (e.g., 10% of the total capacity), the transfer time period is automatically extended to reduce the frequency of log transfers per unit time, and a capacity alarm message is generated to remind maintenance personnel to address storage resource issues promptly.
[0077] In this way, on the one hand, through secondary storage and format conversion and lossless compression technology, the real-time performance of parallel collection of multi-source logs is guaranteed, and storage efficiency is greatly improved, preventing the SD card from being quickly filled up. At the same time, the stable transmission of the I2C / SPI bus ensures that the log persistence process is uninterrupted. On the other hand, through capacity monitoring and dynamic adjustment of transfer cycle and alarm generation mechanism, intelligent management of storage resources is realized, reducing the cost of manual operation and maintenance intervention. Moreover, the centralized persistent storage of the three types of logs provides a reliable data foundation for quickly retrieving the full log for problem analysis after a failure, solving the problems of scattered and easily lost traditional log storage.
[0078] In this embodiment, the lossless compression of each of the transformed logs to obtain compressed logs includes: determining sensitive logs and non-sensitive logs from each of the transformed logs, encrypting the sensitive logs using the AES-128 encryption algorithm to obtain encrypted sensitive logs; and performing lossless compression on the non-sensitive logs and the encrypted sensitive logs to obtain compressed logs.
[0079] First, sensitive and non-sensitive logs are separated from all transformed logs. Sensitive logs may contain information related to system security and privacy, such as server hardware configuration details, BMC remote management permission data, and operating system core parameters. Non-sensitive logs include publicly available data such as routine startup process records and ordinary hardware status feedback. For the selected sensitive logs, AES-128 encryption is used for encryption. A standard encryption process transforms sensitive information into encrypted sensitive logs, preventing unauthorized access during subsequent storage and transmission. Then, both non-sensitive and encrypted sensitive logs are compressed using a lossless compression algorithm, such as DEFLATE, to reduce the log file size without losing any log data, resulting in the compressed logs.
[0080] In this embodiment, saving the first out-of-band log, the in-band log, and the second out-of-band log to the non-volatile memory of the serial port data logger includes: saving the first out-of-band log, the in-band log, and the second out-of-band log to the non-volatile memory of the serial port data logger, and recording the saving timestamps of the first out-of-band log, the in-band log, and the second out-of-band log; monitoring the current log occupancy rate of the non-volatile memory of the serial port data logger; if the current log occupancy rate is greater than a preset occupancy rate threshold, determining the retention duration of each log based on the saving timestamp of each log in the non-volatile memory; determining logs in the non-volatile memory whose retention duration is greater than a preset duration threshold as invalid logs, and deleting the invalid logs to release the storage space of the non-volatile memory.
[0081] First, after the three types of logs are transmitted to the serial data logger through their respective preset transmission channels (motherboard three-pin serial port, RS-232 serial port), they are not only saved to their non-volatile memory, but also their timestamps are recorded synchronously. These timestamps accurately mark the time sequence of log generation and storage, providing a time basis for subsequent log tracing and management. Next, the serial data logger monitors the current log occupancy rate of the non-volatile memory in real time, i.e., the proportion of stored log capacity to the total storage capacity. If the current log occupancy rate exceeds a preset occupancy rate threshold, the retention time of each type of log in the memory is calculated based on the timestamp of each log. The retention time is the difference between the current time and the timestamp. Subsequently, logs with retention times exceeding the preset time threshold are judged as invalid logs, i.e., logs that exceed the retention period required for operation and maintenance and fault analysis. These invalid logs are deleted, thereby freeing up storage space in the non-volatile memory and ensuring that new logs can be continuously and normally stored.
[0082] Furthermore, after storing the logs, they need to be analyzed. First, the BIOS's first out-of-band log, the operating system's in-band log, and the BMC's second out-of-band log stored in the serial data logger are exported to a pre-defined storage node via a secure transmission link (such as an out-of-band management interface based on the BMC). Simultaneously, the exported logs undergo format standardization, including unifying field formats, supplementing timestamp alignment information, and filtering out invalid and redundant data to obtain pre-processed logs. Then, an automated log analysis and processing platform is built based on a big data technology architecture. For example, the distributed storage framework HDFS is used to store massive amounts of logs, and the Spark framework is used for data computation. The pre-processed log data is then connected to the platform's data source module according to preset rules, ensuring that the platform can obtain the pre-processed logs transmitted from the serial data logger in real-time or near real-time. Next, artificial intelligence algorithms are deployed on the platform. The platform employs sophisticated models, such as machine learning-based anomaly detection models and deep learning-based fault classification models, to perform multi-dimensional analysis of log data. By extracting hardware status features (e.g., temperature and voltage data recorded by the BMC) and system operation features (e.g., abnormal process information from the operating system), it identifies hidden problems in the logs (e.g., precursors to hardware failures, system crash risks) and automatically generates a problem identification report. This report includes the problem type, related log segments, and estimated impact range. Finally, the platform displays the problem identification report to R&D, testing, or operations personnel through a visual interface, and also supports pushing alerts via email and SMS to ensure relevant personnel receive log analysis results promptly. This eliminates the need for manual, line-by-line checking of massive amounts of logs, significantly improving the efficiency and accuracy of problem identification and providing technical support for server fault prevention and rapid troubleshooting.
[0083] Therefore, this invention is applied to a server-side application, which includes a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger. The outputs of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input of the serial port data logger. The method includes: starting the basic input / output system and controlling it to initialize and load a bootloader to generate a first out-of-band log; controlling the operating system to run to generate an in-band log; controlling the baseboard management controller to start to generate a second out-of-band log; collecting the first out-of-band log, the in-band log, and the second out-of-band log using preset transmission channels, and sending and storing these logs in parallel in the non-volatile memory of the serial port data logger.
[0084] The beneficial effects are as follows: By connecting the output terminals of the baseboard management controller, basic input / output system, and operating system to the input terminal of the serial data logger, and using preset transmission channels to send three types of logs in parallel to the non-volatile memory of the serial data logger, this invention firstly achieves full coverage collection of server in-band logs (operating system logs) and out-of-band logs (first out-of-band log of basic input / output system and second out-of-band log of baseboard management controller); secondly, the parallel transmission mechanism allows the three types of logs to be synchronously transmitted to the storage terminal through their respective preset transmission channels after generation, without waiting for one type of log to complete before starting another, which shortens the overall log collection time and avoids log timing disorder caused by serial transmission, ensuring... The system ensures log sequence integrity while reducing the risk of log loss due to transmission delays. Furthermore, storing logs in non-volatile memory, which retains data even after power failure, ensures that all three types of collected logs are fully preserved even in the event of server crashes or power outages. Finally, unified collection and storage of logs via a serial port data logger eliminates the need for separate log collection and storage links for the baseboard management controller, basic input / output system, and operating system. This simplifies the hardware architecture and operational procedures for log collection, reducing complexity and maintenance costs. The use of non-volatile memory also reduces reliance on external storage devices, improving the stability and reliability of log storage.
[0085] Figure 4This is a schematic diagram of a server in-band and out-of-band log collection device provided in an embodiment of the present invention. Applied to a server, the server includes a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger. The outputs of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input of the serial port data logger. The device includes:
[0086] The first log generation module 11 is used to start the basic input / output system and control the basic input / output system to perform initialization and loading of the boot program in order to generate the first out-of-band log of the basic input / output system;
[0087] The second log generation module 12 is used to control the operation of the operating system to generate in-band logs of the operating system;
[0088] The third log generation module 13 is used to control the baseboard management controller to start, so as to generate the second out-of-band log of the baseboard management controller;
[0089] The log collection module 14 is used to collect the first out-of-band log, the in-band log, and the second out-of-band log using each preset transmission channel, and to send the first out-of-band log, the in-band log, and the second out-of-band log in parallel and save them to the non-volatile memory of the serial port data logger.
[0090] Furthermore, embodiments of this application also disclose an electronic device, Figure 5 This is a structural diagram of an electronic device according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application. Specifically, the electronic device may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the server in-band and out-of-band log collection method disclosed in any of the foregoing embodiments. Furthermore, the electronic device in this embodiment may specifically be an electronic computer.
[0091] In this embodiment, the power supply 23 is used to provide operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0092] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0093] The operating system 221 is used to manage and control the various hardware devices on the electronic device and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the server in-band and out-of-band log collection method executed by the electronic device as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0094] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned server in-band and out-of-band log collection method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0095] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0096] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0097] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0098] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0099] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only intended to help understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for collecting in-band and out-of-band logs on a server, characterized in that, The method is applied to a server-side application, wherein the server-side includes a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger, wherein the outputs of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input of the serial port data logger; the method includes: Start the basic input / output system and control the basic input / output system to perform initialization and load the bootloader to generate the first out-of-band log of the basic input / output system; Control the operation of the operating system to generate in-band logs of the operating system; The baseboard management controller is started to generate a second out-of-band log for the baseboard management controller; The first out-of-band log, the in-band log, and the second out-of-band log are collected using each preset transmission channel, and the first out-of-band log, the in-band log, and the second out-of-band log are sent in parallel and saved to the non-volatile memory of the serial port data logger.
2. The server in-band and out-of-band log collection method according to claim 1, characterized in that, The basic input / output system includes a CMOS memory, and the output of the basic input / output system is connected to the input of the serial data logger via a three-pin serial port on the motherboard. After controlling the basic input / output system to initialize and load the bootloader to generate the first out-of-band log of the basic input / output system, the system further includes: The first out-of-band log is stored in the CMOS memory; Accordingly, the first out-of-band log is collected using a preset transmission channel, and the first out-of-band log is sent and saved to the non-volatile memory of the serial port data logger, including: The first out-of-band log is collected from the CMOS memory using the first preset transmission channel corresponding to the three-pin serial port of the motherboard, and the first out-of-band log is sent and saved to the non-volatile memory of the serial port data logger using the first preset transmission channel.
3. The server in-band and out-of-band log collection method according to claim 1, characterized in that, Collecting the in-band logs using a preset transmission channel, and sending and saving the in-band logs to the non-volatile memory of the serial port data logger, including: Configure the GRUB configuration file of the operating system and add a log redirection instruction corresponding to the motherboard's three-pin serial port to the kernel boot parameters of the operating system; The operating system is controlled to output the in-band log to the motherboard's three-pin serial port based on the log redirection instruction, so as to collect the in-band log using the second preset transmission channel corresponding to the motherboard's three-pin serial port, and send and save the in-band log to the non-volatile memory of the serial port data logger.
4. The server in-band and out-of-band log collection method according to claim 1, characterized in that, The substrate management controller includes a first non-volatile memory, and the output of the substrate management controller is connected to the input of the serial data logger via an RS-232 serial port. After the step of controlling the baseboard management controller to start and generate the second out-of-band log of the baseboard management controller is completed, the method further includes: Store the second out-of-band log into the first non-volatile memory; Accordingly, the second out-of-band log is collected using a preset transmission channel, and the second out-of-band log is sent and saved to the non-volatile memory of the serial port data logger, including: The second out-of-band log is collected from the first non-volatile memory using the third preset transmission channel corresponding to the RS-232 serial port, and then sent and saved to the non-volatile memory of the serial port data logger using the third preset transmission channel.
5. The server in-band and out-of-band log collection method according to any one of claims 1 to 4, characterized in that, The non-volatile memory of the serial port data logger includes a second non-volatile memory and an SD card; the step of sending and saving the first out-of-band log, the in-band log, and the second out-of-band log in parallel to the non-volatile memory of the serial port data logger includes: The first out-of-band log, the in-band log, and the second out-of-band log are sent in parallel and saved to the second non-volatile memory of the serial port data logger; Based on the transfer time period in the basic input / output system, determine whether the preset persistent storage conditions are met. If the preset persistent storage conditions are met, the serial port data logger is controlled to convert the formats of the first out-of-band log, the in-band log, and the second out-of-band log into synchronous data formats that conform to the I2C protocol or the SPI protocol, respectively, to obtain the converted logs. The transformed logs are then subjected to lossless compression to obtain compressed logs. The compressed log is transmitted to the SD card via the I2C bus or SPI bus to save the compressed log to the SD card, thereby achieving persistent storage of the compressed log; Monitor the current remaining capacity of the SD card. If the current remaining capacity is less than a preset capacity threshold, extend the transfer time period to obtain a new transfer time period and generate a capacity alarm message.
6. The server in-band and out-of-band log collection method according to claim 5, characterized in that, The lossless compression of each of the transformed logs to obtain compressed logs includes: Sensitive and non-sensitive logs are identified from the transformed logs, and the sensitive logs are encrypted using the AES-128 encryption algorithm to obtain encrypted sensitive logs. The non-sensitive logs and the encrypted sensitive logs are losslessly compressed to obtain compressed logs.
7. The server in-band and out-of-band log collection method according to any one of claims 1 to 4, characterized in that, Saving the first out-of-band log, the in-band log, and the second out-of-band log to the non-volatile memory of the serial port data logger includes: The first out-of-band log, the in-band log, and the second out-of-band log are saved to the non-volatile memory of the serial port data logger, and the timestamps of the saving of the first out-of-band log, the in-band log, and the second out-of-band log are recorded. Monitor the current log occupancy rate of the non-volatile memory of the serial port data logger; If the current log occupancy rate is greater than the preset occupancy rate threshold, the retention time of each log is determined according to the timestamp of each log in the non-volatile memory. Logs in the non-volatile memory whose retention time exceeds a preset time threshold are identified as invalid logs and deleted to free up storage space in the non-volatile memory.
8. A server in-band and out-of-band log collection device, characterized in that, The device is applied to a server-side application, comprising a baseboard management controller, a basic input / output system, an operating system, and a serial port data logger, wherein the outputs of the baseboard management controller, the basic input / output system, and the operating system are all connected to the input of the serial port data logger; the device includes: The first log generation module is used to start the basic input / output system and control the basic input / output system to perform initialization and loading of the boot program in order to generate the first out-of-band log of the basic input / output system; The second log generation module is used to control the operation of the operating system to generate in-band logs of the operating system; The third log generation module is used to control the baseboard management controller to start, so as to generate the second out-of-band log of the baseboard management controller; The log collection module is used to collect the first out-of-band log, the in-band log, and the second out-of-band log using each preset transmission channel, and to send the first out-of-band log, the in-band log, and the second out-of-band log in parallel and save them to the non-volatile memory of the serial port data logger.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the server in-band and out-of-band log collection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the server in-band and out-of-band log collection method as described in any one of claims 1 to 7.