Log access method, device and server

By attaching USB storage devices to the server, identifying and configuring their identification and path information, obtaining and storing log data, and regularly pushing them to remote servers, the problem of BMC's difficulty in accessing in-band logs is solved, and log collection efficiency and management convenience are improved.

CN113849135BActive Publication Date: 2025-04-04BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111161921.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-04-04
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

In the prior art, it is difficult for BMC to directly access the in-band logs, resulting in low log collection efficiency.

Method used

By attaching a USB storage device to the server, monitoring the server startup commands and identifying the USB storage device's identification, configuring path information, obtaining and storing log data, and regularly pushing it to the remote server.

Benefits of technology

It realizes that out-of-band servers directly access in-band log data through USB storage devices, improves log collection efficiency and reduces server management overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113849135B_ABST
    Figure CN113849135B_ABST
Patent Text Reader

Abstract

The present invention provides a log access method, device and server, and relates to the technical field of server management. The method comprises: if a startup instruction of a server is monitored, scanning whether a USB storage device is mounted on the current server; if so, identifying an identifier of the USB storage device and configuring corresponding path information for the USB storage device; saving the corresponding relationship between the identifier of the USB storage device and the path information; acquiring log data generated during the operation of the server; storing the log data in the USB storage device; pushing the log data stored in the USB storage device to a remote server according to a preset cycle, so that the remote server can access the log data, and the log data can be synchronized to the USB storage device mounted on the server, so that an out-of-band server can directly access the in-band log data through the USB storage device, thereby improving the efficiency of the out-of-band server in accessing and collecting logs and reducing the management overhead of the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of server management, and in particular to a log access method, device and server. Background Art

[0002] As users' demand for computer computing continues to increase, the types of devices are becoming more and more diverse, and the functions of out-of-band BMC (Baseboard Management Controller) are becoming more and more complex. BMC is a special service processor, and its main purpose is to monitor the normal operation of the server, manage the server, and generate out-of-band logs, etc. The entire server log monitored by BMC is very important information, and the event of accessing the server log through BMC occurs frequently. However, in the prior art, BMC is mostly used to access out-of-band log data, and it is difficult to implement out-of-band BMC to directly access the in-band log, or only simple examples can be implemented, and it is difficult to generalize and promote, so that the log collection efficiency is relatively low. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a log access method, device and server to alleviate the above technical problems.

[0004] In a first aspect, an embodiment of the present invention provides a log access method, which is applied to a server, wherein the server is mounted with a USB storage device, and the method comprises: if a startup instruction of the server is monitored, scanning whether the server is currently mounted with the USB storage device; if so, identifying an identifier of the USB storage device and configuring corresponding path information for the USB storage device; saving the correspondence between the identifier of the USB storage device and the path information; acquiring log data generated during the operation of the server; storing the log data in the USB storage device; and pushing the log data stored in the USB storage device to a remote server according to a preset period, so that the remote server can access the log data.

[0005] Preferably, in a possible implementation manner, the USB storage device is connected to a baseboard management controller BMC of a server.

[0006] Preferably, in a possible implementation manner, at least one service is configured in the above-mentioned server; the method further comprises: configuring the log data storage path of the service as the path information of the USB storage device, so that the log data generated by the service is stored in the USB storage device.

[0007] Preferably, in a possible implementation manner, the above-mentioned step of storing the log data to the USB storage device includes: obtaining the log data storage path configured by the service that generates the log data; if the log data storage path is a storage path pointing to the USB storage device, storing the log data to the USB storage device.

[0008] Preferably, in a possible implementation manner, the step of pushing the log data stored in the USB storage device to the remote server according to a preset period includes: scanning the USB storage device by the BMC according to a preset period to obtain the log data saved in the USB storage device; and pushing the log data scanned by the BMC to the remote server.

[0009] Preferably, in a possible implementation, the above method also includes: after pushing the log data stored in the USB storage device to the remote server according to a preset period, deleting the pushed log data from the USB storage device to clear the memory occupied by the log data in the USB storage device.

[0010] In a second aspect, an embodiment of the present invention further provides a log access method, which is applied to a USB storage device, wherein the USB storage device is mounted on a server, and the method comprises: receiving log data stored by the server, wherein the log data is generated by the server during operation; storing the log data in a disk of the USB storage device, so that the BMC of the server pushes the log data stored in the disk of the USB storage device to a remote server according to a preset period, so that the remote server can access the log data.

[0011] In a third aspect, an embodiment of the present invention further provides a log access device, which is applied to a server, wherein the server is mounted with a USB storage device, and the device comprises: a scanning module, which is used to scan whether the USB storage device is currently mounted on the server if a startup instruction of the server is detected; a configuration module, which is used to identify the identifier of the USB storage device and configure corresponding path information for the USB storage device if yes; a saving module, which is used to save the correspondence between the identifier of the USB storage device and the path information; an acquisition module, which is used to acquire log data generated during the operation of the server; a storage module, which is used to store the log data in the USB storage device; and a push module, which is used to push the log data stored in the USB storage device to a remote server according to a preset period, so that the remote server can access the log data.

[0012] In a fourth aspect, an embodiment of the present invention further provides a log access device, which is applied to a USB storage device, and the USB storage device is mounted on a server. The device includes: a receiving module, which is used to receive log data stored by the server, wherein the log data is generated by the server during operation; a saving module, which is used to store the log data in a disk of the USB storage device, so that the BMC of the server pushes the log data saved in the disk of the USB storage device to a remote server according to a preset period, so that the remote server can access the log data.

[0013] In a fifth aspect, an embodiment of the present invention further provides a server, wherein a baseboard management controller BMC of the server is connected to a USB storage device; wherein the server is used to execute the method described in the first aspect, and the USB storage device is used to execute the method described in the second aspect.

[0014] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the methods described in the first and second aspects.

[0015] The embodiments of the present invention bring the following beneficial effects:

[0016] The log access method, device and server provided by the embodiment of the present invention can scan whether a USB storage device is mounted on the current server when a startup instruction of the server is detected, and identify the identification of the USB storage device when the USB storage device is mounted, and configure corresponding path information for the USB storage device, so as to save the correspondence between the identification of the USB storage device and the path information; obtain log data generated during the operation of the server; and store the log data in the USB storage device mounted on the server, and then push the log data stored in the USB storage device to a remote server according to a preset period, so that the remote server accesses the log data, and the remote server usually refers to an out-of-band server. The above-mentioned method of synchronizing the log data to the USB storage device mounted on the server can realize that the out-of-band server directly accesses the in-band log data through the USB storage device, which not only improves the efficiency of the out-of-band server in accessing and collecting logs, but also reduces the management overhead of the server, which is convenient for promotion and use.

[0017] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0018] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 A flow chart of a log access method provided by an embodiment of the present invention;

[0021] Figure 2 A schematic diagram of an application scenario of a USB storage device provided by an embodiment of the present invention;

[0022] Figure 3 A flowchart of another log access method provided by an embodiment of the present invention;

[0023] Figure 4 A flowchart of another log access method provided by an embodiment of the present invention;

[0024] Figure 5 A schematic diagram of the structure of a log access device provided by an embodiment of the present invention;

[0025] Figure 6 A schematic diagram of the structure of another log access device provided by an embodiment of the present invention;

[0026] Figure 7 A schematic diagram of the structure of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0028] At present, it is difficult to directly access the in-band logs recorded by the out-of-band BMC. Therefore, removable storage media is often used to transmit log data, which not only wastes manpower costs, but also has extremely low log collection efficiency.

[0029] Based on this, a log access method, device and server provided in an embodiment of the present invention can effectively alleviate the above problems and improve the efficiency of log collection.

[0030] To facilitate understanding of this embodiment, a log access method disclosed in an embodiment of the present invention is first introduced in detail.

[0031] In a possible implementation, an embodiment of the present invention provides a log access method. Specifically, the method is applied to a server, wherein the server is connected to a USB storage device, such as Figure 1 A flow chart of a log access method is shown, the method comprising the following steps:

[0032] Step S102, if the server startup instruction is detected, scan whether the current server has a USB storage device mounted; if yes, execute step S104;

[0033] In this step, when the server is started, it can immediately scan whether there is a USB storage device mounted on the server.

[0034] Step S104, identifying the identification of the USB storage device and configuring corresponding path information for the USB storage device;

[0035] The identification of the USB storage device and its corresponding path information may be used to implement the loading process of the USB storage device.

[0036] Step S106, saving the correspondence between the identification of the USB storage device and the path information;

[0037] For a server with a USB storage device attached, the USB storage device can be loaded at startup, so that log data can be stored in the USB storage device in real time during the subsequent operation of the server, and the log data stored in the USB storage device can be pushed to the remote server regularly.

[0038] Step S108, obtaining log data generated during the operation of the server;

[0039] In actual use, there will be various services in the server. When the server is running, these services will generate corresponding log data. These log data are usually one or more log files automatically created and maintained by the server, including a list of activities performed by it, etc., and these log data are usually generated by the HOST motherboard of the server and can be placed in a preset memory. For example, in a Linux server, it can include multiple services, and these services will store logs generated by different applications in the server's disk, etc. In the embodiment of the present invention, since the server is connected with a USB (Universal Serial Bus) storage device, when accessing the log data, the logs generated by various services during the operation of the server can be obtained through the process of the above step S102, and then the process of the following steps S104 and S106 can be continued to be performed to store the log data in the USB storage device, thereby facilitating the remote server to access the log data.

[0040] Step S110, storing the log data in a USB storage device;

[0041] Step S112: Pushing the log data stored in the USB storage device to the remote server according to a preset period, so that the remote server can access the log data.

[0042] In specific implementation, the above-mentioned USB storage device usually has a certain storage space, which is provided to the HOST motherboard of the server as a storage device. Therefore, the log data generated on the HOST motherboard in the server can be stored in the USB storage device for easy access by the remote server.

[0043] The log access method provided by the embodiment of the present invention can scan whether the current server is mounted with a USB storage device when a startup instruction of the server is detected, and identify the identification of the USB storage device when the USB storage device is mounted, and configure corresponding path information for the USB storage device, so as to save the correspondence between the identification of the USB storage device and the path information; obtain log data generated during the operation of the server; and store the log data in the USB storage device mounted on the server, and then push the log data stored in the USB storage device to a remote server according to a preset period, so that the remote server accesses the log data, and the remote server usually refers to an out-of-band server. The above-mentioned method of synchronizing the log data to the USB storage device mounted on the server can realize that the out-of-band server directly accesses the in-band log data through the USB storage device, which not only improves the efficiency of the out-of-band server in accessing and collecting logs, but also reduces the management overhead of the server, which is convenient for promotion and use.

[0044] In actual use, the above-mentioned USB storage device is usually provided by the baseboard management controller BMC of the server. Specifically, the USB storage device can be a storage device external to the BMC, or it can be a storage device simulated only by the server's memory, that is, it is composed of RAM. It can be specifically set according to actual usage, and the embodiment of the present invention is not limited to this.

[0045] Furthermore, the USB storage device generally has a certain storage space to store the log data. Figure 2 A schematic diagram of an application scenario of a USB storage device is shown, including a server and a remote server, wherein the remote server usually refers to an out-of-band log server, and the remote server is connected to the network adapter of the server through a data center link to achieve network connection with the server, and the server is usually also connected to the network through Ethernet technology to achieve network communication.

[0046] like Figure 2 As shown, two HOST_CPUs on the HOST motherboard of the server are taken as an example for explanation. The two HOST_CPU chips are directly interconnected through a UPI (Ultra Path Interconnect) bus, one of the HOST_CPU chips is connected to a PCH (Platform Controller Hub) chip through a DMI (Direct Media Interface) interface, and the baseboard management controller BMC of the server is connected to the PCH chip. The above-mentioned USB storage device in the embodiment of the present invention is connected to the BMC. Specifically, it can be directly connected to the USB interface of the BMC or other matching interfaces through the USB bus, and the BMC is required to convert and map the USB storage device into a USB storage medium provided by the BMC, and then mount it on the motherboard HOST of the server.

[0047] In actual use, the BMC is also configured with a network adapter NIC, which can be connected to the Ethernet through the NIC, thereby realizing communication between the server and an external remote controller.

[0048] based on Figure 2 In the application scenario shown, a server configured with a USB storage device in an embodiment of the present invention generally includes the following functional modules to facilitate access to log data:

[0049] (1) A USB storage device: The USB storage device has a certain storage space and is provided to the host motherboard of the server as a storage device;

[0050] (2) The server host motherboard is configured with a USB driver that matches the USB storage device and related log backup software: the USB driver identifies the USB storage device and maps the identified USB storage device to the server; the log backup software is used to store log data in the USB storage device;

[0051] (3) Server BMC: The BMC accesses the log data in the USB storage device in-band and pushes it to the remote server.

[0052] In specific implementation, based on Figure 2 In the application scenario shown, for the server with a USB storage device mounted thereon, the USB storage device can be loaded upon startup, so that log data can be stored in the USB storage device in real time during operation, and the log data stored in the USB storage device can be pushed to the remote server regularly.

[0053] Furthermore, for the USB storage devices that have been identified by the above-mentioned server, corresponding services can be further configured for them. Usually, these services are application services in the server. During the operation of the server, these services can generate log data. After the USB storage device and the path of the USB storage device are configured for each service, when the service generates log data, the log data can be stored in the USB storage data according to the corresponding path information, thereby realizing the synchronization of the log data.

[0054] In actual use, at least one service is usually configured in the server; therefore, the above log access method also includes: configuring the log data storage path of the service as the path information of the USB storage device, so that the log data generated by the service is stored in the USB storage device.

[0055] In specific implementation, the process of scanning whether a USB storage device is mounted during the startup of the above-mentioned server is executed on the HOST motherboard side of the server. After the server is started, the corresponding USB device will be scanned, and after identifying it as a USB storage device, the corresponding USB storage device can be mounted on a certain path in the server, thereby generating the above-mentioned path information. Different services in the server can choose to store the generated logs in the USB storage device. Therefore, through the above-mentioned process of configuring the log data storage path of the service as the path information of the USB storage device, the log data generated by the service can be stored in the USB storage device, which is convenient for the server's BMC to scan and push log data.

[0056] Based on this, Figure 1 On the basis of Figure 3A flowchart of another log access method is also shown, which illustrates the process of synchronous storage and push of log data. Specifically, Figure 3 As shown, the following steps are included:

[0057] Step S302, obtaining log data generated during the operation of the server;

[0058] Step S304, obtaining the log data storage path configured by the service that generates the log data;

[0059] Step S306, if the log data storage path is a storage path pointing to the USB storage device, the log data is stored in the USB storage device;

[0060] In specific implementation, since the server can identify and save the identification of the USB storage device and configure corresponding path information for the USB storage device when scanning the USB storage device after startup, after configuring the log data storage path of the service as the path information of the USB storage device, the server can associate and store the identification and path information of the USB storage device and the log data storage path of the service. In this way, after a service in the server generates log data, the log data storage path configured by the service that generates the log data can be obtained, and when the log data storage path is a storage path pointing to the USB storage device mounted on the server, the log data is stored in the USB storage device.

[0061] Furthermore, the above log data is usually generated on the HOST motherboard of the server and can be stored in the RAM, such as dmesg; it can also be stored in the disk on the host side, such as the message of the Linux system, etc. In the Linux server, for various services, the logs generated by different applications can be first stored in the server's disk, and the log data can be stored in the above USB storage device at the same time, so that the server's BMC can further access and push the logs stored in the USB storage device according to the following process.

[0062] Step S308, scanning the USB storage device according to a preset period by the BMC to obtain the log data stored in the USB storage device;

[0063] Step S310: Push the log data scanned by the BMC to the remote server.

[0064] Specifically, in the above step S310, when pushing the log data, a polling push method, an interrupt push method, or direct push according to a certain period, etc. can be adopted. The specific setting can be made according to the actual usage, and the embodiment of the present invention does not limit this.

[0065] Furthermore, for the log data stored in the USB storage device, after the BMC pushes the log data stored in the USB storage device to the remote server according to a preset period, the pushed log data can also be deleted from the USB storage device to clear the memory occupied by the log data in the USB storage device, so that the USB storage device can continue to store the daily data generated by the server later, avoiding the log data that has been pushed and accessed in the early stage from continuing to occupy the storage space of the USB storage device, which not only helps to reduce the storage cost of the log data, but also saves a certain amount of management overhead.

[0066] Further, based on the above implementation, an embodiment of the present invention also provides a log access method, which is applied to a USB storage device. Specifically, the USB storage device is mounted on a server, such as Figure 4 A flowchart of another log access method is shown, the method comprising the following steps:

[0067] Step S402, receiving log data stored in the server, wherein the log data is generated during the operation of the server;

[0068] Step S404, storing the log data in the disk of the USB storage device, so that the BMC of the server pushes the log data stored in the disk of the USB storage device to the remote server according to a preset period, so that the remote server can access the log data.

[0069] Specifically, the USB storage device is provided by the baseboard management controller BMC of the server, and the USB storage device is connected to the USB bus interface of the PCH of the server and has a certain storage space, for example, Figure 2 In the application scenario of the USB storage device shown, the USB storage device provided by the BMC is directly connected to the PCH through the USB bus, so that the log data generated by the HOST motherboard of the server can be stored in the USB storage device provided by the BMC. The BMC can also scan this USB storage device regularly and push the log data to the remote server through the NIC, so that the remote server can access the log data.

[0070] Further, corresponding to Figure 1 or Figure 3 The log access method shown in the embodiment of the present invention also provides a log access device, which is applied to a server, and the server is connected to a USB storage device, specifically, as shown in FIG. Figure 5 A schematic diagram of the structure of a log access device is shown, the device comprising:

[0071] The scanning module 50 is used to scan whether a USB storage device is mounted on the current server if a startup instruction of the server is detected;

[0072] Configuration module 51, for identifying the identification of the USB storage device and configuring corresponding path information for the USB storage device if yes;

[0073] A storage module 52 is used to store the corresponding relationship between the identification of the USB storage device and the path information;

[0074] The acquisition module 53 is used to acquire the log data generated during the operation of the server;

[0075] Storage module 54, used to store log data to a USB storage device;

[0076] The push module 55 is used to push the log data stored in the USB storage device to the remote server according to a preset period, so that the remote server can access the log data.

[0077] Further, the USB storage device is connected to a baseboard management controller BMC of the server.

[0078] Further, at least one service is configured in the server;

[0079] The configuration module is also used to configure the log data storage path of the service as the path information of the USB storage device, so that the log data generated by the service is stored in the USB storage device.

[0080] Furthermore, the storage module is specifically used for:

[0081] Get the log data storage path configured by the service that generates log data;

[0082] If the log data storage path is a storage path pointing to a USB storage device, the log data is stored in the USB storage device.

[0083] Furthermore, the push module is specifically used for:

[0084] Scan the USB storage device through the BMC according to the preset period to obtain the log data saved in the USB storage device;

[0085] Push the log data scanned by the BMC to the remote server.

[0086] Furthermore, the device also includes:

[0087] The deleting module is used to push the log data stored in the USB storage device to the remote server according to a preset period, and then delete the pushed log data from the USB storage device to clear the memory occupied by the log data in the USB storage device.

[0088] The log access device provided in the embodiment of the present invention has the same technical features as the log access method provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0089] Corresponds to Figure 4 The log access method shown in the embodiment of the present invention also provides another log access device, which is applied to a USB storage device, and the USB storage device is mounted on a server, such as Figure 6 A schematic diagram of the structure of another log access device is shown, the device comprising:

[0090] A receiving module 60, configured to receive log data stored in the server, wherein the log data is generated during operation of the server;

[0091] The saving module 62 is used to store the log data in the disk of the USB storage device, so that the BMC of the server pushes the log data saved in the disk of the USB storage device to the remote server according to a preset period, so that the remote server can access the log data.

[0092] The log access device provided in the embodiment of the present invention has the same technical features as the log access method and device provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0093] Furthermore, an embodiment of the present invention also provides a server, wherein a baseboard management controller BMC of the server is connected to a USB storage device; wherein the server is used to execute Figure 1 or Figure 3 The method shown in the figure, the USB storage device is used to execute Figure 4 The method shown is used to enable the remote server to access the log data.

[0094] Furthermore, an embodiment of the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned log access method.

[0095] Furthermore, the embodiment of the present invention also provides a schematic diagram of the structure of a server, such as Figure 7 As shown, it is a schematic diagram of the structure of the server, wherein the server includes a processor 71 and a memory 70, the memory 70 stores computer executable instructions that can be executed by the processor 71, and the processor 71 executes the computer executable instructions to implement the above-mentioned log access method.

[0096] exist Figure 7 In the illustrated embodiment, the server further includes a bus 72 and a communication interface 73 , wherein the processor 71 , the communication interface 73 and the memory 70 are connected via the bus 72 .

[0097] Among them, the memory 70 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 73 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 72 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 72 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0098] The processor 71 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 71 or the instructions in the form of software. The above processor 71 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 71 reads the information in the memory and completes the log access method of the above embodiment in combination with its hardware.

[0099] The computer program product of the log access method, device and server provided in the embodiments of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be referred to the method embodiment, which will not be repeated here.

[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the server and the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0101] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0103] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0104] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A log access method, characterized in that: Applied to a server, the server is connected to a USB storage device, and the method comprises: If a startup instruction of the server is detected, scanning whether the USB storage device is currently mounted on the server; If yes, identify the identifier of the USB storage device and configure corresponding path information for the USB storage device; Saving the correspondence between the identifier of the USB storage device and the path information; Obtaining log data generated during the operation of the server; Storing the log data in the USB storage device; Pushing the log data stored in the USB storage device to a remote server according to a preset period, so that the remote server can access the log data; At least one service is configured in the server; the method further comprises: configuring the log data storage path of the service as the path information of the USB storage device, so that the log data generated by the service is stored in the USB storage device; The step of storing the log data in the USB storage device comprises: acquiring a log data storage path configured by a service that generates the log data; and if the log data storage path is a storage path pointing to the USB storage device, storing the log data in the USB storage device.

2. The method according to claim 1, characterized in that: The USB storage device is connected to a baseboard management controller BMC of the server.

3. The method according to claim 2, characterized in that The step of pushing the log data stored in the USB storage device to a remote server according to a preset period includes: Scanning the USB storage device according to a preset period by the BMC to obtain the log data stored in the USB storage device; The log data scanned by the BMC is pushed to a remote server.

4. The method according to claim 3, characterized in that The method further comprises: After the log data stored in the USB storage device is pushed to the remote server according to a preset period, the pushed log data is deleted from the USB storage device to clear the memory occupied by the log data in the USB storage device.

5. A log access method, characterized in that: Applied to a USB storage device, the USB storage device is mounted on a server, and the method includes: Receiving log data stored by the server, wherein the log data is generated during the operation of the server; The log data is stored in the disk of the USB storage device, so that the BMC of the server pushes the log data stored in the disk of the USB storage device to the remote server according to a preset period, so that the remote server can access the log data; At least one service is configured in the server; the server is used to: configure the log data storage path of the service as the path information of the USB storage device, so that the log data generated by the service is stored in the USB storage device; obtain the log data storage path configured by the service that generates the log data; if the log data storage path is a storage path pointing to the USB storage device, store the log data in the USB storage device.

6. A log access device, characterized in that: Applied to a server, the server is connected with a USB storage device, and the device comprises: A scanning module, for scanning whether the USB storage device is currently mounted on the server if a startup instruction of the server is detected; a configuration module, for, if yes, identifying the identifier of the USB storage device and configuring corresponding path information for the USB storage device; A saving module, used for saving the corresponding relationship between the identification of the USB storage device and the path information; An acquisition module is used to acquire log data generated during the operation of the server; A storage module, used for storing the log data in the USB storage device; A push module, used for pushing the log data stored in the USB storage device to a remote server according to a preset period, so that the remote server can access the log data; At least one service is configured in the server; the configuration module is also used to configure the log data storage path of the service as the path information of the USB storage device, so that the log data generated by the service is stored in the USB storage device; The storage module is specifically used for: obtaining the log data storage path configured by the service generating the log data; if the log data storage path is a storage path pointing to the USB storage device, storing the log data in the USB storage device.

7. A log access device, characterized in that: Applied to a USB storage device, the USB storage device is mounted on a server, and the device comprises: A receiving module, used to receive log data stored in the server, wherein the log data is generated during the operation of the server; A saving module, used for storing the log data in the disk of the USB storage device, so that the BMC of the server pushes the log data saved in the disk of the USB storage device to the remote server according to a preset period, so that the remote server can access the log data; At least one service is configured in the server; the server is used to: configure the log data storage path of the service as the path information of the USB storage device, so that the log data generated by the service is stored in the USB storage device; obtain the log data storage path configured by the service that generates the log data; if the log data storage path is a storage path pointing to the USB storage device, store the log data in the USB storage device.

8. A server, characterized in that: The baseboard management controller BMC of the server is connected to a USB storage device; The server is used to execute the method according to any one of claims 1 to 4, and the USB storage device is used to execute the method according to claim 5.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Log file storage method and device, electronic device and storage medium

    CN108509317A

  • Remote out-of-band SSD log information query method and device and BMC

    CN111176967A