CN109684038B - Docker service container log processing method and device and electronic equipment - Google Patents

Docker service container log processing method and device and electronic equipment Download PDF

Info

Publication number
CN109684038B
CN109684038B CN201811555180.4A CN201811555180A CN109684038B CN 109684038 B CN109684038 B CN 109684038B CN 201811555180 A CN201811555180 A CN 201811555180A CN 109684038 B CN109684038 B CN 109684038B
Authority
CN
China
Prior art keywords
log
configuration information
container
target
service container
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811555180.4A
Other languages
Chinese (zh)
Other versions
CN109684038A (en
Inventor
李朝辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201811555180.4A priority Critical patent/CN109684038B/en
Publication of CN109684038A publication Critical patent/CN109684038A/en
Application granted granted Critical
Publication of CN109684038B publication Critical patent/CN109684038B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/4555Para-virtualisation, i.e. guest operating system has to be modified
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to a method and a device for processing a log of a Docker service container, a storage medium and an electronic device. The method comprises the following steps: acquiring container configuration information corresponding to the service container from the storage unit; executing deployment operation on a service container corresponding to the target container configuration information according to the target container configuration information to acquire a target service container, wherein the target container configuration information is contained in the container configuration information; generating target log configuration information according to the deployment operation; and resetting original log configuration information corresponding to the target service container in the storage unit by adopting the target log configuration information so that the processing unit processes the log corresponding to the target service container according to the target log configuration information. The method and the device can conveniently realize the automation of the service container log processing, improve the processing efficiency of the service container log and reduce the labor operation and maintenance cost.

Description

Docker service container log processing method and device and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a Docker service container log, a computer storage medium, and an electronic device.
Background
Among the rapidly developing computer technologies, Virtualization (Virtualization) is a resource management technology, which abstracts and converts various physical resources of a computer, such as servers, networks, memories, storage, and the like, to present them, breaking the barrier of non-cuttability among the physical structures, and enabling users to apply these resources in a better way than the original configuration. Among them, the container-based virtualization technology represented by Docker is a hot spot of the current virtualization technology. The container technology implements lightweight virtualization by isolating processes and resources. Because a large amount of logs are generated in the running process of the application program, the service container logs not only include the logs of the service container itself, but also include logs of various applications running in the container, and therefore, the processing of various logs in the service container becomes one of the key research points.
At present, the collection of the Docker container logs mainly comprises container external collection, container internal collection and network collection, however, the methods are only used for collecting a certain log in a container, and when the service logs are collected or deleted, a lot of labor cost is needed for carrying out respective configuration; after configuration is changed, the service needs to be restarted, the processing efficiency of the service log is reduced, a large amount of operation and maintenance manpower needs to be invested, and the problem caused by human errors is difficult to avoid.
Therefore, it is necessary to provide a new method for processing the container log of the Docker service.
It is to be noted that the information invented in the background section above is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The disclosure aims to provide a method and a device for processing a Docker service container log, a computer storage medium and an electronic device, so as to overcome the problems of low log processing efficiency, high operation and maintenance cost and the like of a service container caused by difficulty in realizing automatic configuration of configuration information of the service container during processing of the Docker service container log at least to a certain extent. In order to achieve the technical effects, the following technical scheme is adopted in the disclosure.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, a method for processing a log of a Docker service container is provided, where the method is applied to a control unit in a log processing system for managing configuration information corresponding to a service container, and the log processing system further includes a service container, a storage unit for storing configuration information corresponding to the service container, and a processing unit for performing log processing on the service container according to the configuration information;
the method comprises the following steps: acquiring container configuration information corresponding to the service container from the storage unit; executing deployment operation on a service container corresponding to the target container configuration information according to the target container configuration information to acquire a target service container, wherein the target container configuration information is contained in the container configuration information; generating target log configuration information according to the deployment operation; and resetting original log configuration information corresponding to the target service container in the storage unit by adopting the target log configuration information so that the processing unit processes the log corresponding to the target service container according to the target log configuration information.
In an exemplary embodiment of the present disclosure, the obtaining container configuration information corresponding to the service container from the storage unit includes: and acquiring the container configuration information by calling a preset interface connected with the storage unit.
In an exemplary embodiment of the present disclosure, the performing, according to target container configuration information, a deployment operation on a service container corresponding to the target container configuration information to obtain a target service container includes: judging whether the container configuration information in the storage unit is changed or not; if the container configuration information is changed, the changed container configuration information is used as the target container configuration information, and deployment operation is performed on the service container corresponding to the target container configuration information according to the target container configuration information, so that a target service container is obtained.
In an exemplary embodiment of the present disclosure, the container configuration information includes start configuration information and stop configuration information; if the container configuration information changes, taking the changed container configuration information as the target container configuration information, and executing deployment operation on a service container corresponding to the target container configuration information according to the target container configuration information to acquire a target service container, including: if the target container configuration information is start configuration information, deploying start operation on a service container corresponding to the target container configuration information to obtain the target service container; and if the target container configuration information is stop configuration information, deploying stop operation on the service container corresponding to the target container configuration information to acquire the target service container.
In an exemplary embodiment of the present disclosure, the generating target log configuration information according to the deployment operation includes: if the service container corresponding to the target container configuration information is deployed and started, generating log collection configuration information, and merging the log collection configuration information and the container identifier of the service container to generate the target log configuration information; and if the service container corresponding to the target container configuration information is deployed and stopped, generating log deletion configuration information, and combining the log deletion configuration information with the container identifier of the service container to generate the target log configuration information.
According to an aspect of the present disclosure, a method for processing a log of a Docker service container is provided, where the method is applied to a processing unit in a log processing system, where the processing unit performs log processing on a service container according to configuration information, and the log processing system further includes a service container, a storage unit for storing the configuration information corresponding to the service container, and a control unit for managing the configuration information corresponding to the service container;
the method comprises the following steps: acquiring a target service container corresponding to the target container configuration information according to the target container configuration information in the storage unit; monitoring whether original log configuration information corresponding to the target service container in the storage unit is reset by the control unit; and if the original log configuration information is reset, processing the log corresponding to the target service container according to the reset target log configuration information.
In an exemplary embodiment of the present disclosure, if the original log configuration information is reset, processing the log corresponding to the target service container according to the reset target log configuration information includes: rendering the reset target log configuration information through a preset template to acquire current log configuration information; and generating a log configuration file according to the current log configuration information, and processing the log corresponding to the target service container according to the log configuration file.
In an exemplary embodiment of the present disclosure, the log configuration file includes a container identifier corresponding to the target service container and a log type of a log to be processed; the processing the log corresponding to the target service container according to the log configuration file includes: acquiring a log path corresponding to the target service container according to the container identifier and the log type of the log to be processed; and acquiring a log corresponding to the target service container under the log path according to the log path, and processing the log.
In an exemplary embodiment of the present disclosure, the reset target log configuration information includes log collection information, log filtering information, and log deletion information.
In an exemplary embodiment of the present disclosure, when the reset target log configuration information is log collection information, the method further includes: and collecting the logs of the target service container according to the log collection information, and outputting the logs to a preset storage center.
In an exemplary embodiment of the present disclosure, the method further comprises: obtaining user-defined log configuration information of a user, and generating a log configuration file according to the user-defined log configuration information; and processing the log corresponding to the target service container according to the log configuration file.
According to an aspect of the present disclosure, a device for processing a Docker service container log is provided, which is applied to a control unit in a log processing system for managing configuration information corresponding to a service container, where the log processing system further includes a service container, a storage unit for storing the configuration information corresponding to the service container, and a processing unit for performing log processing on the service container according to the configuration information; the processing device of the Docker service container log comprises:
a container configuration information obtaining module, configured to obtain container configuration information corresponding to the service container from the storage unit;
a target service container obtaining module, configured to perform a deployment operation on a service container corresponding to target container configuration information according to the target container configuration information, so as to obtain a target service container, where the target container configuration information is included in the container configuration information;
the log configuration information generation module is used for generating target log configuration information according to the deployment operation;
and the log processing module is used for resetting the original log configuration information corresponding to the target service container in the storage unit by adopting the target log configuration information so as to enable the processing unit to process the log corresponding to the target service container according to the target log configuration information.
According to an aspect of the present disclosure, a device for processing a log of a Docker service container is provided, which is applied to a processing unit in a log processing system for performing log processing on a service container according to configuration information, where the log processing system further includes a service container, a storage unit for storing the configuration information corresponding to the service container, and a control unit for managing the configuration information corresponding to the service container; the processing device of the docker service container log comprises:
a target service container obtaining module, configured to obtain a target service container corresponding to the target container configuration information according to the target container configuration information in the storage unit;
the monitoring module is used for monitoring whether original log configuration information corresponding to the target service container in the storage unit is reset by the control unit;
and the log processing module is used for processing the log corresponding to the target service container according to the reset target log configuration information if the original log configuration information is reset.
According to an aspect of the present disclosure, there is provided a computer storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the processing method of the Docker service container log of any one of the above.
According to an aspect of the present disclosure, there is provided an electronic device including:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the processing method of the Docker service container log of any one of the above items via execution of the executable instructions.
In the processing method of the Docker service container log in the exemplary embodiment of the present disclosure, when the service container is deployed based on the acquired container configuration information, the log configuration information corresponding to the corresponding service container is automatically loaded, and the service container log is processed according to the log configuration information. On one hand, the system automatically loads the log configuration information of the corresponding service container only through simple container configuration information without operating an online server, so that the processing efficiency of the service container log is improved; meanwhile, based on the log configuration information, the logs of one or more target service containers can be processed, so that the processing of the logs is more targeted, and the situations of configuration errors and the like caused by artificial configuration errors are avoided; on the other hand, the system can automatically process the logs of the corresponding service container based on the acquired container configuration information, excessive operation and maintenance manpower is not required to be invested, and the investment of human resources is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
fig. 1 schematically shows a flowchart of a processing method of a Docker service container log according to an exemplary embodiment of the present disclosure;
FIG. 2 schematically illustrates an architecture diagram of a Docker service container log processing system according to an exemplary embodiment of the present disclosure;
FIG. 3 schematically illustrates a packet diagram for a plurality of service containers at a node, according to an exemplary embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow diagram for obtaining a target service container according to target container configuration information, according to an exemplary embodiment of the present disclosure;
FIG. 5 schematically illustrates a flowchart of a method of processing a Docker service container log according to another exemplary embodiment of the present disclosure;
FIG. 6 is a flowchart of processing a log corresponding to a target service container according to a log configuration file;
fig. 7 schematically shows a structural diagram of a processing apparatus of a Docker service container log according to an exemplary embodiment of the present disclosure;
fig. 8 schematically illustrates a structural diagram of a processing apparatus of a Docker service container log according to another exemplary embodiment of the present disclosure;
FIG. 9 schematically illustrates a schematic diagram of a storage medium according to an exemplary embodiment of the present disclosure; and
fig. 10 schematically shows a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
Exemplary embodiments will now be described more fully with reference to the accompanying drawings. The exemplary embodiments, however, may be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and thus their detailed description will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known structures, methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in the form of software, or in one or more software-hardened modules, or in different networks and/or processor devices and/or microcontroller devices.
In the related art in this field, the collection of the Docker service container log mainly includes three types: the external collection of the container is to hang the host disk as a log directory and a file in the container and collect the log on the host; the in-container collection is to run a background log collection service in a service container so as to collect logs; and (4) collecting by a network, and directly sending the log to a log center by the application in the container through the network.
Correspondingly, the method for collecting the logs of the Docker service container in the related art has the following defects: in the related technology, a single Docker service container is mainly aimed at, and when multiple services are operated in the Docker, logs generated by the Docker service container include logs of the service container and logs generated by applications operated in the service container, and the related technology is difficult to purposefully collect the logs of different types; meanwhile, after the service container is offline, the existing log configuration information cannot be deleted, so that the waste of resource space is caused; in addition, in the related art, the service containers need to be configured separately, so that the clustered management cannot be realized, and a large amount of operation and maintenance manpower is required.
At present, the Docker container service has been related to a variety of application scenarios, such as using the Docker container as a cloud host, as a service, or as a micro-architecture service; the Doker container is applied to the field of scientific computing services, the fields of games and internet networking and the like.
Based on this, in the present exemplary embodiment, a method of processing a Docker service container log is first provided. Fig. 1 is a flowchart illustrating a processing method of a Docker service container log according to an exemplary embodiment of the disclosure, where the method is applied to a control unit in a log processing system for managing configuration information corresponding to a service container, and the log processing system further includes the service container, a storage unit for storing the configuration information corresponding to the service container, and a processing unit for performing log processing on the service container according to the configuration information.
Referring to fig. 1, the method for processing a Docker service container log may include the following steps:
step S110: acquiring container configuration information corresponding to the service container from the storage unit;
step S120: executing deployment operation on a service container corresponding to the target container configuration information according to the target container configuration information to acquire a target service container, wherein the target container configuration information is contained in the container configuration information;
step S130: generating target log configuration information according to the deployment operation;
step S140: and resetting original log configuration information corresponding to the target service container in the storage unit by adopting the target log configuration information so that the processing unit processes the log corresponding to the target service container according to the target log configuration information.
According to the processing method of the Docker service container log in the embodiment, on one hand, the system automatically loads the log configuration information of the corresponding service container only through simple container configuration information without performing operation on an online server, so that the processing efficiency of the service container log is improved; meanwhile, based on the log configuration information, the logs of one or more target service containers can be processed, so that the processing of the logs is more targeted, and the situations of configuration errors and the like caused by artificial configuration errors are avoided; on the other hand, the system can automatically process the logs of the corresponding service container based on the acquired container configuration information, excessive operation and maintenance manpower is not required to be invested, and the investment of human resources is reduced.
A further description will be given below of a processing method of a Docker service container log in the present exemplary embodiment, where an execution subject of the method is a control unit in a log processing system for managing configuration information corresponding to a service container.
In step S110, container configuration information corresponding to the service container is acquired from the storage unit.
In an exemplary embodiment of the present disclosure, the storage unit is a database that stores container configuration information related to start or stop of all service containers and log configuration information corresponding to the service containers in the log processing system, and is stored as configuration information of a Docker service container. The log configuration information in the storage unit comprises a container identifier of a service container and a log type label; the container configuration information includes start configuration information and stop configuration information, and specifically, the start configuration information refers to configuration information for starting one or more target service containers; the stop configuration information refers to the configuration information for stopping one or more target service containers, i.e. the configuration information for taking the target service containers offline.
Fig. 2 is an architecture diagram of the Docker service container log processing system, and as shown in fig. 2, the control unit may monitor, in real time, whether container configuration information newly added by an administrator exists in the container configuration information in the storage unit by calling a preset interface connected to the storage unit, and acquire corresponding container configuration information. In addition, the container configuration information and the log configuration information in the storage unit may be stored in a key/value (a database type) key value pair form, and of course, a corresponding data storage form may also be adopted according to different actual requirements.
Further, the log configuration information in the storage unit may further include common configuration information and node configuration information, where the common configuration information is configuration information shared by all service containers, and the node configuration information is configuration information only for a service container corresponding to the node. In addition, for the collection of multiple logs of multiple service containers on a node, grouping may also be performed by using container identifiers of the service containers, and grouping may also be performed according to a log processing path under a certain group, specifically, fig. 3 shows a grouping schematic diagram of multiple service containers on a certain node, as shown in fig. 3, for multiple service containers (Docker 1, Docker 2, Docker 3, and Docker 4) under a node, grouping is performed according to identifiers of the containers, which are respectively a group 1 and a group 2; under the group 1, the log processing paths of both Docker 1 and Docker 2 are storage path 1, so that Docker 1 and Docker 2 are divided into a group, and Docker 3 with storage path 2 as a storage path is used as a group. Based on different groups, the log processing system can collect logs of a certain service container, can also collect logs of a plurality of service containers at the same time, and stores the collected logs in a preset path, so that the processing efficiency of the service logs is improved.
It should be noted that, the log configuration information in the storage unit may also be changed according to actual needs, so as to more conveniently process the log of the service container according to the log configuration information.
In step S120, a deployment operation is performed on a service container corresponding to target container configuration information according to the target container configuration information to obtain a target service container, where the target container configuration information is included in the container configuration information.
In an exemplary embodiment of the present disclosure, since the storage unit stores therein container configuration information of service containers within the entire log processing system, container configuration information corresponding to a part(s) of the service containers, that is, target container configuration information, may be first acquired from the storage unit, and a deployment operation may be performed on the service container corresponding to the target container configuration information according to the target container configuration information. Specifically, fig. 4 shows a flowchart for acquiring the target service container according to the target container configuration information, and as can be seen from fig. 4, step S120 further includes step S410 and step S420: in step S410, it is determined whether container configuration information in the storage unit is changed; in step S420, if the container configuration information is changed, the changed container configuration information is used as target container configuration information, and a deployment operation is performed on a service container corresponding to the target container configuration information according to the target container configuration information to obtain a target service container.
Step S110 shows that the container configuration information includes start configuration information and stop configuration information, and if the target container configuration information is the start configuration information, a start operation is deployed to a service container corresponding to the target container configuration information to obtain a target service container; and if the target container configuration information is stop configuration information, deploying stop operation on the service container corresponding to the target container configuration information to acquire the target service. For example, as shown in fig. 2, if the target container configuration information is start configuration information, a start operation may be deployed to a corresponding service container Docker; if the target container configuration information is the stop configuration information, the destruction operation can be deployed to the corresponding service container Docker.
In step S130, target log configuration information is generated according to the deployment operation.
In an exemplary embodiment of the present disclosure, the deployment operation refers to performing a corresponding operation on a target service container corresponding to the target container configuration information according to the target container configuration information, where the deployment operation includes a start operation and a stop operation, that is, starting the target service container and taking the service container offline. Specifically, if a service container deployment starting operation corresponding to the target container configuration information is performed, generating log collection configuration information, and merging the log collection configuration information and a container identifier of the service container to generate target log configuration information; and if the service container corresponding to the target container configuration information is subjected to deployment stop operation, generating log deletion configuration information, and merging the log deletion configuration information and the container identifier of the service container to generate target log configuration information. The original log configuration information stored in the storage unit and the container identifier of the service container are combined through generation of the target log configuration information to obtain the target container configuration information, so that the subsequent processing of the log of the corresponding target service container according to the target container configuration information is facilitated, and the processing of the log has higher pertinence.
In step S140, the target log configuration information is used to reset the original log configuration information corresponding to the target service container in the storage unit, so that the processing unit processes the log corresponding to the target service container according to the target log configuration information.
In an exemplary embodiment of the present disclosure, original log configuration information corresponding to a target service container in a storage unit is reset with target log configuration information, and specifically, if the target log configuration information is log collection or log filtering information, the target log configuration information is used to override the corresponding original log configuration information in the storage unit; and if the target log configuration information is log deletion information, deleting the original log configuration information corresponding to the target service container according to the log deletion information.
Further, as shown in fig. 2, the reset target log configuration information is stored in the storage unit, so that the processing unit detects the target log configuration information and performs a processing operation on the log corresponding to the target service container according to the target log configuration information.
In summary, the control unit in the log processing system for managing the configuration information corresponding to the service container serves as a control management service center of the log processing system, and by monitoring and acquiring changes of the container configuration information in the storage unit, performing corresponding service container deployment operation according to the container configuration information, and generating a target log configuration according to the corresponding deployment operation, the whole system can automatically complete processing of the service container log under management thereof, thereby improving efficiency of log processing.
The technical solution of the exemplary embodiment of the present disclosure shown in fig. 1 is to explain a processing method of a Docker service container log of the exemplary embodiment of the present disclosure from the perspective of a control unit (i.e., a control unit in a log processing system for managing configuration information corresponding to a service container), and the following explains the processing method of the Docker service container log of the exemplary embodiment of the present disclosure from the perspective of a processing unit in the log processing system that logs a service container according to configuration information, with reference to fig. 5:
step S510: and acquiring a target service container corresponding to the target container configuration information according to the target container configuration information in the storage unit.
In an exemplary embodiment of the present disclosure, the target container configuration information is changed container configuration information in the storage unit, and a service container obtained by the control unit performing a deployment operation on a service container corresponding to the target container configuration information according to the target container configuration information may be acquired as the target service container.
Step S520: monitoring whether original log configuration information corresponding to the target service container in the storage unit is reset by the control unit.
In an exemplary embodiment of the present disclosure, the processing unit is configured to monitor whether the log configuration information in the storage unit is reset in real time, so as to perform a corresponding log processing operation according to the reset log configuration information.
Step S530: and if the original log configuration information is reset, processing the log corresponding to the target service container according to the reset target log configuration information.
In an exemplary embodiment of the present disclosure, since the log configuration information in the storage unit is not configuration information that can be directly recognized by the processing unit, if it is detected that the original log configuration information of the target service container is reset, the reset target log configuration information is rendered through a preset template to obtain current log configuration information; and then, generating a log configuration file according to the current log configuration information, and processing the log corresponding to the target service container according to the log configuration file. It should be noted that the target log configuration information after the reset includes log collection information, log filtering information, and log deletion information, and correspondingly, the log configuration file generated according to the log configuration information also includes the log collection information, the log filtering information, and the log deletion information. Of course, for some non-fixed configurations, there is no fixed template for rendering, and the log configuration file can also be generated directly from the related log configuration information.
In addition, the log configuration file comprises a container identifier corresponding to the target service container and a log type of the log to be processed; specifically, fig. 6 shows a flowchart of processing a log corresponding to a target service container according to a log configuration file, and as shown in fig. 6, the log processing procedure includes steps S610 and S620: in step S610, a log path corresponding to the target service container is obtained according to the container identifier and the log type of the log to be processed; in step S620, a log corresponding to the target service container in the log path is obtained according to the log path, and the log is processed. Specifically, log collection information, log filtering information, or log deletion information is performed on the log of the corresponding target service container according to the log path corresponding to the target service container.
If the reset target log configuration information is log collection information, a log configuration file is generated according to the log collection information, and after the logs of the target service container are collected according to the log configuration file, the collected logs can be output to a preset storage center, wherein the preset storage center can be one of real-time log storage services, and the preset storage center is not particularly limited by the disclosure. It should be noted that, the processing unit may also mount the log of the corresponding target service container obtained according to the target log configuration information to a corresponding path of the appointed host, and then output the log to the preset storage center according to the actual requirement.
In addition, user-defined log configuration information of a user can be obtained, and a log configuration file is generated according to the user-defined log configuration information; and then processing the log corresponding to the target service container according to the log configuration file. Specifically, when processing the container log of the service container, on one hand, the deployment of the container and the processing of the log of the corresponding target service container can be automatically loaded according to the container configuration information in the above manner; on the other hand, the collection of the service container self log or the output path of the unified log can also be realized by adding corresponding parameters when the processing unit starts up. For example, when the processing unit configures a log that collects service containers themselves in a gelf (application log driven) manner, log _ config configuration information may be added to configuration parameters at the time of starting the processing unit, based on the configuration information, the processing unit may be triggered to generate a corresponding log configuration file, and collect the service containers' own logs according to the log configuration file, which is, of course, a user manually adds custom configuration information according to actual needs.
In addition, in an exemplary embodiment of the present disclosure, a processing apparatus of a Docker service container log is further provided, which is applied to a control unit in a log processing system for managing configuration information corresponding to a service container, where the log processing system further includes the service container, a storage unit for storing the configuration information corresponding to the service container, and a processing unit for performing log processing on the service container according to the configuration information.
Referring to fig. 7, the apparatus 700 for processing a Docker service container log may include a container configuration information obtaining module 710, a target service container obtaining module 720, a log configuration information generating module 730, and a log processing module 740. In particular, the amount of the solvent to be used,
a container configuration information obtaining module 710, configured to obtain container configuration information corresponding to the service container from the storage unit;
a target service container obtaining module 720, configured to perform a deployment operation on a service container corresponding to target container configuration information according to the target container configuration information, so as to obtain a target service container, where the target container configuration information is included in the container configuration information;
a log configuration information generating module 730, configured to generate target log configuration information according to the deployment operation;
the log processing module 740 is configured to reset, by using the target log configuration information, original log configuration information corresponding to the target service container in the storage unit, so that the processing unit processes a log corresponding to the target service container according to the target log configuration information.
Fig. 8 illustrates a processing apparatus of a Docker service container log according to another exemplary embodiment of the disclosure, which is applied to a processing unit that performs log processing on a service container according to configuration information in a log processing system, where the log processing system further includes a service container, a storage unit that stores the configuration information corresponding to the service container, and a control unit that manages the configuration information corresponding to the service container; the device 800 for processing the Docker service container log may include a target service container obtaining module 810, a monitoring module 820, and a log processing module 830. In particular, the amount of the solvent to be used,
a target service container obtaining module 810, configured to obtain a target service container corresponding to the target container configuration information according to the target container configuration information in the storage unit;
a monitoring module 820, configured to monitor whether original log configuration information corresponding to the target service container in the storage unit is reset by the control unit;
the log processing module 830 is configured to, if the original log configuration information is reset, process a log corresponding to the target service container according to the reset target log configuration information.
The specific details of each module/unit in the above-mentioned apparatus have been described in detail in the embodiments of the method section, and thus are not described again.
In addition, in the exemplary embodiments of the present disclosure, a computer storage medium capable of implementing the above method is also provided. On which a program product capable of implementing the above-described method of the present specification is stored. In some possible embodiments, aspects of the present disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the present disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
Referring to fig. 9, a program product 900 for implementing the above method according to an exemplary embodiment of the present disclosure is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided. As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 1000 according to such an embodiment of the present disclosure is described below with reference to fig. 10. The electronic device 1000 shown in fig. 10 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 10, the electronic device 1000 is embodied in the form of a general purpose computing device. The components of the electronic device 1000 may include, but are not limited to: the at least one processing unit 1010, the at least one memory unit 1020, a bus 1030 connecting different system components (including the memory unit 1020 and the processing unit 1010), and a display unit 1040.
Wherein the storage unit stores program code that is executable by the processing unit 1010 to cause the processing unit 1010 to perform steps according to various exemplary embodiments of the present disclosure described in the "exemplary methods" section above in this specification.
The memory unit 1020 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)1021 and/or a cache memory unit 1022, and may further include a read-only memory unit (ROM) 1023.
Storage unit 1020 may also include a program/utility 1024 having a set (at least one) of program modules 1025, such program modules 1025 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 1030 may be any one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, and a local bus using any of a variety of bus architectures.
The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 1000, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 1000 to communicate with one or more other computing devices. Such communication may occur through input/output (I/O) interfaces 1050. Also, the electronic device 1000 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via the network adapter 1060. As shown, the network adapter 1060 communicates with the other modules of the electronic device 1000 over the bus 1030. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (15)

1. A processing method of Docker service container logs is applied to a control unit which is used for managing configuration information corresponding to a service container in a log processing system, and the log processing system also comprises the service container, a storage unit which is used for storing the configuration information corresponding to the service container and a processing unit which is used for processing the logs of the service container according to the configuration information; characterized in that the method comprises:
acquiring container configuration information corresponding to the service container from the storage unit;
executing deployment operation on a service container corresponding to the target container configuration information according to the target container configuration information to acquire a target service container, wherein the target container configuration information is contained in the container configuration information;
generating log configuration information according to the deployment operation, and merging the log configuration information with the container identifier of the service container to generate target log configuration information;
and resetting original log configuration information corresponding to the target service container in the storage unit by adopting the target log configuration information so that the processing unit processes the log corresponding to the target service container according to the target log configuration information.
2. The method for processing the Docker service container log of claim 1, wherein the obtaining the container configuration information corresponding to the service container from the storage unit comprises:
and acquiring the container configuration information by calling a preset interface connected with the storage unit.
3. The method for processing the Docker service container log according to claim 1, wherein the performing, according to the target container configuration information, a deployment operation on the service container corresponding to the target container configuration information to obtain the target service container comprises:
judging whether the container configuration information in the storage unit is changed or not;
if the container configuration information is changed, the changed container configuration information is used as the target container configuration information, and deployment operation is performed on the service container corresponding to the target container configuration information according to the target container configuration information, so that a target service container is obtained.
4. The Docker service container log processing method according to claim 3, wherein the container configuration information includes start configuration information and stop configuration information;
if the container configuration information changes, taking the changed container configuration information as the target container configuration information, and executing deployment operation on a service container corresponding to the target container configuration information according to the target container configuration information to acquire a target service container, including:
if the target container configuration information is start configuration information, deploying start operation on a service container corresponding to the target container configuration information to obtain the target service container;
and if the target container configuration information is stop configuration information, deploying stop operation on the service container corresponding to the target container configuration information to acquire the target service container.
5. The Docker service container log processing method according to claim 4, wherein the generating log configuration information according to the deployment operation and merging the log configuration information with the container identifier of the service container to generate target log configuration information includes:
if the service container corresponding to the target container configuration information is deployed and started, generating log collection configuration information, and merging the log collection configuration information and the container identifier of the service container to generate the target log configuration information;
and if the service container corresponding to the target container configuration information is deployed and stopped, generating log deletion configuration information, and combining the log deletion configuration information with the container identifier of the service container to generate the target log configuration information.
6. A processing method of Docker service container logs is applied to a processing unit which carries out log processing on service containers according to configuration information in a log processing system, and the log processing system also comprises the service containers, a storage unit which is used for storing the configuration information corresponding to the service containers and a control unit which is used for managing the configuration information corresponding to the service containers; characterized in that the method comprises:
acquiring a target service container corresponding to the target container configuration information according to the target container configuration information in the storage unit;
monitoring whether original log configuration information corresponding to the target service container in the storage unit is reset by the control unit;
if the original log configuration information is reset, rendering the reset target log configuration information through a preset template to generate a log configuration file, and processing the log corresponding to the target service container according to the log configuration file.
7. The method for processing the logs of the Docker service container as claimed in claim 6, wherein the step of rendering the re-configured target log configuration information through a preset template to generate a log configuration file, and processing the log corresponding to the target service container according to the log configuration file comprises:
rendering the reset target log configuration information through the preset template to acquire current log configuration information;
and generating the log configuration file according to the current log configuration information, and processing the log corresponding to the target service container according to the log configuration file.
8. The Docker service container log processing method according to claim 7, wherein the log configuration file includes a container identifier corresponding to the target service container and a log type of a log to be processed;
the processing the log corresponding to the target service container according to the log configuration file includes:
acquiring a log path corresponding to the target service container according to the container identifier and the log type of the log to be processed;
and acquiring a log corresponding to the target service container under the log path according to the log path, and processing the log.
9. The Docker service container log processing method according to any one of claims 6 to 8, wherein the reset target log configuration information includes log collection information, log filtering information, and log deletion information.
10. The method for processing the Docker service container log of claim 9, wherein when the reset target log configuration information is log collection information, the method further comprises:
and collecting the logs of the target service container according to the log collection information, and outputting the logs to a preset storage center.
11. The method of processing a Docker service container log of claim 6, wherein the method further comprises:
obtaining user-defined log configuration information of a user, and generating a log configuration file according to the user-defined log configuration information;
and processing the log corresponding to the target service container according to the log configuration file.
12. A processing device of a Docker service container log is applied to a control unit which is used for managing configuration information corresponding to a service container in a log processing system, and the log processing system also comprises the service container, a storage unit which is used for storing the configuration information corresponding to the service container and a processing unit which is used for performing log processing on the service container according to the configuration information; the device for processing the log of the docker service container is characterized by comprising the following steps:
a container configuration information obtaining module, configured to obtain container configuration information corresponding to the service container from the storage unit;
a target service container obtaining module, configured to perform a deployment operation on a service container corresponding to target container configuration information according to the target container configuration information, so as to obtain a target service container, where the target container configuration information is included in the container configuration information;
the log configuration information generation module is used for generating log configuration information according to the deployment operation and merging the log configuration information with the container identifier of the service container to generate target log configuration information;
and the log processing module is used for resetting the original log configuration information corresponding to the target service container in the storage unit by adopting the target log configuration information so as to enable the processing unit to process the log corresponding to the target service container according to the target log configuration information.
13. A processing device of a Docker service container log is applied to a processing unit which processes the log of a service container according to configuration information in a log processing system, and the log processing system also comprises the service container, a storage unit which is used for storing the configuration information corresponding to the service container and a control unit which is used for managing the configuration information corresponding to the service container; the device for processing the Docker service container log is characterized by comprising the following devices:
a target service container obtaining module, configured to obtain a target service container corresponding to the target container configuration information according to the target container configuration information in the storage unit;
the monitoring module is used for monitoring whether original log configuration information corresponding to the target service container in the storage unit is reset by the control unit;
and the log processing module is used for rendering the reset target log configuration information through a preset template to generate a log configuration file if the original log configuration information is reset, and processing the log corresponding to the target service container according to the log configuration file.
14. A storage medium having stored thereon a computer program which, when executed by a processor, implements a method of processing a Docker service container log according to any of claims 1 to 11.
15. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of processing a Docker service container log of any of claims 1-11 via execution of the executable instructions.
CN201811555180.4A 2018-12-18 2018-12-18 Docker service container log processing method and device and electronic equipment Active CN109684038B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811555180.4A CN109684038B (en) 2018-12-18 2018-12-18 Docker service container log processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811555180.4A CN109684038B (en) 2018-12-18 2018-12-18 Docker service container log processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109684038A CN109684038A (en) 2019-04-26
CN109684038B true CN109684038B (en) 2020-12-08

Family

ID=66186820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811555180.4A Active CN109684038B (en) 2018-12-18 2018-12-18 Docker service container log processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109684038B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287154A (en) * 2019-06-06 2019-09-27 郑州阿帕斯科技有限公司 The querying method and device of container log
CN110442506B (en) * 2019-08-16 2023-12-12 上海智臻智能网络科技股份有限公司 Log acquisition method, device, service server, system and storage medium
CN110716763B (en) * 2019-09-10 2024-05-17 北京神州数码云科信息技术有限公司 Automatic optimization method and device for web container, storage medium and electronic equipment
CN111367573B (en) * 2020-03-12 2021-10-22 腾讯科技(深圳)有限公司 Equipment login method, device, storage medium and computer equipment
CN112506755B (en) * 2020-12-18 2023-11-03 北京顺达同行科技有限公司 Log acquisition method, device, computer equipment and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101810762B1 (en) * 2015-12-07 2017-12-19 한양대학교 에리카산학협력단 Docker container security log analysis method and system based on hadoop distributed file system in cloud environment
CN106383852B (en) * 2016-08-30 2019-11-05 中国民生银行股份有限公司 Journal obtaining method and device based on Docker container
CN106776064B (en) * 2016-11-29 2020-06-09 北京元心科技有限公司 Method and device for managing logs in multiple systems
CN107426023B (en) * 2017-07-21 2020-05-29 携程旅游信息技术(上海)有限公司 Cloud platform log collection and forwarding method, system, equipment and storage medium
CN107797767B (en) * 2017-09-30 2019-07-26 南京卓盛云信息科技有限公司 One kind is based on container technique deployment distributed memory system and its storage method
CN108039975B (en) * 2017-12-21 2020-08-28 北京搜狐新媒体信息技术有限公司 Container cluster management system and application method thereof
CN108845862A (en) * 2018-05-25 2018-11-20 浪潮软件集团有限公司 Multi-container management method and device

Also Published As

Publication number Publication date
CN109684038A (en) 2019-04-26

Similar Documents

Publication Publication Date Title
CN109684038B (en) Docker service container log processing method and device and electronic equipment
US10735345B2 (en) Orchestrating computing resources between different computing environments
WO2020253347A1 (en) Container cluster management method, device and system
US10129373B2 (en) Recovery of a network infrastructure to facilitate business continuity
CN113742031B (en) Node state information acquisition method and device, electronic equipment and readable storage medium
US9317380B2 (en) Preserving management services with self-contained metadata through the disaster recovery life cycle
CN110221910B (en) Method and apparatus for performing MPI jobs
CN111966465B (en) Method, system, equipment and medium for modifying host configuration parameters in real time
US10305817B1 (en) Provisioning system and method for a distributed computing environment using a map reduce process
CN110851234A (en) Log processing method and device based on docker container
CN111679911A (en) Management method, device, equipment and medium for GPU (graphics processing Unit) card in cloud environment
CN108009010B (en) Management device, system, method, electronic device and storage medium for thin client
US10176067B1 (en) On-demand diagnostics in a virtual environment
US9959133B2 (en) Identification and removal of zombie virtual machines
CN114489954A (en) Tenant creation method based on virtualization platform, tenant access method and equipment
CN111352664A (en) Distributed machine learning task starting method, system, equipment and storage medium
CN107861821B (en) Mining method and device for module call relation and computer readable medium
CN117724803A (en) Cloud service deployment method, device and platform
US20210144232A1 (en) Computing pod services simulator
CN109491762B (en) Container state control method and device, storage medium and electronic equipment
CN112068953A (en) Cloud resource fine management traceability system and method
CN111162938A (en) Data processing system and method
CN116755839A (en) Operation terminal instance generation method, apparatus, device, medium and program product
CN112416744B (en) Test control system, method and equipment
CN112003727A (en) Multi-node server power supply testing method, system, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant