Log collection method as well as device and equipment
A log and server technology, applied in digital transmission systems, electrical components, transmission systems, etc., can solve problems such as inability to collect logs and difficulty in adapting to server business needs, and achieve the effect of avoiding long-term occupation of resources and optimizing and rational utilization
Inactive Publication Date: 2019-02-05
ZHENGZHOU YUNHAI INFORMATION TECH CO LTD
5 Cites 8 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0003] The traditional log collection method is only suitable for traditional servers, and it can only collect part of the logs, such as collecting only system event logs, baseboard management controller black box logs, and user ope...
Method used
Visible, utilize the log collection method that the application provides, the user only needs to trigger a key log collection operation through the terminal, and the server will respond to the user's log collection request to automatically collect more server-related logs by adopting an asynchronous mechanism. On the one hand, the execution of the log collection task does not affect the execution of other tasks; on the other hand, it guarantees to provide users with richer logs, which is helpful for users to monit...
Abstract
The invention provides a log collection method. In the method, a server responds to a log collection request, related logs of the server are automatically collected, compared with a collection methodin the prior art, on one hand, collection coverage of the related logs of the server is increased, and more logs can be collected, so that more abundant logs are provided for a user, and the user canconveniently perform comprehensive supervision and maintenance on the server according to the logs, on the other hand, the method considers the facts that an IPMI process can be occupied for a long time while the collection coverage of the related logs of the server is increased and normal operation of other tasks is influenced, and for avoiding influence on other tasks in a log collection process, the method provides a way of creating a new thread by virtue of an asynchronous mechanism for executing a log collection task, so that execution of the log collection task can not influence execution of other tasks, and resources are avoided from being occupied for a long time. Besides, the invention also provides a corresponding device and equipment.
Application Domain
Data switching networks
Technology Topic
Operating systemComputer science +1
Image
Examples
- Experimental program(1)
Example Embodiment
[0038] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiment of the application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiment of the application. Obviously, the described embodiment is only It is a part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
[0039] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and not necessarily Used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein, for example, can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
[0040] It should be understood that a log collection method provided by this application can be adapted to any server under any platform to provide users with a one-click log collection data service. For example, this method can be adapted to servers based on the Purley platform, and can also be adapted to The servers of the weekly platform can of course also be adapted to servers under other platforms.
[0041] For ease of understanding, the following combination figure 1 The application of a log collection method provided in this application in an actual scenario is exemplified.
[0042] see figure 1 The application scenario diagram of a log collection method provided by the embodiment of the present application is shown, as shown in figure 1 As shown, a log collection method provided by the embodiment of the present application can be applied to the server 100 in the form of a program. The working mode of browser/server mode (B/S for short) provides users with one-click log collection services, and of course other data services, such as file storage, file reading and other data services.
[0043] It should be understood that the server may be an application server, a web server, or a storage server and so on. In practical application, the server 100 implements the log collection method provided by the present application through the baseboard management controller running the program. The specific implementation process of the method will be described in detail below, and will not be described here. The server 100 implements the log collection method mainly by using an asynchronous mechanism to create a thread according to the log collection request triggered by the user, and executes the log collection task through the thread to collect server-related logs with high coverage, and then collects the collected server-related logs. Return to the user, so that the user can realize the supervision and maintenance of the server 100 according to these logs.
[0044] For the user, when it is necessary to know the server-related logs so as to supervise and maintain the server according to these logs, the user can communicate with the server 100 through the terminal 200 to obtain the server-related logs. Specifically, the user initiates a log collection request to the server 100 through the client or browser configured in the terminal 200, figure 1The above only takes access to the server through a browser as an example. The user accesses the log collection interface provided by the server 100 through the browser. The log collection interface carries a one-key collection control. When the user triggers the one-key collection control, the browser generates a log collection interface. request and send it to the server 100, then the server 100 responds to the log collection request sent by the browser, uses an asynchronous mechanism to create a thread, and executes the log collection task through the thread to collect server-related logs with high coverage, and then collects the collected server logs. The related logs are returned to the browser, so that the terminal displays the server related logs for the user, so that the user can monitor and maintain the server 100 according to the server related logs.
[0045] It can be seen that using the log collection method provided by this application, the user only needs to trigger a one-click log collection operation through the terminal, and the server will respond to the user's log collection request to automatically collect more server-related logs by using an asynchronous mechanism. On the one hand, the log The execution of the collection task does not affect the execution of other tasks. On the other hand, it guarantees to provide users with richer logs, which is helpful for users to monitor and maintain the server.
[0046] The following explains the log collection method provided by this application from the perspective of the server.
[0047] see figure 2 The flow chart of a log collection method provided by the embodiment of the present application is shown, as shown in figure 2 As shown, the method includes:
[0048] S201: Receive a log collection request, and the log collection request is used to request to collect server-related logs;
[0049] In specific implementation, the server receives the log collection request sent by the terminal through the browser or the client. For the user, the terminal browser or the client can be used to log in to the log collection interface provided by the server. The log collection interface carries the log For the collection control, the user only needs to touch the log collection control with one key to initiate a log collection request. Correspondingly, the server can receive the log collection request sent by the terminal.
[0050] In actual implementation, the server can provide log collection services for multiple users at the same time, that is, the server can communicate with multiple terminals at the same time to provide log collection services for different users. Based on this, the server will receive multiple Log collection request, based on this, in order to reduce the server’s repeated execution of log collection tasks and waste of resources, in the embodiment of this application, after the server receives a log collection request, it does not directly respond to the request to perform the log collection task, but needs Check whether the current system is performing log collection operations, that is, whether there is already a log collection task being executed, and the server decides how to proceed according to the actual situation.
[0051] Therefore, after the server executes S201, it executes S202 immediately.
[0052] S202: Responding to the log collection request, check whether there is currently a log collection task being executed;
[0053] In the specific implementation, after receiving a log collection request, the server will use the asynchronous mechanism through the baseboard management controller (BMC), and use the intelligent platform management interface (Intelligent Platform Management Interface, IPMI) command to trigger log collection Return immediately after the task, and create a new thread to perform specific log collection tasks, thereby releasing the IPMI process and preventing other tasks from failing due to occupation of IPMI resources. For the server, when creating a new thread and executing the log collection task through the thread, the execution status of the process will be recorded correspondingly. For example, the execution status of the process is being executed, that is, the log is being collected, which means the server The server-related logs are being collected through the thread, and the task is being executed; and if the execution status of the process is collection completed, it indicates that the server has completed log collection and the log collection task has been executed.
[0054] In the embodiment of this application, the server will only create one thread for the log collection task at a time point, that is, the server will only run one thread at a time point to collect server-related logs, and multiple threads will not be used in parallel at the same time. Collect server-related logs, so as to avoid creating multiple threads to collect logs at the same time, so as to avoid resource waste and affect the execution of other tasks.
[0055] On this basis, once the server receives a log collection request, it first checks whether the log collection task is currently being executed, and then decides to execute the corresponding operation according to the check result.
[0056] When the checking result is yes, the server executes S203 and S205, and when the checking result is no, the server executes S204 and S205.
[0057] S203: If so, wait for the execution of the log collection task to be completed and obtain the collected server-related logs;
[0058] It should be understood that if the check result is yes, it means that when the server receives the log collection request, the log collection operation is in progress in the system, then there is no need to create a new thread to initiate the log collection task at this time, just wait for the current The collected results of the log collection task will return the collected server-related logs directly to the corresponding requester.
[0059] For example, user 1 initiates a log collection request 1 through terminal A. When the server receives the log collection request 1, it checks whether the log collection task is being executed in the system. At this time, it finds that the log collection task is being executed in the system. The log collection task Specifically, it is initiated for the log collection request 2 initiated by user 2 through terminal 2. In this case, the server no longer initiates a new thread for the log collection request 1 of user 1, but waits for the log that is being executed When the collection task is completed, the collected server-related logs are returned to Terminal 1 and Terminal 2, that is, to User 1 and User 2.
[0060] For the server, only one log collection task is executed at a time point, and based on the server-related logs obtained by executing the log collection task, it also responds to all received during the time period of the log collection task Log collection requests to save server resources and avoid repeated collection.
[0061] S204: If not, an asynchronous mechanism is used to create a thread to perform a log collection task through the thread to collect the server-related logs, and the server-related logs include at least: black box logs of the baseboard management controller and user operation logs , system event logs, and key process logs of the baseboard management controller;
[0062] It should be understood that if the check result is negative, it indicates that the log collection task is not currently being executed in the server. In this case, in order to respond to the currently received log collection request in a timely manner, the server needs to create a thread. Specifically, The asynchronous mechanism creates a thread to perform log collection tasks and collect server-related logs through the thread.
[0063] For example, user 1 initiates a log collection request 1 through terminal A. When the server receives the log collection request 1, it checks whether the log collection task is being executed in the system. At this time, it finds that the log collection task is not being executed in the system. In this case, the server needs to initiate a new thread for the log collection request 1 of user 1, and execute the log collection task through the new thread, so as to return the collected server-related logs to terminal 1, that is, to user 1.
[0064] In actual implementation, in order to facilitate the user to monitor and maintain the server, it is necessary to provide the user with more abundant logs. Based on this, the server-related logs that can be obtained in this embodiment of the application include at least: the black box log of the baseboard management controller, the user Operation logs, system event logs, and critical process logs for the baseboard management controller.
[0065] It should be understood that in the embodiment of the present application, the server-related logs that can be collected can not only cover the traditional logs of the baseboard management controller's black box log, user operation log, and system event log, but also cover the baseboard management controller's The key process log, and the key process log is a very important log for the supervisory server. Therefore, using this method can provide users with more valuable and richer logs.
[0066] In specific implementation, the key process log can also be understood as the main process log. The so-called key process log is the log related to the key process in the BMC, and the key process is also the main process, which includes but is not limited to: ipmimain process, Adviserd process (KVM process), lightpd process (web service process), snmpd process, dhcpMonitor process, watchdogapp process, Flasher process (upgrade process). Of course, you can also obtain logs of other processes according to actual business needs.
[0067] Of course, in specific implementation, you can also specify that server-related logs also include one or more of the following logs:
[0068] Any one or more of the configuration log of the specified component in the server, the operation log of the baseboard management controller, the alarm log, and the diagnosis log when the specified component in the server fails.
[0069] Wherein, the configuration log of the specified component in the server can also be understood as the configuration information of the specified component in the server. The specified component here can be a hardware component or a software component. More specifically, the configuration log of the specified component can include but Not limited to the following information:
[0070] Network service configuration parameters, virtual media configuration information, remote virtual media configuration information, Lighttpd server configuration, SSH service configuration, host name configuration, DHCPv6 client configuration file, DNS server configuration file, iptables configuration for ipv4 address, Ip6tables configuration, Used for ipv6 address, dns configuration file, dns domain name resolution configuration file, network information (including ip address, mask, gateway and other information), Syslog function configuration file, server hardware configuration information, Syslog function configuration file, current fan speed, heat dissipation Regulatory parameters, information such as current speed determination factors, log rotate rule configuration files, route display current routing information, etc.
[0071] Wherein, the diagnosis log may be a fault analysis log of the BMC, mainly including a system event log and a log generated by analyzing CPU/PSU related register data when a fault occurs.
[0072] Wherein, the operation log of the baseboard management controller is used to record the status information of the baseboard management controller during operation.
[0073] It should be understood that some of the logs collected by the thread to execute the log collection task will be recorded during the server's work, such as configuration information, key process information, etc., and some are generated when the log collection request is triggered , for example, the current CPU register data, as well as CPU utilization, memory utilization, system operating load, interrupt information, and so on. In practical applications, the server can provide log collection services for multiple terminals at the same time. Based on this, in a certain situation, the server will receive multiple log collection requests at the same time. In this case, the server will respond simultaneously or multiple log collection requests, and then perform S202 to check whether the log collection task is being executed in the current system, and if so, wait for the log collection task to be executed to obtain the collected server-related logs in response to the multiple log collection requests, That is, return server-related logs to multiple terminals.
[0074]If multiple log collection requests are received at the same time point, and no log collection tasks are currently being executed, in this case, the server responds to the multiple log collection requests, adopts an asynchronous mechanism, and only creates one thread The log collection task is executed through the thread to collect the server-related logs and return the server-related logs.
[0075] That is, for the server, when multiple log requests are received at the same time, and the system is not performing the log collection task, the server only needs to create a thread, and execute the log collection task through this thread, so as to The collected server-related logs are returned to multiple terminals at the same time.
[0076] S205: Return the server-related logs.
[0077] In a specific implementation, the server utilizes server-related logs collected by performing a log collection task, and simultaneously responds to all log collection requests received within the time range of executing the log collection task.
[0078] It should be understood that, if within the time range, the server only receives one log collection request, it only needs to respond to the log collection request, that is, return the server-related logs to the request initiator. If within the time range, the server receives multiple log collection requests, it needs to respond to the multiple log collection requests at the same time, that is, return server-related logs to multiple request initiators.
[0079] In addition, during specific implementation, the server may also save the collected server-related logs for later viewing by the user. In this way, the user may directly download the server-related logs within a specified period of time from the server.
[0080] When using the log collection method provided by the above-mentioned embodiments of the present application to collect logs, after receiving the log collection request triggered by the user, the server-related logs are automatically collected. Compared with the collection method of the prior art, on the one hand, this method increases the server The collection coverage of relevant logs can collect more logs, so as to provide users with richer logs, so that users can comprehensively supervise and maintain the server based on these logs. On the other hand, this method takes into account that when the collected server-related logs In the case of increased coverage, the IPMI process will be occupied for a long time, which will affect the normal progress of other tasks. In order to avoid the impact on other tasks during the log collection process, this method proposes to create a new thread through an asynchronous mechanism to perform log collection tasks. , so that the execution of the log collection task will not affect the execution of other tasks, thereby avoiding long-term occupation of resources.
[0081] Considering that in the actual log collection process, due to the various types of logs to be collected and the large amount of log collection tasks, the collection process may take a long time, for example, it may take several minutes. Therefore, in order to facilitate users to understand the logs in a timely and effective manner Collection status, to prevent users from repeating requests without knowing the collection status. This application also provides a corresponding solution. Specifically, on the basis of the above method, the server also monitors the log collection progress while performing the log collection task, and checks Log collection progress to return log collection progress to the user.
[0082] During specific implementation, the server may periodically check the log collection progress, and periodically return the log collection progress to the user. For example, for the server, the collection progress is monitored according to the execution of the log collection task, and the collection progress is checked at intervals such as 15 seconds, and the log collection progress is returned to the user at an interval of 15 seconds, so that the user can understand the collection situation.
[0083] During specific implementation, the server can also view the progress of log collection in real time, so as to return the progress of log collection to the user in real time. For example, when the server is executing the log collection task, it can view the progress synchronously, so as to return the log collection progress in real time, so that the user can understand the collection situation in real time.
[0084] During specific implementation, the server may also return the log collection progress to the user only when the collection progress reaches a preset condition. Specifically, when the collected log ratio reaches a preset value, the server returns the progress of log collection to the user. For example, the server returns the log collection status to the user only when the collected log ratio reaches 50%.
[0085] For the user, use the terminal to trigger the log collection request. Correspondingly, when the terminal receives the log collection progress returned by the server, it will display the log collection progress on the log collection interface, for example, display the log collection progress for the user in text or The log collection progress is displayed for the user in the form of a graph, and of course the log collection progress can also be displayed for the user in the form of both pictures and text. For example, the log collection progress is displayed in the form of a progress bar, and the specific progress value is displayed in the form of a percentage, for example, 50% of the logs have been collected currently.
[0086] In addition, when it needs to be explained, the log collection method provided by the above embodiment of the present application may also be deployed in the baseboard management server in the server, and the baseboard management server executes the method steps to realize automatic log collection. Corresponding to the above method, this application also provides a log collection device, which is combined with image 3 Explain the device.
[0087] see image 3 A structural diagram of a log collection device is shown, the device 300 includes:
[0088] The receiving module 301 is configured to receive a log collection request, and the log collection request is used to request to collect server-related logs;
[0089] Viewing module 302 is used to respond to the log collection request and check whether there is currently a log collection task being executed; if so, trigger the acquisition module 303 and the log feedback module 305, if not, then trigger the asynchronous execution module 304 and the log feedback module 305;
[0090] The acquiring module 303 is configured to wait for the completion of the log collection task and acquire the collected server-related logs;
[0091] The asynchronous execution module 304 is configured to use an asynchronous mechanism to create a thread to execute a log collection task through the thread, so as to collect the server-related logs, and the server-related logs include at least: black box logs of the baseboard management controller, User operation logs, system event logs, and key process logs of the baseboard management controller;
[0092] The log feedback module 305 is configured to return the server-related logs.
[0093] Optionally, the device also includes:
[0094] The collection progress feedback module is configured to check the log collection progress during the execution of the log collection task, and return the log collection progress.
[0095] In addition, the present application also provides a baseboard management controller, where a program is configured on the baseboard management controller, and when the program is run, the method for collecting logs provided in the foregoing embodiments of the present application is implemented.
[0096] In addition, this application also provides a server, which is combined with Figure 4 Explain the server.
[0097] see Figure 4 The structure diagram of a server provided by the embodiment of the present application is shown, as shown in Figure 4 As shown, the server 400 includes: a baseboard management controller 401, a processor 402, and a memory 403. The baseboard management controller is configured with a program, and when the program is run, the log provided by the above-mentioned embodiment of the present application is realized. collection method;
[0098] The processor 402 is configured to provide data services, for example, data storage services, data reading services, and the like.
[0099] The memory 403 is used to store data, for example, used to store server-related logs collected by the baseboard management controller. Wherein, the memory 403 may include non-permanent memory in computer-readable media, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM) , the memory includes at least one memory chip.
[0100] In addition, the embodiment of the present application also provides a computer storage medium, on which a program is stored, and when the program is executed by the processor, the log collection method provided by the above-mentioned embodiment of the present application is implemented; in this way, it can ensure that the application provides A log collection method can be quickly transplanted to any device to achieve.
[0101] In addition, the present application also provides a computer program product, which, when executed on a device, is suitable for executing a program for initializing the steps of a log collection method provided by the above-mentioned embodiments of the present application.
[0102] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
[0103] The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a in real process Figure 1 process or multiple processes and/or boxes Figure 1 means for the function specified in one or more boxes.
[0104] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device is implemented in the process Figure 1 process or multiple processes and/or boxes Figure 1 function specified in one or more boxes.
[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby instructions are provided for implementing the flow in Figure 1 process or multiple processes and/or boxes Figure 1 steps of the function specified in the box or boxes.
[0106] In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
[0107] Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read only memory (ROM) or flash RAM. The memory is an example of a computer readable medium.
[0108]Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
[0109] It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0110] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems or computer program products. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
[0111] The above are only examples of the present application, and are not intended to limit the present application. For those skilled in the art, various modifications and changes may occur in this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.