A ceph-based object gateway log collection and storage system and method

By using a Ceph-based object gateway log collection and storage system, the problems of low reliability and high system complexity in object gateway log storage are solved. It achieves user-based bucketed storage and efficient log analysis, ensuring the integrity of log data and the convenience of analysis.

CN117255014BActive Publication Date: 2026-11-20CHINA TELECOM DIGITAL INTELLIGENCE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311249551.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2026-11-20
Estimated Expiration
2043-09-26

AI Technical Summary

Technical Problem

In existing technologies, Ceph object storage's object gateway log storage lacks high reliability, log files are easily lost, and existing log collection systems are highly complex, resource-intensive, and unable to effectively classify and process logs according to user dimensions.

Method used

A Ceph-based object gateway log collection and storage system is adopted, including an Nginx service module, a log bucket service module, an Etcd database module, and a Ceph log bucket module. Through components such as load balancing, master-slave mode, filtering, and upload units, highly reliable log storage and user-based bucketed storage are achieved. Ceph's multi-replica and erasure coding modes are used to ensure data integrity, and the Etcd database is used for service registration and discovery.

Benefits of technology

It achieves highly reliable storage of object gateway logs, reduces system complexity and resource consumption, supports log analysis by user dimension, avoids log file loss, and downloads log files for analysis via S3 client.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117255014B_ABST
    Figure CN117255014B_ABST
Patent Text Reader

Abstract

The application discloses a kind of object gateway log collection storage systems and methods based on Ceph, comprising: Nginx service module, for forwarding client request to different application servers, provide data source for log bucket service;Log bucket service module is used to obtain the Nginx log of current node, and after processing Nginx log, it is uploaded to Ceph log bucket;Etcd database module is used to store the service information of log bucket service module;Ceph log bucket module is used to receive the Nginx log of all nodes after processing by log bucket service module, generates log file based on the Nginx log of all nodes, and uploads log file to the log bucket of each user;When user needs to obtain log, download log file for analysis by client;The application solves the problem of log file loss caused by disk damage and other reasons.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent operation and maintenance, and in particular relates to a Ceph-based object gateway log collection and storage system and method. Background Technology

[0002] In Ceph object storage, each user often needs to monitor their own access to the object gateway's logs to check the current service status and access volume. Currently, related technologies have the following problems:

[0003] (1) Currently, the logs of the object gateway are stored in the Nginx logs of the corresponding node, which does not have high reliability. If the physical disk is damaged, the log files will be lost.

[0004] (2) Currently, the Nginx logs of the gateway node store all the logs of accessing this gateway, but each user only cares about their own access logs. Therefore, the logs need to be summarized, sorted, and classified according to the user dimension.

[0005] (3) Current log collection systems rely on too many heavy components, such as ELK, which requires the deployment of multiple components and consideration of the high availability and maintenance costs of each component. Furthermore, Ceph itself is a distributed storage software, and introducing new distributed storage software to store logs would only increase the complexity and redundancy of the system.

[0006] Therefore, providing a Ceph-based object gateway log collection and storage system is crucial for users or operations and maintenance personnel to analyze and extract logs. Summary of the Invention

[0007] The purpose of this invention is to ensure the high reliability of object gateway logs and user-based bucketed storage, and to solve the problem that introducing current mature log collection and storage systems would increase system complexity and consume system CPU, memory and other resources.

[0008] To achieve the above objectives, the present invention provides the following solution: a Ceph-based object gateway log collection and storage system and method. The Ceph-based object gateway log collection and storage system includes:

[0009] The Nginx service module is used to forward client requests to different application servers and provide a data source for the log bucket service;

[0010] The log bucket service module is connected to the Nginx service module and is used to obtain the Nginx logs of the current node, process the Nginx logs, and upload them to the Ceph log bucket module.

[0011] The Etcd database module is connected to the log bucket service module and is used to store the service information of the log bucket service module.

[0012] The Ceph log bucket module, connected to the log bucket service module, receives Nginx logs from all nodes after processing by the log bucket service module, generates log files based on the Nginx logs from all nodes, and uploads the log files to each user's log bucket; when a user needs to obtain logs, they download the log files through the client for analysis.

[0013] The Ceph master bucket module is connected to the log bucket service module and is used to store the temporary log files of all object gateway nodes within the last 5 minutes after being filtered and processed by the log bucket service module, so that the log bucket service module can retrieve them again.

[0014] Preferably, the Nginx service module includes a load balancing unit and a data acquisition unit;

[0015] The load balancing unit is used to forward client requests to different application servers according to a weight or round-robin algorithm;

[0016] The data acquisition unit is used to generate log bucket data, which is generated based on the Nginx logs of each node.

[0017] Preferably, the log bucket service module includes a primary / standby mode unit, a service unit, a filtering unit, a processing unit, and an upload unit;

[0018] The primary / backup mode unit is used to divide primary and backup nodes, with one primary and multiple backups. Both primary and backup nodes are used to process local logs and upload the processed local logs to the primary bucket. The primary node then aggregates all node logs to generate log files that are uploaded to the log bucket.

[0019] The service unit is used for service registration and service discovery to ensure that each log bucket service can obtain all node information and primary / backup information, and to remove a service in a timely manner when it becomes unavailable.

[0020] The filtering unit is used to filter Nginx logs that do not meet the requirements and logs that users do not care about;

[0021] The processing unit is used to process, integrate, and sort Nginx logs that meet the requirements;

[0022] The upload unit is used to upload the processed Nginx logs to the log bucket corresponding to each object user, for subsequent troubleshooting and analysis by maintenance personnel.

[0023] Preferably, the Etcd database module includes a first storage unit, a second storage unit, and a third storage unit;

[0024] The first storage unit is used to store node information for the log bucket service, and the node information is used for service discovery and service registration of the log bucket service.

[0025] The second storage unit is used to store the primary and backup information for the log bucket service;

[0026] The third storage unit is used to store the variable information required for log bucket calculations.

[0027] Preferably, the variable information includes the number of bytes processed today, the number of bytes processed yesterday, and an indicator indicating whether the logs within the current 5 minutes have been processed.

[0028] Preferably, the Ceph log bucket module includes a file generation unit, a file upload unit, and a file analysis unit;

[0029] The file generation unit is used to generate log files after processing all the Nginx logs of the nodes by the log bucket service module.

[0030] The file upload unit is used to upload the log file to each user's log bucket;

[0031] The file analysis unit is used to download and analyze log files via a client when a user needs to obtain logs.

[0032] Preferably, the number of log files depends on how many object users generated Nginx logs.

[0033] This invention also provides a method for collecting and storing object gateway logs based on Ceph, comprising the following steps:

[0034] Record request logs related to Nginx proxy and configure the Nginx log format so that the log format generated by Nginx meets the requirements of the log bucket service for parsing.

[0035] The log bucket service starts a scheduled task to retrieve Nginx logs from the local node within the last 5 minutes and perform filtering and time format adjustment.

[0036] Each log bucket service stores the logs processed by the current node into the main bucket as files;

[0037] Based on the Etcd database, the completion flag of this scheduled task is set to True, and the number of bytes processed in the Nginx log is updated so that when the next task starts in 5 minutes, it continues processing from the position of the last processing.

[0038] When the master node of the log bucket service detects that all nodes have finished processing, it reads the log files of all nodes from the master bucket, processes them by format and sorts them, and writes them to the log files of each object user according to the object user dimension, and then uploads the log files to the log bucket of each object user.

[0039] After the upload is complete, delete all temporary log files in the main bucket, update the flag in the Etcd database to check if all nodes have finished processing, and wait for the next 5-minute scheduled task to begin.

[0040] Compared with the prior art, the present invention has the following advantages and technical effects:

[0041] This invention uses Ceph buckets to store object gateway logs. The buckets support both multi-replica and erasure coding modes, which greatly ensures the reliability of log data. Even if a disk is damaged, it will automatically adjust and recover.

[0042] The Ceph system of this invention is itself a distributed storage system, and it can achieve highly reliable storage of object user access logs without introducing a new log distributed storage system.

[0043] When maintenance personnel or users need to obtain logs for analysis, the storage system and method of the present invention do not require downloading a specific client. They only need to download any S3 client available on the market to download logs for the desired time period from the storage bucket. Attached Figure Description

[0044] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0045] Figure 1 This is a schematic diagram of the system workflow according to an embodiment of the present invention. Detailed Implementation

[0046] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0047] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0048] Example 1

[0049] like Figure 1As shown, the present invention provides a Ceph-based object gateway log collection and storage system, comprising:

[0050] The Nginx service module is used to forward client requests to different application servers and obtain Nginx logs for each node.

[0051] The log bucket service module connects to the Nginx service module to obtain the Nginx logs of the current node, process the Nginx logs, and then upload them to the Ceph log bucket module.

[0052] The Etcd database module connects to the log bucket service module and is used to store service information of the log bucket service module.

[0053] The Ceph log bucket module connects to the log bucket service module. It receives Nginx logs from all nodes after processing by the log bucket service module, generates log files based on the Nginx logs from all nodes, and uploads the log files to each user's log bucket. When a user needs to retrieve logs, they can download the log files through the client for analysis.

[0054] The Ceph master bucket module connects to the log bucket service module and stores temporary log files from all object gateway nodes within the last 5 minutes, after being filtered and processed by the log bucket service module, for the log bucket service module to retrieve again.

[0055] Further optimization of the scheme: the Nginx service module includes a load balancing unit and a data acquisition unit;

[0056] The load balancing unit is used to forward client requests to different application servers according to weight or round-robin algorithms.

[0057] The data acquisition unit is used to generate log bucket data, and obtains the Nginx logs of each node based on the log bucket data.

[0058] To further optimize the solution, the log bucket service module includes a primary / standby mode unit, a service unit, a filtering unit, a processing unit, and an upload unit.

[0059] Among them, the primary and backup mode unit is used to divide primary and backup nodes, with one primary and multiple backups. Both primary and backup nodes are used to process local logs and upload the processed local logs to the primary bucket. The primary node then aggregates all node logs to generate log files that are uploaded to the log bucket.

[0060] The service unit is used for service registration and service discovery to ensure that each log bucket service can obtain all node information and primary / backup information, and to remove a service in a timely manner when it becomes unavailable.

[0061] The filtering unit is used to filter out Nginx logs that do not meet the requirements and logs that users do not care about;

[0062] The processing unit is used to process, integrate, and sort Nginx logs that meet the requirements;

[0063] The upload unit is used to upload the processed Nginx logs to the log bucket corresponding to each object user, for subsequent troubleshooting and analysis by operations and maintenance personnel.

[0064] A further optimized solution is provided, wherein the Etcd database module includes a first storage unit, a second storage unit, and a third storage unit;

[0065] The first storage unit is used to store node information for the log bucket service, and the node information is used for service discovery and service registration for the log bucket service.

[0066] The second storage unit is used to store primary and backup information for the log bucket service;

[0067] The third storage unit is used to store the variable information required for log bucket calculations.

[0068] To further optimize the scheme, the variable information includes the number of bytes processed today, the number of bytes processed yesterday, and an indicator of whether the logs within the current 5 minutes have been processed.

[0069] To further optimize the solution, the Ceph log bucket module includes a file generation unit, a file upload unit, and a file analysis unit;

[0070] The file generation unit is used to generate log files from the Nginx logs of all nodes after the log bucket service module has finished processing them.

[0071] The file upload unit is used to upload log files to each user's log bucket;

[0072] The file analysis unit is used to download log files for analysis via the client when a user needs to obtain logs.

[0073] Further optimization of the solution involves adjusting the number of log files based on the number of object users generating Nginx logs.

[0074] Example 2

[0075] This invention also provides a method for collecting and storing object gateway logs based on Ceph, comprising the following steps:

[0076] First, configure the Nginx log format so that the log format generated by Nginx meets the requirements of the log bucket service for parsing.

[0077] All log bucket services (S3log) will start a scheduled task every 5 minutes. Each time the task starts, it will retrieve the Nginx logs from the local node within the last 5 minutes and perform a series of processing such as filtering and time format adjustment.

[0078] Each log bucket service stores the logs processed by this node into the main bucket as files. Then, in Etcd, it sets the flag indicating that the current scheduled task has been completed to True and updates the number of bytes processed by the Nginx log so that when the next task starts in 5 minutes, it can continue processing from where it left off.

[0079] Once the master node of the log bucket service detects that all nodes have finished processing, it reads the log files of all nodes from the master bucket, processes them by format and sort, and then writes them to the log files of each object user according to the object user dimension. Finally, it uploads the log files to the log bucket of each object user.

[0080] After processing is complete, delete all temporary log files in the main bucket.

[0081] After processing is complete, update a series of flags in Etcd, such as whether all nodes have finished processing, and then wait for the next 5-minute scheduled task to begin.

[0082] The storage method in this invention records request logs related to Nginx proxy operations, including upload and download operations, to extract key business data and quickly view and locate problems.

[0083] Based on Ceph object storage buckets, a log bucket is automatically created for each object user to store logs collected, processed, and aggregated from all nodes for that object user, ensuring high log reliability. A main bucket is also created to store temporary log files for all gateway nodes, storing temporary log data within 5 minutes.

[0084] The service registration and service discovery functions based on the Etcd database are used to complete the leader election logic and monitor whether each node has completed the processing.

[0085] Load balancing and HTTPS proxying are based on Nginx, and object gateway log data is stored in buckets for each object user in Ceph, which solves the problem of log file loss caused by disk damage and other reasons.

[0086] Since Ceph itself is a distributed storage software, this invention solves the problem of high-reliability storage of object gateway logs without introducing a new log processing and storage system.

[0087] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A Ceph-based object gateway log collection and storage system, characterized in that, include: The Nginx service module is used to forward client requests to different application servers and provide a data source for the log bucket service; The log bucket service module is connected to the Nginx service module and is used to obtain the Nginx logs of the current node, process the Nginx logs, and upload them to the Ceph log bucket module. The Etcd database module is connected to the log bucket service module and is used to store the service information of the log bucket service module. The Ceph log bucket module is connected to the log bucket service module. It is used to receive Nginx logs from all nodes after they have been processed by the log bucket service module, generate log files based on the Nginx logs from all nodes, and upload the log files to each user's log bucket. When a user needs to obtain logs, the log file is downloaded and analyzed via the client. The Ceph master bucket module is connected to the log bucket service module and is used to store the temporary log files of all object gateway nodes within the last 5 minutes after being filtered and processed by the log bucket service module, so that the log bucket service module can retrieve them again.

2. The Ceph-based object gateway log collection and storage system according to claim 1, characterized in that, The Nginx service module includes a load balancing unit and a data acquisition unit; The load balancing unit is used to forward client requests to different application servers according to a weight or round-robin algorithm; The data acquisition unit is used to generate log bucket data, which is generated based on the Nginx logs of each node.

3. The Ceph-based object gateway log collection and storage system according to claim 1, characterized in that, The log bucket service module includes a primary / standby mode unit, a service unit, a filtering unit, a processing unit, and an upload unit; The primary / backup mode unit is used to divide primary and backup nodes, with one primary and multiple backups. Both primary and backup nodes are used to process local logs and upload the processed local logs to the primary bucket. The primary node then aggregates all node logs to generate log files that are uploaded to the log bucket. The service unit is used for service registration and service discovery to ensure that each log bucket service can obtain all node information and primary / backup information, and to remove a service in a timely manner when it becomes unavailable. The filtering unit is used to filter Nginx logs that do not meet the requirements and logs that users do not care about; The processing unit is used to process, integrate, and sort Nginx logs that meet the requirements; The upload unit is used to upload the processed Nginx logs to the log bucket corresponding to each object user, for subsequent troubleshooting and analysis by maintenance personnel.

4. The Ceph-based object gateway log collection and storage system according to claim 1, characterized in that, The Etcd database module includes a first storage unit, a second storage unit, and a third storage unit; The first storage unit is used to store node information for the log bucket service, and the node information is used for service discovery and service registration of the log bucket service. The second storage unit is used to store the primary and backup information for the log bucket service; The third storage unit is used to store the variable information required for log bucket calculations.

5. The Ceph-based object gateway log collection and storage system according to claim 4, characterized in that, The variable information includes the number of bytes processed today, the number of bytes processed yesterday, and an indicator of whether the logs within the current 5 minutes have been processed.

6. The Ceph-based object gateway log collection and storage system according to claim 1, characterized in that, The Ceph log bucket module includes a file generation unit, a file upload unit, and a file analysis unit. The file generation unit is used to generate log files after processing all the Nginx logs of all nodes by the log bucket service module. The file upload unit is used to upload the log file to each user's log bucket; The file analysis unit is used to download and analyze log files via a client when a user needs to obtain logs.

7. The Ceph-based object gateway log collection and storage system according to claim 6, characterized in that, The number of log files depends on how many object users generated Nginx logs.

8. A method for collecting and storing object gateway logs based on Ceph, characterized in that, Includes the following steps: Record request logs related to Nginx proxy and configure the Nginx log format so that the log format generated by Nginx meets the requirements of the log bucket service for parsing. The log bucket service starts a scheduled task to retrieve Nginx logs from the local node within the last 5 minutes and perform filtering and time format adjustment. Each log bucket service stores the logs processed by the current node into the main bucket as files; Based on the Etcd database, the completion flag of this scheduled task is set to True, and the number of bytes processed in the Nginx log is updated so that when the next task starts in 5 minutes, it continues processing from the position of the last processing. When the master node of the log bucket service detects that all nodes have finished processing, it reads the log files of all nodes from the master bucket, processes them by format and sorts them, and writes them to the log files of each object user according to the object user dimension, and then uploads the log files to the log bucket of each object user. After the upload is complete, delete all temporary log files in the main bucket, update the flag in the Etcd database to check if all nodes have finished processing, and wait for the next 5-minute scheduled task to begin.

Citation Information

Patent Citations

  • Gateway request monitoring method and device, equipment and medium

    CN111654410A

  • Log recording method and device, electronic equipment and computer readable storage medium

    CN116662289A