Server log reporting control method and device, storage medium and electronic device

By adding control code to the BIOS system source code and dynamically adjusting the log reporting function according to the resource load status, the problem of the lack of flexibility in the control options of the server log reporting function is solved. Flexible control of the log reporting function is achieved without restarting the server, which improves the stability of the system and the efficiency of resource utilization.

CN119440956BActive Publication Date: 2026-04-21INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2024-11-05
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, the control options for server log reporting functions lack flexibility, leading to system performance degradation or even crashes under high load or resource-constrained environments. Furthermore, adjusting the log reporting function in a continuously running server environment requires restarting the system or upgrading the BIOS, making flexible control impossible.

Method used

During server operation, multiple control code segments are added to the BIOS system source code, compiled into target file types, and filtered and written to the target storage according to the server resource load status. This enables dynamic adjustment of log control options, including reading, enabling, and disabling log reporting functions.

Benefits of technology

It enables intelligent adjustment of log reporting based on resource load status without restarting the server, improving the flexibility of server log reporting control options and avoiding system performance degradation and crashes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440956B_ABST
    Figure CN119440956B_ABST
Patent Text Reader

Abstract

This application discloses a server log reporting control method, apparatus, storage medium, and electronic device. The server log reporting control method includes: deploying a target memory in the server; running an operating system and a basic input / output system in the server; the basic input / output system executing files in the target memory; and applying the method to the operating system, including: adding multiple control code segments to the system source code of the basic input / output system while the server is running server services, obtaining multiple reference system codes; compiling the multiple reference system codes to obtain multiple reference control files of target file types; selecting a target control file from the multiple reference control files that matches the current resource load state of the server; and writing the target control file into the target memory. This solves the problem of lack of flexibility in adjusting control options for server log reporting functions in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a method and apparatus for controlling the reporting of server logs, a storage medium, and an electronic device. Background Technology

[0002] In today's information technology era, the stability and reliability of server systems are crucial for business operations. Especially in cloud computing and big data processing, systems need to continuously process massive amounts of data, and any performance bottlenecks or stability issues can lead to significant economic losses. Therefore, the ability to monitor and adjust system performance in real time, particularly the detection and reporting of memory errors, is essential for maintaining efficient system operation.

[0003] In existing technologies, the server log reporting function is enabled by default after the server system starts up and cannot be changed during server operation. This means that all error logs generated by the server system are uploaded to the administrator in real time. However, continuous logging consumes significant system resources, impacting system performance, especially under high load or resource-constrained environments. This resource consumption can lead to performance degradation or even system crashes. Typically, if an administrator wants to disable the server log reporting function after the server system boots up, they must restart the system or upgrade the BIOS (Basic Input Output System) to adjust the status, which is impractical for server environments requiring 24 / 7 operation.

[0004] There is still no effective solution to the problem that the control options for server log reporting functions lack flexibility in the way they can be adjusted. Summary of the Invention

[0005] This application provides a method and apparatus for controlling server log reporting, a storage medium, and an electronic device, to at least solve the problem of the lack of flexibility in adjusting the control options of server log reporting functions in related technologies.

[0006] According to one embodiment of this application, a method for controlling the reporting of server logs is provided. A target storage device is deployed in the server, and an operating system and a basic input / output system run on the server. The basic input / output system is used to execute files in the target storage device. The method is applied to the operating system and includes:

[0007] When the server is running server services, multiple control code segments are added to the system source code of the basic input / output system to obtain multiple reference system codes. Each control code segment records a control operation of the log control option in the basic input / output system.

[0008] Compile multiple copies of the reference system code to obtain multiple reference control files of target file type, wherein the target file type files are files that the basic input / output system allows to execute, and each of the multiple reference control files is used to indicate the corresponding control operation to be performed on the log control option, and the log control option is used to indicate whether the server calls server resources to report server logs;

[0009] A target control file that matches the current resource load status of the server is selected from a plurality of reference control files, wherein the resource load status is used to indicate the current resource occupancy of the server.

[0010] Write the target control file into the target memory.

[0011] Optionally, the step of adding multiple control code segments to the system source code of the basic input / output system to obtain multiple reference system codes includes:

[0012] The target function code for implementing the target function is located from the system source code. The target function is an independently executable function, which allows the system management task to be executed independently. The target function code is the code in the system source code that is allowed to be modified.

[0013] Multiple control code segments are added to the target function code of the system source code to obtain multiple reference system codes.

[0014] Optionally, the step of adding multiple control code segments to the target function code of the system source code to obtain multiple reference system codes includes:

[0015] Adding read control code to the target function code of the system source code yields system read code, wherein multiple control code segments include the read control code, and the read control code records the status read operation of the log control option, the status read operation being used to read the current status of the log control option; multiple reference system code segments include the system read code; and / or adding enable control code to the target function code of the system source code yields system enable code, wherein multiple control code segments include the enable control code, the enable control code records the status enable operation of the log control option, the status enable operation being used to switch the log control option from its current state to enabled. The log control option in the enabled state is used to instruct the server to call server resources to report server logs. Multiple reference system code documents include the system enable code; and / or the disable control code is added to the target function code in the system source code to obtain the system disable code. The multiple control code documents include the disable control code. The disable control code records the status disable operation of the log control option. The status disable operation is used to switch the log control option from the current state to the disable state. The log control option in the disable state is used to instruct the server to prohibit calling server resources to report server logs. Multiple reference system code documents include the system disable code.

[0016] Optionally, compiling multiple copies of the reference system code yields reference control files of multiple object file types, including:

[0017] Compile multiple copies of the reference system code to obtain multiple initial control files of reference file types, wherein the reference file types are files that the operating system allows to be executed;

[0018] The type conversion script is invoked to convert the multiple initial control files into the target file type, thereby obtaining the multiple reference control files of the target file type.

[0019] Optionally, compiling multiple copies of the reference system code yields reference control files of multiple object file types, including:

[0020] The compilation system reads the code to obtain a reference read control file of the target file type. Multiple copies of the reference system code include the system read code, which is obtained by adding read control code to the target function code of the system source code. Multiple segments of the control code include the read control code, which records the status read operation of the log control option. The status read operation is used to read the current status of the log control option. The target function code is the code in the system source code that is allowed to be modified. The reference control file includes the reference read control file. And / or the compilation system enables the code to obtain a reference enable control file of the target file type. Multiple copies of the reference system code include the system enable code, which is obtained by adding enable control code to the target function code of the system source code. Multiple segments of the control code include the enable control code. The aforementioned enable control code records the enable operation of the log control option, which is used to switch the log control option from its current state to an enable state. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference enable control file. And / or compile system disable code to obtain a reference disable control file of the target file type, wherein multiple copies of the reference system code include the system disable code, which is obtained by adding the disable control code to the target function code of the system source code; multiple segments of the control code include the disable control code, which records the disable operation of the log control option, which is used to switch the log control option from its current state to a disable state. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference disable control file.

[0021] Optionally, the step of filtering out a target control file that matches the current resource load state of the server from a plurality of reference control files includes:

[0022] When the resource load state is a first load state, the reference shutdown control file and the reference read control file among the multiple reference control files are determined as the target control file. The first load state is used to indicate that the current server resource occupancy parameter in the server is greater than the target parameter threshold. The reference shutdown control file is used to perform the state shutdown operation. The reference read control file is used to perform the state read operation after the state shutdown operation is completed.

[0023] When the resource load state is in the second load state, the reference enable control file and the reference read control file among the multiple reference control files are determined as the target control file. The second load state is used to indicate that the current server resource occupancy parameter in the server is less than or equal to the target parameter threshold. The reference enable control file is used to perform the state enable operation. The reference read control file is used to perform the state read operation after the state enable operation is completed.

[0024] Optionally, before filtering out the target control file that matches the current resource load state of the server from the plurality of reference control files, the method further includes:

[0025] The system detects the current resource load rate of the server; if the resource load rate is greater than a target load rate threshold, it determines the current resource load state of the server as a first load state; if the resource load rate is less than or equal to the target load rate threshold, it determines the current resource load state of the server as a second load state; or it receives a control command currently input by the target account; if a first control command is detected, it determines the current resource load state of the server as a first load state; if a second control command is detected, it determines the current resource load state of the server as a second load state, wherein the first control command is used to instruct the logging control option to perform the state disable operation, and the second control command is used to instruct the logging control option to perform the state enable operation.

[0026] According to another embodiment of the present application, a server log reporting control device is also provided. A target storage device is deployed in the server, and an operating system and a basic input / output system run in the server. The basic input / output system is used to execute files in the target storage device. The device is applied to the operating system and includes:

[0027] An add module is used to add multiple control code segments to the system source code of the basic input / output system when the server is running server services, resulting in multiple reference system codes. Each control code segment records a control operation of the log control option in the basic input / output system.

[0028] The compilation module is used to compile multiple copies of the reference system code to obtain multiple reference control files of target file types, wherein the target file type files are files that the basic input / output system allows to execute, and each of the multiple reference control files is used to indicate the corresponding control operation to be performed on the log control option, and the log control option is used to indicate whether the server calls server resources to report server logs;

[0029] A filtering module is used to filter out a target control file that matches the current resource load status of the server from a plurality of reference control files, wherein the resource load status is used to indicate the current server resource occupancy in the server;

[0030] A writing module is used to write the target control file into the target memory.

[0031] According to yet another embodiment of this application, a computer program product is also provided, including a computer program that is executed by a processor through the steps of any of the above method embodiments.

[0032] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0033] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0034] This application proposes a server log reporting control method. A target storage device is deployed on the server, which runs an operating system and a Basic Input / Output System (BIOS). The BIOS can execute files in the target storage device. When the server is running server services, the operating system first adds multiple control code segments to the BIOS's system source code, resulting in multiple reference system codes. Each control code segment records a control operation for a log control option in the BIOS. Then, the multiple reference system codes are compiled to obtain multiple reference control files of target file type. These target file type files are executable files allowed by the BIOS. Each reference control file can instruct the execution of a corresponding control operation for the log control option. The log control option can indicate whether the server should call server resources to report service logs. Server logs; finally, a target control file matching the current resource load status of the server is selected from multiple reference control files. The resource load status indicates the current resource occupancy of the server. The target control file is then written to the target storage. In the above control method, even when the server is running server business, control code is written into the basic input / output system through the operating system to adjust log control options without restarting the server or interrupting business operation. Furthermore, by selecting a target control file matching the current resource load status based on the server resource load status, an intelligent server log reporting control method is achieved. By adopting the above technical solution, the problem of lack of flexibility in the adjustment method of control options for server log reporting function in related technologies is solved, and the technical effect of improving the flexibility of the adjustment method of control options for server log reporting function is achieved. Attached Figure Description

[0035] Figure 1 This is a hardware structure block diagram of a computer device for a server log reporting control method according to an embodiment of this application;

[0036] Figure 2 This is a flowchart of a server log reporting control method according to an embodiment of this application;

[0037] Figure 3 This is a schematic diagram of a server structure according to an embodiment of this application;

[0038] Figure 4 This is a schematic diagram of a flowchart of a server log reporting control instruction according to an embodiment of this application;

[0039] Figure 5 This is a schematic diagram of a server log reporting control flow according to an embodiment of this application;

[0040] Figure 6This is a structural block diagram of a server log reporting control device according to an embodiment of this application;

[0041] Figure 7 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0042] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0043] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0044] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure block diagram of a computer device for a server log reporting control method according to an embodiment of this application. For example... Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The server device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0045] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the server log reporting control method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the server device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0046] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the server device. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0047] This embodiment provides a method for controlling the reporting of server logs. A target storage device is deployed on the server, which runs an operating system and a basic input / output system. The basic input / output system is used to execute files in the target storage device, and the method is applied to the operating system. Figure 2 This is a flowchart of a server log reporting control method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0048] Step S12: When the server is running server services, multiple control code segments are added to the system source code of the basic input / output system to obtain multiple reference system codes. Each control code segment records a control operation of the log control option in the basic input / output system.

[0049] Step S14: Compile multiple copies of the reference system code to obtain multiple reference control files of target file type, wherein the target file type files are files that the basic input / output system allows to execute, and each of the multiple reference control files is used to indicate the corresponding control operation to be performed on the log control option, and the log control option is used to indicate whether the server calls server resources to report server logs;

[0050] Step S16: Select a target control file that matches the current resource load status of the server from among the multiple reference control files, wherein the resource load status is used to indicate the current server resource occupancy in the server.

[0051] Step S18: Write the target control file into the target memory.

[0052] Optionally, in this embodiment, Figure 3 This is a schematic diagram of a server structure according to an embodiment of this application, such as... Figure 3As shown, the server may, but is not limited to, deploy components including an operating system, a basic input / output system, and target memory. The operating system may be Linux, Windows Server, or Unix, etc.; the basic input / output system is the BIOS; the target memory is any type of memory used to store and run data, including RAM (Random Access Memory), SSD (Solid State Drive), and DRAM (Dynamic Random Access Memory), etc. Data / files may, but are not limited to, be transferred between the operating system and the basic input / output system through the target memory.

[0053] Optionally, in this embodiment, the SCI (SMM Code Injection) function is enabled in the BIOS. The SCI function allows the operating system to inject specific code into the BIOS's SMM (System Management Mode) when the system is restarted without errors. In SMM mode, the system can perform some low-level operations that were originally read-only and could not be updated in the system.

[0054] Optionally, in this embodiment, assuming there are three control code segments, namely code A0 (read), code B0 (enable), and code C0 (disable), the operating system adds the above three code segments to the SCI function module of the BIOS source code, respectively, to obtain three reference system codes: code A1 (read), code B1 (enable), and code C1 (disable). Compiling the three reference system codes yields three reference control files of target file types: file A1 (performs a read operation on the log control option), file B1 (performs an enable operation on the log control option), and file C1 (performs a disable operation on the log control option). The log control option can indicate whether the server is allowed to use server resources to report server logs, and the target file type indicates the file type that can be executed by the BIOS system, such as the .cap type.

[0055] Optionally, in this embodiment, based on the current server resource occupancy, files matching the current resource load status of the server are selected from files A1, B1, and C1 as target control files, and then the target control files are written into the target storage.

[0056] As an optional approach, multiple control code segments are added to the system source code of the basic input / output system to obtain multiple reference system codes, including:

[0057] S21, Locate the target function code for implementing the target function from the system source code, wherein the target function is an independently executable function, and functions of the independently executable type are allowed to independently execute system management tasks, and the target function code is code in the system source code that is allowed to be modified;

[0058] S22, the multiple control code segments are added to the target function code of the system source code to obtain multiple reference system codes.

[0059] Optionally, in this embodiment, the operating system adds the control code, namely code A0 (read), code B0 (enable), and code C0 (disable), to the SCI function module of the BIOS source code to obtain three reference system codes. This can be done, but is not limited to, as follows: In the BIOS system source code, identify the code block that can independently perform system management tasks and is allowed to be modified, i.e., the target function code. Then, add code A0 (read), code B0 (enable), and code C0 (disable) to the code block located above, respectively, to obtain the reference system codes: code A1 (read), code B1 (enable), and code C1 (disable).

[0060] As an optional approach, the multiple control code segments are respectively added to the target function code of the system source code to obtain multiple reference system codes, including:

[0061] S31, add the read control code to the target function code of the system source code to obtain system read code, wherein multiple control code segments include the read control code, the read control code records the status read operation of the log control option, the status read operation is used to read the current status of the log control option, and multiple reference system code segments include the system read code; and / or S32, add the enable control code to the target function code of the system source code to obtain system enable code, wherein multiple control code segments include the enable control code, the enable control code records the status enable operation of the log control option, the status enable operation is used to switch the log control option from the current state to... In the enabled state, the log control option in the enabled state is used to instruct the server to call server resources to report server logs. Multiple reference system codes include the system enable code; and / or S33, add the disable control code to the target function code of the system source code to obtain the system disable code, wherein multiple control codes include the disable control code, the disable control code records the status disable operation of the log control option, the status disable operation is used to switch the log control option from the current state to the disable state, the log control option in the disable state is used to instruct the server to prohibit calling server resources to report server logs, and multiple reference system codes include the system disable code.

[0062] Optionally, in this embodiment, the read control code can indicate the current state of the read log control option, and can be, but is not limited to, code A0. Adding code A0 to the target function code in the BIOS system yields the system read code, which can be, but is not limited to, code A1. The enable control code can indicate switching the log control option from its current state to the enable state, i.e., allowing the server to call server resources to report server logs, and can be, but is not limited to, code B0. Adding code B0 to the target function code in the BIOS system yields the system enable code, which can be, but is not limited to, code B1. The disable control code can indicate switching the log control option from its current state to the disable state, i.e., prohibiting the server from calling server resources to report server logs, and can be, but is not limited to, code C0. Adding code C0 to the target function code in the BIOS system yields the system disable code, which can be, but is not limited to, code C1.

[0063] As an optional approach, multiple copies of the reference system code are compiled to obtain reference control files of multiple object file types, including:

[0064] S41, compile multiple copies of the reference system code to obtain multiple initial control files of reference file types, wherein the reference file types are files that the operating system allows to be executed;

[0065] S42, call the type conversion script to convert the multiple initial control files into the target file type, and obtain the multiple reference control files of the target file type.

[0066] Optionally, in this embodiment, three reference system codes are compiled to obtain three initial control files of reference file types: file A0 (performs a read operation on the log control option), file B0 (performs an enable operation on the log control option), and file C0 (performs a disable operation on the log control option). Then, a type conversion script is called to convert the initial control files into reference control files of target file types: file A1, file B1, and file C1. The reference file type represents a file type that can be executed by the operating system (such as EFI type), and the target file type represents a file type that can be executed by the BIOS system (such as CAP type). For example, the compilation process can be as follows: first, the three reference system codes are compiled into three EFI type files (file A0, file B0, and file C0), and then the GenerateCapsule script (equivalent to the above type conversion script) is used to package the EFI type files and related data into CAP type files (file A1, file B1, and file C1).

[0067] As an optional approach, multiple copies of the reference system code are compiled to obtain reference control files of multiple object file types, including:

[0068] S51, the compilation system reads the code to obtain a reference read control file of the target file type, wherein multiple copies of the reference system code include the system read code, which is obtained by adding the read control code to the target function code of the system source code, multiple segments of the control code include the read control code, the read control code records the status read operation of the log control option, the status read operation is used to read the current status of the log control option, the target function code is the code in the system source code that is allowed to be modified, and the reference control file includes the reference read control file; and / or S52, the compilation system enables the code to obtain a reference enable control file of the target file type, wherein multiple copies of the reference system code include the system enable code, which is obtained by adding enable control code to the target function code of the system source code, and multiple segments of the control code include the enable control code. The enable control code records the enable operation of the log control option, which is used to switch the log control option from its current state to the enable state. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference enable control file. And / or S53, compile the system disable code to obtain a reference disable control file of the target file type, wherein multiple copies of the reference system code include the system disable code, which is obtained by adding the disable control code to the target function code of the system source code; multiple segments of the control code include the disable control code; the disable control code records the disable operation of the log control option, which is used to switch the log control option from its current state to the disable state; the target function code is code in the system source code that is allowed to be modified; and the reference control file includes the reference disable control file.

[0069] Optionally, in this embodiment, the code read by the compilation system may be, but is not limited to, compilation code A1, and the reference read control file may be, but is not limited to, file A1; the code to enable the compilation system may be, but is not limited to, compilation code B1, and the reference enable control file may be, but is not limited to, file B1; the code to disable the compilation system may be, but is not limited to, compilation code C1, and the reference disable control file may be, but is not limited to, file C1.

[0070] As an optional approach, selecting a target control file from the plurality of reference control files that matches the current resource load status of the server includes:

[0071] S61, when the resource load state is a first load state, the reference shutdown control file and the reference read control file among the multiple reference control files are determined as the target control file, wherein the first load state is used to indicate that the current server resource occupancy parameter in the server is greater than the target parameter threshold, the reference shutdown control file is used to perform the state shutdown operation, and the reference read control file is used to perform the state read operation after the state shutdown operation is completed;

[0072] S62, when the resource load state is the second load state, the reference start control file and the reference read control file among the multiple reference control files are determined as the target control file, wherein the second load state is used to indicate that the current server resource occupancy parameter in the server is less than or equal to the target parameter threshold, the reference start control file is used to perform the state start operation, and the reference read control file is used to perform the state read operation after the state start operation is completed.

[0073] Optionally, in this embodiment, the method of selecting files from files A1, B1, and C1 that match the current resource load status of the server as target control files based on the current server resource occupancy can be, but is not limited to, as follows: A preset threshold for judging server resource occupancy is 80%, i.e., the target parameter threshold is 80%. When the current server resource occupancy parameter is greater than 80%, the operating system determines the current state as a first load state and selects files C1 and A1 as target control files, i.e., prohibits the server from calling server resources to report server logs and reads the current status of the log control options; when the current server resource occupancy parameter is less than or equal to 80%, the operating system determines the current state as a second load state and selects files B1 and A1 as target control files, i.e., allows the server to call server resources to report server logs and read the current status of the log control options.

[0074] As an optional approach, before selecting a target control file that matches the current resource load state of the server from among the multiple reference control files, the method further includes:

[0075] S71, detect the current resource load rate of the server; if the resource load rate is greater than the target load rate threshold, determine the current resource load state of the server as a first load state; if the resource load rate is less than or equal to the target load rate threshold, determine the current resource load state of the server as a second load state; or S72, receive the control command currently input by the target account; if a first control command is detected, determine the current resource load state of the server as a first load state; if a second control command is detected, determine the current resource load state of the server as a second load state, wherein the first control command is used to instruct the logging control option to perform the state disable operation, and the second control command is used to instruct the logging control option to perform the state enable operation.

[0076] Optionally, in this embodiment, the operation of instructing the selection of target control files can be, but is not limited to, the following methods: First, the operating system automatically detects the current resource load rate of the server in the background and then selects the target control file from three reference control files; Second, the target account (administrator) inputs control commands related to server resources, the operating system receives the input control commands, determines whether the control command is a first control command or a second control command, accordingly determines whether the current resource load state of the server is a first load state or a second load state, and then executes the corresponding operation; Third, the target account (administrator) inputs control commands related to log control options, the operating system receives the input control commands, and selects the corresponding target control file according to the control commands. In this embodiment… Figure 4 This is a schematic diagram of a flowchart illustrating a server log reporting control instruction control according to an embodiment of this application, as shown below. Figure 4 As shown, for example: if the operating system detects the control command -read, it selects file A1 as the target control file, that is, it reads the current state of the log control options; if it detects the control command -open, it selects file B1 as the target control file, allowing the server to call server resources to report server logs, and then selects file A1 as the target control file again, that is, it reads the current state of the log control options; if it detects the control command -close, it selects file C1 as the target control file, disallowing the server to call server resources to report server logs, and then selects file A1 as the target control file again, that is, it reads the current state of the log control options. Based on the above operations, it is possible to flexibly control whether the server is allowed to call server resources to report server logs in multiple ways, and even if the current state of the log control options is not remembered, the current state of the log control options can be read by entering control commands.

[0077] Optionally, in this embodiment, in order to better understand the process of the above-mentioned server log reporting control method, the above-mentioned server log reporting control process will be described below in conjunction with optional embodiments, but it is not intended to limit the technical solution of the embodiments of this application.

[0078] This embodiment provides a method for controlling the reporting of server logs. Figure 5 This is a schematic diagram of a server log reporting control flow according to an embodiment of this application, such as... Figure 5 As shown, the main steps are as follows: First, enable support for the SCI function in the BIOS system source code and embed specific control code (code A0 (read), code B0 (enable), and code C0 (disable)). The control code is added to the BIOS through the SCI function module. Then, compile the BIOS source code containing the control code, i.e., the reference system code (code A1 (read), code B1 (enable), and code C1 (disable)), to generate three initial control files (SCI image files). Then, use the GenerateCapsule script to convert the initial control files into SCI-capsule files of type .cap that can be executed by the BIOS system, i.e., reference control files (files A1, B1, and C1). Finally, the operating system dynamically selects and loads the reference control files and executes the response operation according to the current resource load status of the server or the control instructions entered by the target account.

[0079] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0080] This embodiment also provides a server log reporting control device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0081] Figure 6This is a structural block diagram of a server log reporting control device according to an embodiment of this application, such as... Figure 6 As shown, a target storage device is deployed in the server, and an operating system and a basic input / output system run in the server. The basic input / output system is used to execute files in the target storage device, and the apparatus is applied to the operating system, including:

[0082] Add module 602, used to add multiple control code segments to the system source code of the basic input / output system when the server is running server services, to obtain multiple reference system codes, wherein each control code segment records a control operation of the log control option in the basic input / output system;

[0083] The compilation module 604 is used to compile multiple copies of the reference system code to obtain multiple reference control files of target file type, wherein the target file type files are files that the basic input / output system allows to execute, and each of the multiple reference control files is used to indicate the corresponding control operation to be performed on the log control option, and the log control option is used to indicate whether the server calls server resources to report server logs;

[0084] The filtering module 606 is used to filter out a target control file that matches the current resource load status of the server from a plurality of reference control files, wherein the resource load status is used to indicate the current server resource occupancy in the server.

[0085] The writing module 608 is used to write the target control file into the target memory.

[0086] In one exemplary embodiment, the adding module includes:

[0087] The positioning unit is used to locate the target function code for implementing the target function from the system source code, wherein the target function is an independently executable function, and functions of the independently executable type are allowed to independently execute system management tasks, and the target function code is code in the system source code that is allowed to be modified;

[0088] An adding unit is used to add multiple control code segments to the target function code of the system source code to obtain multiple copies of the reference system code.

[0089] In one exemplary embodiment, the adding unit is configured to:

[0090] Adding read control code to the target function code of the system source code yields system read code, wherein multiple control code segments include the read control code, and the read control code records the status read operation of the log control option, the status read operation being used to read the current status of the log control option; multiple reference system code segments include the system read code; and / or adding enable control code to the target function code of the system source code yields system enable code, wherein multiple control code segments include the enable control code, the enable control code records the status enable operation of the log control option, the status enable operation being used to switch the log control option from its current state to enabled. The log control option in the enabled state is used to instruct the server to call server resources to report server logs. Multiple reference system code documents include the system enable code; and / or the disable control code is added to the target function code in the system source code to obtain the system disable code. The multiple control code documents include the disable control code. The disable control code records the status disable operation of the log control option. The status disable operation is used to switch the log control option from the current state to the disable state. The log control option in the disable state is used to instruct the server to prohibit calling server resources to report server logs. Multiple reference system code documents include the system disable code.

[0091] In one exemplary embodiment, the compilation module includes:

[0092] The compilation unit is used to compile multiple copies of the reference system code to obtain multiple initial control files of reference file types, wherein the reference file types are files that the operating system allows to be executed;

[0093] The conversion unit is used to call a type conversion script to convert multiple initial control files into the target file type, thereby obtaining multiple reference control files of the target file type.

[0094] In one exemplary embodiment, the compilation unit is configured to:

[0095] The compilation system reads the code to obtain a reference read control file of the target file type. Multiple copies of the reference system code include the system read code, which is obtained by adding read control code to the target function code of the system source code. Multiple segments of the control code include the read control code, which records the status read operation of the log control option. The status read operation is used to read the current status of the log control option. The target function code is the code in the system source code that is allowed to be modified. The reference control file includes the reference read control file. And / or the compilation system enables the code to obtain a reference enable control file of the target file type. Multiple copies of the reference system code include the system enable code, which is obtained by adding enable control code to the target function code of the system source code. Multiple segments of the control code include the enable control code. The aforementioned enable control code records the enable operation of the log control option, which is used to switch the log control option from its current state to an enable state. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference enable control file. And / or compile system disable code to obtain a reference disable control file of the target file type, wherein multiple copies of the reference system code include the system disable code, which is obtained by adding the disable control code to the target function code of the system source code; multiple segments of the control code include the disable control code, which records the disable operation of the log control option, which is used to switch the log control option from its current state to a disable state. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference disable control file.

[0096] In one exemplary embodiment, the filtering module includes:

[0097] The first determining unit is configured to determine the reference shutdown control file and the reference read control file among the multiple reference control files as the target control file when the resource load state is a first load state, wherein the first load state is used to indicate that the current server resource occupancy parameter in the server is greater than the target parameter threshold, the reference shutdown control file is used to perform the state shutdown operation, and the reference read control file is used to perform the state read operation after the state shutdown operation is completed;

[0098] The second determining unit is configured to determine the reference enable control file and the reference read control file among the multiple reference control files as the target control file when the resource load state is a second load state. The second load state is used to indicate that the current server resource occupancy parameter in the server is less than or equal to the target parameter threshold. The reference enable control file is used to perform the state enable operation, and the reference read control file is used to perform the state read operation after the state enable operation is completed.

[0099] In one exemplary embodiment, the apparatus further includes:

[0100] A detection module is configured to detect the current resource load rate of the server before selecting a target control file that matches the current resource load state of the server from a plurality of reference control files; if the resource load rate is greater than a target load rate threshold, determine the current resource load state of the server as a first load state; if the resource load rate is less than or equal to the target load rate threshold, determine the current resource load state of the server as a second load state; or a receiving module is configured to receive a control command currently input by a target account; if a first control command is detected, determine the current resource load state of the server as a first load state; if a second control command is detected, determine the current resource load state of the server as a second load state, wherein the first control command is used to instruct the logging control option to perform the state-off operation, and the second control command is used to instruct the logging control option to perform the state-on operation.

[0101] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0102] Embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the methods described in various embodiments of this application; the computer program product further includes a non-volatile computer-readable storage medium storing the computer program, which, when executed by a processor, implements the steps of the methods described in various embodiments of this application.

[0103] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0104] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0105] Embodiments of this application also provide an electronic device. Figure 7 This is a schematic diagram of an electronic device according to an embodiment of this application, such as... Figure 7 As shown, the electronic device includes a memory and a processor, the memory storing a computer program, and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0106] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0107] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0108] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0109] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A method for controlling the reporting of server logs, characterized in that, A target storage device is deployed in a server, and an operating system and a basic input / output system are running in the server. The basic input / output system is used to execute files in the target storage device. The method is applied to the operating system and includes: When the server is running server services, multiple control code segments are added to the system source code of the basic input / output system to obtain multiple reference system codes. Each control code segment records a control operation of the log control option in the basic input / output system. Compile multiple copies of the reference system code to obtain multiple reference control files of target file type, wherein the target file type files are files that the basic input / output system allows to execute, and each of the multiple reference control files is used to indicate the corresponding control operation to be performed on the log control option, and the log control option is used to indicate whether the server calls server resources to report server logs; A target control file that matches the current resource load status of the server is selected from a plurality of reference control files, wherein the resource load status is used to indicate the current resource occupancy of the server. Write the target control file into the target memory; The control operation includes at least one of the following: a status reading operation, a status enabling operation, and a status disabling operation, wherein the status reading operation is used to read the current status of the log control option, the status enabling operation is used to switch the log control option from the current status to the enabled status, and the status disabling operation is used to switch the log control option from the current status to the disabled status.

2. The method according to claim 1, characterized in that, The process involves adding multiple control code segments to the system source code of the basic input / output system, resulting in multiple reference system codes, including: The target function code for implementing the target function is located from the system source code. The target function is an independently executable function, which allows the system management task to be executed independently. The target function code is the code in the system source code that is allowed to be modified. Multiple control code segments are added to the target function code of the system source code to obtain multiple reference system codes.

3. The method according to claim 2, characterized in that, The process involves adding multiple control code segments to the target function code of the system source code, resulting in multiple reference system codes, including: Add the read control code to the target function code in the system source code to obtain system read code, wherein multiple control code segments include the read control code, the read control code records the status read operation of the log control option, and multiple reference system code copies include the system read code; and / or Add the enable control code to the target function code in the system source code to obtain system enable code. Multiple control code segments include the enable control code, which records the enable status of the log control option. In the enabled state, the log control option instructs the server to call server resources to report server logs. Multiple reference system code sets include the system enable code; and / or Add the shutdown control code to the target function code in the system source code to obtain the system shutdown code. The shutdown control code includes multiple control code segments. The shutdown control code records the shutdown operation of the log control option. The log control option in the shutdown state is used to instruct the server to prohibit the use of server resources to report server logs. Multiple reference system code documents include the system shutdown code.

4. The method according to claim 1, characterized in that, The compilation of multiple copies of the reference system code yields reference control files of multiple object file types, including: Compile multiple copies of the reference system code to obtain multiple initial control files of reference file types, wherein the reference file types are files that the operating system allows to be executed; The type conversion script is invoked to convert the multiple initial control files into the target file type, thereby obtaining the multiple reference control files of the target file type.

5. The method according to claim 1, characterized in that, The compilation of multiple copies of the reference system code yields reference control files of multiple object file types, including: The compilation system reads the code to obtain a reference read control file of the target file type. Multiple copies of the reference system code include the system read code, which is obtained by adding the read control code to the target function code of the system source code. Multiple control code segments include the read control code, which records the status read operations of the log control option. These status read operations are used to read the current status of the log control option. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference read control file; and / or The compilation system enables the code, resulting in a reference enable control file of the target file type. Multiple copies of the reference system code include the system enable code, which is obtained by adding the enable control code to the target function code of the system source code. Multiple control code segments include the enable control code, which records the enabling operation of the log control option. The enabling operation is used to switch the log control option from its current state to an enabled state. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference enable control file; and / or The system shutdown code is compiled to obtain a reference shutdown control file of the target file type. Multiple copies of the reference system code include the system shutdown code, which is obtained by adding the shutdown control code to the target function code of the system source code. Multiple control code segments include the shutdown control code, which records the status shutdown operation of the log control option. The status shutdown operation is used to switch the log control option from its current state to a disabled state. The target function code is code in the system source code that is allowed to be modified. The reference control file includes the reference shutdown control file.

6. The method according to claim 5, characterized in that, The step of selecting a target control file from a plurality of reference control files that matches the current resource load state of the server includes: When the resource load state is a first load state, the reference shutdown control file and the reference read control file among the multiple reference control files are determined as the target control file. The first load state is used to indicate that the current server resource occupancy parameter in the server is greater than the target parameter threshold. The reference shutdown control file is used to perform the state shutdown operation. The reference read control file is used to perform the state read operation after the state shutdown operation is completed. When the resource load state is in the second load state, the reference enable control file and the reference read control file among the multiple reference control files are determined as the target control file. The second load state is used to indicate that the current server resource occupancy parameter in the server is less than or equal to the target parameter threshold. The reference enable control file is used to perform the state enable operation. The reference read control file is used to perform the state read operation after the state enable operation is completed.

7. The method according to claim 6, characterized in that, Before selecting a target control file that matches the current resource load state of the server from among the plurality of reference control files, the method further includes: Detect the current resource load rate of the server; if the resource load rate is greater than a target load rate threshold, determine the current resource load state of the server as a first load state; if the resource load rate is less than or equal to the target load rate threshold, determine the current resource load state of the server as a second load state; or Receive the control command currently input by the target account; if a first control command is detected, determine that the current resource load state of the server is a first load state; if a second control command is detected, determine that the current resource load state of the server is a second load state, wherein the first control command is used to instruct the logging control option to perform the state disable operation, and the second control command is used to instruct the logging control option to perform the state enable operation.

8. A server log reporting control device, characterized in that, A target storage device is deployed in a server, and an operating system and a basic input / output system run on the server. The basic input / output system is used to execute files in the target storage device, and the apparatus is applied to the operating system, including: An add module is used to add multiple control code segments to the system source code of the basic input / output system when the server is running server services, resulting in multiple reference system codes. Each control code segment records a control operation of the log control option in the basic input / output system. The compilation module is used to compile multiple copies of the reference system code to obtain multiple reference control files of target file types, wherein the target file type files are files that the basic input / output system allows to execute, and each of the multiple reference control files is used to indicate the corresponding control operation to be performed on the log control option, and the log control option is used to indicate whether the server calls server resources to report server logs; A filtering module is used to filter out a target control file that matches the current resource load status of the server from a plurality of reference control files, wherein the resource load status is used to indicate the current server resource occupancy in the server; A writing module is used to write the target control file into the target memory; The control operation includes at least one of the following: a status reading operation, a status enabling operation, and a status disabling operation, wherein the status reading operation is used to read the current status of the log control option, the status enabling operation is used to switch the log control option from the current status to the enabled status, and the status disabling operation is used to switch the log control option from the current status to the disabled status.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 7.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Client log processing method and device and computer equipment

    CN113687974A

  • Intelligent log collecting and processing method and device, electronic equipment and storage medium

    CN114020565A