Unified monitoring and management method of CMP system log based on Docker
Through the Docker-based method, the problem of low log collection and analysis efficiency is solved, log configuration is simplified, and operation and maintenance efficiency and system stability are improved.
Patent Information
- Application Number
- CN202210922734.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-02
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-08-02
AI Technical Summary
CMP system log collection and analysis is inefficient and has poor adaptability. Operation and maintenance personnel need to be familiar with the log output characteristics of various development languages and software services. Log collection and configuration are complex and maintenance is difficult when expanding new subsystems and services.
Using Docker-based methods, we obtain system programs or software services under the cloud management platform, create Docker images, associate logs to the standard output of the mirror, and pass logs to the log center server through the Docker container, establish indexes for unified monitoring and management. Simplify log collection and configuration and reduce operation and maintenance complexity.
It improves the efficiency and adaptability of CMP system log monitoring and management, reduces the configuration complexity of operation and maintenance personnel, can handle system problems in a timely manner, and improves the system user experience.
Smart Images

Figure CN115334086B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, computer equipment and storage medium for unified monitoring and management of CMP system logs based on Docker. Background Art
[0002] CMP stands for Cloud Managerment Platform. Its main capabilities include self-service, system image provision, billing system, scheduling system, and workload optimization through established policies. Better products can integrate with external enterprise systems, support storage and network resource configuration, allow for enhanced resource management through service governance, and provide advanced monitoring to improve system performance and availability. The CMP platform can be used to monitor various public and private cloud resources, perform task distribution, and manage work orders.
[0003] The CMP system involves many business subsystems. The development of different business system products may involve different development languages (such as Java, Go, Python, etc.) and different software services (such as MySql database service, Nginx service, NodeJs service, etc.). The security and stability of the CMP system depends on the monitoring of the status of each subsystem and software service. The status of each subsystem and related software service depends on the collection and analysis of its logs. The traditional way to collect and analyze logs for complex and large systems is to configure a log collection client (such as Filebeat) for each deployed subsystem or software service and upload it to the log center server for analysis. The shortcomings of traditional log collection and analysis methods are as follows:
[0004] 1. It places high demands on operation and maintenance personnel, who need to be familiar with the log output characteristics of products developed in different languages and related software services. If necessary, they also need to learn from developers about the log output characteristics of different business subsystems.
[0005] 2. When the CMP system expands new subsystems and services, the log collection end needs to increase the corresponding log configuration, which increases the maintenance complexity.
[0006] Therefore, the existing technology has the problems of low efficiency and poor adaptability. Summary of the invention
[0007] Based on this, it is necessary to provide a Docker-based CMP system log unified monitoring and management method, device, computer equipment and storage medium that can improve the efficiency and adaptability of CMP system log monitoring and management in response to the above technical problems.
[0008] A unified monitoring and management method for CMP system logs based on Docker, the method comprising:
[0009] Obtain system programs or software services for services under the cloud management platform and create corresponding Docker images;
[0010] Associating the log of the system program or software service to the standard output of the Docker image;
[0011] Start a Docker container according to the Docker image, set a container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running;
[0012] The collected logs are indexed and uniformly monitored and managed through the log center server.
[0013] In one of the embodiments, it further includes: obtaining system programs or software services for services under the cloud management platform;
[0014] Configure and create the corresponding Docker image through the Dockerfile file.
[0015] In one of the embodiments, it also includes: associating the log of the system program or software service to the standard output of the Docker image; the log includes an access log and an error log.
[0016] In one of the embodiments, the method further includes: starting a Docker container according to the Docker image;
[0017] Select a log driver type and set container log driver parameters when the Docker container is started;
[0018] The log driver type and the log center server address to which the log is to be forwarded are configured in the daemon.json file of the server Docker, and the driver configuration is shared by all Docker containers running on the server Docker.
[0019] In one of the embodiments, the method further includes: collecting, classifying and forwarding the sent logs to logstash through the rsyslog service on the log center server;
[0020] Logstash reads the logs collected by rsyslog and forwards them to Elasticseach.
[0021] In one of the embodiments, the method further includes: forwarding the collected logs to Elasticseach through the log center server and creating an index;
[0022] The NOC system monitoring center categorizes and displays logs based on the established index.
[0023] In one of the embodiments, it also includes: the number of the log center servers is configured according to the size of the cloud management platform service cluster.
[0024] A CMP system log unified monitoring and management device based on Docker, the device comprising:
[0025] The Docker image creation module is used to obtain the system programs or software services of the business under the cloud management platform and create the corresponding Docker images;
[0026] A log association module, used to associate the log of the system program or software service with the standard output of the Docker image;
[0027] A log driver module is used to start a Docker container according to the Docker image, set a container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running;
[0028] The monitoring and management module is used to create indexes for the collected logs through the log center server and perform unified monitoring and management.
[0029] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0030] Obtain system programs or software services for services under the cloud management platform and create corresponding Docker images;
[0031] Associating the log of the system program or software service to the standard output of the Docker image;
[0032] Start a Docker container according to the Docker image, set a container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running;
[0033] The collected logs are indexed and uniformly monitored and managed through the log center server.
[0034] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0035] Obtain system programs or software services for services under the cloud management platform and create corresponding Docker images;
[0036] Associating the log of the system program or software service to the standard output of the Docker image;
[0037] Start a Docker container according to the Docker image, set a container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running;
[0038] The collected logs are indexed and uniformly monitored and managed through the log center server.
[0039] The above-mentioned Docker-based CMP system log unified monitoring and management method, device, computer equipment and storage medium, when making the Docker image corresponding to the system program or software service of the business under the cloud management platform, associates the log of the system program or software service with the standard output of the Docker image, and provides the premise for the unified collection of logs and forwarding them to the log center server for unified monitoring and management. Since the logs of all programs and services are hosted in the container, there is no need to reset the log upload and collection configuration when deploying different service nodes for different customers or expanding the service. When the service is updated, the old container can be stopped to pull the latest image and restarted. The requirements for operation and maintenance personnel are relatively low, and the maintenance complexity is reduced. Through efficient unified monitoring and management, it is possible to process system node feedback information in a timely manner, discover various problems before customers, and improve the system usage experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of a flow chart of a unified monitoring and management method for CMP system logs based on Docker in one embodiment;
[0041] Figure 2 It is a flowchart of a unified monitoring and management method of CMP system logs based on Docker in another embodiment;
[0042] Figure 3 It is a structural block diagram of a unified monitoring and management device for CMP system logs based on Docker in one embodiment;
[0043] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] In one embodiment, Figure 1As shown, a unified monitoring and management method for CMP system logs based on Docker is provided, including the following steps:
[0046] Step 102: Obtain the system program or software service of the business under the cloud management platform and create a corresponding Docker image.
[0047] Docker is an open source application container engine that allows developers to package their applications and dependencies into a portable image and then publish it to any machine running any popular Linux or Windows operating system.
[0048] Step 104, associate the log of the system program or software service with the standard output of the Docker image.
[0049] No matter it is a business system program or an application software service, the source of the log is the process in the container. By utilizing this feature, the present invention proposes to output the access or error log of the system program or software service to the standard output, i.e., stdout / stderr, when making a program Docker image. In this way, the log of the system program or software service can be managed by the log log of the Docker container, providing a prerequisite for subsequent unified collection and forwarding to the log center server and other operations.
[0050] The following uses the nginx software service as an example to illustrate the specific mirror log customization method.
[0051] The production of Docker containers is based on the Dockerfile file configuration. Check the official Dockerfile file of nginx (https: / / github.com / nginxinc / docker-nginx / blob / 04226fe92cc11bed68dae464eb60fd5399daf3b1 / mainline / debian / Dockerfile). Lines 99-100 have the following configuration:
[0052] &&ln-sf / dev / stdout / var / log / nginx / access.log\
[0053] &&ln-sf / dev / stderr / var / log / nginx / error.log\
[0054] Link the original access log (access.log) and error log (error.log) of the Nginx service in the container to the standard output of the container. That is, the logs originally written to specific files are output to the Docker logs instead of being input to specific files. When the container is running, the logs output by the Docker container are the Nginx service logs.
[0055] Based on the above, the present invention can link its own program log to the container standard output port for container management when building images for other programs (such as business systems developed based on springcloud or golang) and services (such as MySQL, Redis, etc.). Given that developers are familiar with their own development programs and the software services they use, this step can be completed by developers and the image configuration can be maintained. Operation and maintenance personnel can directly pull from the image library when deploying.
[0056] Step 106, start the Docker container according to the Docker image, set the container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running.
[0057] Common log drivers supported by Docker containers include local, json-file, syslog, fluentd, etc. In this embodiment, syslog driver is selected. Log driver parameters can be set when the container is started. Considering that multiple Docker application containers will be deployed on a server, the driver type and the address of the log center server to which the log is to be forwarded are configured to the daemon.json file of the server Docker. As long as the application container started on the server Docker shares the driver configuration, the complexity of subsequent deployment can be reduced. After the container is started, the generated logs can be sent to the syslog server for centralized management and analysis according to the relevant preset configuration.
[0058] Step 108: Create an index for the collected logs through the log center server and perform unified monitoring and management.
[0059] The logs collected by the log center server from different businesses (such as billing system, operation system, DNS scheduling system, account management system, etc.) and services (Nginx, MySQL, Redis, etc.) are indexed and provided to the NOC system monitoring center for classified display.
[0060] The NOC monitoring system provides feedback on the performance, business adjustments, and fault repair of each node in the CMP system. The NOC system is a self-developed real-time log display system based on Elasticsearch to provide data sources and visualized through ECharts. ECharts is a JavaScript-based data visualization chart library that provides intuitive, vivid, interactive, and customizable data visualization charts. Based on ECharts' visualization display of log terminal monitoring, system node feedback information can be processed in a timely manner, various problems can be discovered before customers, and the system usage experience can be improved.
[0061] Specifically, the operation status of various businesses and services involved in the CMP system will be displayed in the NOC monitoring system through the logs they generate, so that timely feedback and accurate positioning can be provided for problems that occur in different service nodes. For example, if a slow query occurs in the MySQL service, which causes a longer request response time, it can be discovered through the collected container logs and reflected in the NOC monitoring system. The service node IP and query statements can be located based on the logs, and the monitoring center will feedback to the program developer. After the repair, the service image will be updated and re-sent to the service node, and the old container will be stopped and the new image container will be started.
[0062] In the above-mentioned unified monitoring and management method of CMP system logs based on Docker, when making the Docker image corresponding to the system program or software service of the business under the cloud management platform, the log of the system program or software service is associated with the standard output of the Docker image, which provides the premise for the unified collection of logs and forwarding them to the log center server for unified monitoring and management. Since the logs of all programs and services are hosted in the container, there is no need to reset the log upload and collection configuration when deploying different service nodes for different customers or expanding the service. When the service is updated, the old container can be stopped to pull the latest image and restarted. The requirements for operation and maintenance personnel are relatively low, and the maintenance complexity is reduced. Through efficient unified monitoring and management, system node feedback information can be processed in a timely manner, various problems can be discovered before customers, and the system usage experience can be improved.
[0063] In one of the embodiments, it also includes: starting a Docker container according to a Docker image; selecting a log driver type, and setting container log driver parameters when the Docker container is started; configuring the log driver type and the address of the log center server to which the log is to be forwarded to the daemon.json file of the server Docker, and the driver configuration is shared by all Docker containers running on the server Docker.
[0064] Docker is an open source application container engine that uses the CS architecture (Docker client CLI and Docker server dockerd). Server Docker refers to the Docker engine environment installed on the node server (that is, the Docker server). All Docker containers running on the server depend on the installation of this environment. The log center server refers to the collection, filtering, storage, and indexing of log files sent by each application node (composed of logstash and elk services).
[0065] The configuration file of the Docker engine on each node server is daemon.json. The configuration items in daemon.json will be shared (or followed) by all Docker containers running on the server. For example, the log-driver item determines the log driver type of the Docker container, the log-level item determines the original log level of the output, and the log-opt item can set the address to which the log is forwarded and the type label of the log. These configuration items are shared by the Docker container on the server and the Docker containers that will be deployed and run later, so the operation and maintenance personnel do not need to configure them separately each time.
[0066] In one of the embodiments, it also includes: collecting, classifying and forwarding the sent logs to logstash through the rsyslog service on the log center server; and reading the logs collected by rsyslog by logstash and forwarding them to Elasticseach.
[0067] Rsyslog is a multi-threaded enhanced version of syslogd. It completes the processing and forwarding of system logs based on the Syslog protocol and is an extremely fast log processing system.
[0068] Logstash is an open source data collection engine with real-time pipeline capabilities. Logstash can dynamically unify data from different sources and standardize the data to the target output of your choice. It provides a large number of plug-ins to help parse, enrich, transform, and buffer any type of data.
[0069] Elasticsearch is a search server based on Lucene. It provides a distributed multi-user full-text search engine based on a RESTful web interface.
[0070] Specifically, one or more log collection servers can be configured according to the size of the CMP service cluster. Take the Ubuntu system as an example:
[0071] 1. Install rsyslog (apt-get install-y rsyslog);
[0072] 2. Configure rsyslog.conf. To ensure reliable log transmission, open the TCP listening port 514 in the configuration file;
[0073] 3. Configure the template for rsyslog to collect logs (define the log file name as the source server IP + collection date + container name + program name);
[0074] 4. To prevent a single log from being too large, use the Linux server's logratate to cut the logs collected by rsyslog by time and size;
[0075] 5. Install logstash and configure logstash.conf to read the logs collected by rsyslog and forward them to Elasticsearch.
[0076] In one of the embodiments, the method further includes: forwarding the collected logs to Elasticseach and creating an index through a log center server; and classifying and displaying the logs according to the created index through a NOC system monitoring center.
[0077] The data source of the NOC monitoring system is provided by the Elasticsearch interface, and the front-end display is realized by the ECharts plug-in to realize data visualization.
[0078] In one of the embodiments, the number of log center servers is configured according to the size of the cloud management platform service cluster.
[0079] In another embodiment, Figure 2 As shown, a unified monitoring and management method for CMP system logs based on Docker is provided, including:
[0080] S1: Create a Docker image and host the program logs in the container;
[0081] S2: Set the Docker global log driver type and upload address;
[0082] S3: rsyslog log server center collects and forwards logstash;
[0083] S4: Logs are aggregated to Elasticsearch and classified and indexed;
[0084] S5: Echarts visualizes the operation status of the CMP system.
[0085] It should be understood that although Figure 1-2The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0086] In one embodiment, Figure 3 As shown, a CMP system log unified monitoring and management device based on Docker is provided, including: a Docker image making module 302, a log association module 304, a log driving module 306 and a monitoring management module 308, wherein:
[0087] The Docker image creation module 302 is used to obtain the system program or software service of the business under the cloud management platform and create the corresponding Docker image;
[0088] A log association module 304 is used to associate the logs of the system program or software service with the standard output of the Docker image;
[0089] The log driver module 306 is used to start the Docker container according to the Docker image, set the container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running;
[0090] The monitoring and management module 308 is used to create indexes for the collected logs through the log center server and perform unified monitoring and management.
[0091] The Docker image making module 302 is also used to obtain system programs or software services of services under the cloud management platform; configure and make corresponding Docker images through the Dockerfile file.
[0092] The log association module 304 is also used to associate the logs of the system program or software service with the standard output of the Docker image; the logs include access logs and error logs.
[0093] The log driver module 306 is also used to start the Docker container according to the Docker image; select the log driver type and set the container log driver parameters when the Docker container is started; configure the log driver type and the log center server address to which the log is to be forwarded to the daemon.json file of the server Docker, and the driver configuration is shared by all Docker containers running on the server Docker.
[0094] The monitoring management module 308 is also used to collect, classify and forward the received logs to logstash through the rsyslog service on the log center server; logstash reads the logs collected by rsyslog and forwards them to Elasticseach.
[0095] The monitoring management module 308 is also used to forward the collected logs to Elasticseach through the log center server and create an index; and the NOC system monitoring center classifies and displays the logs according to the created index.
[0096] For the specific limitations of the CMP system log unified monitoring and management device based on Docker, please refer to the limitations of the CMP system log unified monitoring and management method based on Docker above, which will not be repeated here. Each module in the above-mentioned CMP system log unified monitoring and management device based on Docker can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0097] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a CMP system log unified monitoring and management method based on Docker is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0098] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0099] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above method embodiment when executing the computer program.
[0100] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.
[0101] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0102] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0103] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A unified monitoring and management method for CMP system logs based on Docker, characterized in that: The method comprises: Obtain system programs or software services for businesses under the cloud management platform and create corresponding Docker images; Associating the log of the system program or software service to the standard output of the Docker image; Start a Docker container according to the Docker image, set a container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running; The collected logs are indexed and uniformly monitored and managed by the log center server; The Docker image starts the Docker container and sets the container log driver, including: Start a Docker container based on the Docker image; Select a log driver type and set container log driver parameters when the Docker container is started; Configure the log driver type and the log center server address to which the log is to be forwarded to the daemon.json file of the server Docker, and share the driver configuration with all Docker containers running on the server Docker; The rsyslog service is used on the log center server to collect and classify the sent logs and forward them to logstash; Logstash reads the logs collected by rsyslog and forwards them to Elasticseach.
2. The method according to claim 1, characterized in that Obtain the system programs or software services of the business under the cloud management platform and create the corresponding Docker images, including: Obtain system programs or software services for businesses under the cloud management platform; Configure and create the corresponding Docker image through the Dockerfile file.
3. The method according to claim 1, characterized in that Associating the log of the system program or software service to the standard output of the Docker image, including: The log of the system program or software service is associated with the standard output of the Docker image; the log includes an access log and an error log.
4. The method according to claim 1, characterized in that: The collected logs are indexed and uniformly monitored and managed by the log center server, including: The collected logs are forwarded to Elasticsearch through the log center server and indexed; The NOC system monitoring center categorizes and displays logs based on the established index.
5. The method according to any one of claims 1 to 4, characterized in that: The number of log center servers is configured according to the size of the cloud management platform service cluster.
6. A unified monitoring and management device for CMP system logs based on Docker, characterized in that: The device comprises: The Docker image creation module is used to obtain the system programs or software services of the business under the cloud management platform and create the corresponding Docker images; A log association module, used to associate the log of the system program or software service with the standard output of the Docker image; A log driver module is used to start a Docker container according to the Docker image, set a container log driver, and transmit the logs generated by the Docker container to the log center server of the cloud management platform when the Docker container is running; A monitoring and management module, used to index the collected logs through the log center server and perform unified monitoring and management; The Docker image starts the Docker container and sets the container log driver, including: Start a Docker container based on the Docker image; Select a log driver type and set container log driver parameters when the Docker container is started; Configure the log driver type and the log center server address to which the log is to be forwarded to the daemon.json file of the server Docker, and share the driver configuration with all Docker containers running on the server Docker; The rsyslog service is used on the log center server to collect and classify the sent logs and forward them to logstash; Logstash reads the logs collected by rsyslog and forwards them to Elasticseach.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
