Log management methods, devices, equipment, storage media, and software products
By using retention time as the granularity in the CDN and leveraging the prefix matching feature of the object storage system to construct object keys for log data and configure management rules, the problem of high complexity in multi-tenant log data management is solved, achieving efficient and reliable log data management.
Patent Information
- Application Number
- CN202611610493.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-19
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies for lifecycle management of multi-tenant log data in CDN are complex and prone to issues such as missed deletions and accidental deletions. In particular, cleaning up log data in a loop through the tenant list is time-consuming and inefficient.
Using retention time as the granularity, log data is managed through prefix encoding. Leveraging the prefix matching feature of the object storage system, the prefix encoding of the log data is used as the first path segment of the object key. The object key is then constructed and uploaded to the storage container. Management rules are configured for unified management, avoiding the need to perform the same operation repeatedly according to the tenant list.
It reduces the complexity of log data management, improves management efficiency and reliability, reduces the number of storage containers, enhances scalability and management efficiency, and avoids the management complexity caused by an increase in the number of tenants.
Smart Images

Figure CN123115076A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the Internet field, and in particular to a log management method, apparatus, device, storage medium, and program product. Background Technology
[0002] A Content Delivery Network (CDN) is an intelligent virtual network built on top of existing networks. Relying on edge servers deployed in various locations, it uses a central platform's load balancing, content distribution, and scheduling modules to allow users to access content from the nearest server. This reduces network congestion and improves user access response speed and hit rate. Large-scale internet services like CDNs often serve multiple tenants, generating log data characterized by massive volumes, high-concurrency writes, and multi-tenant isolation.
[0003] Currently, when managing the lifecycle of log data in a CDN, considering the varying retention duration requirements of different tenants, a common approach is to write timers to periodically clean up expired log data daily according to the retention duration configured for each tenant. Alternatively, a storage container can be configured for each tenant in the object storage service, allowing for lifecycle management of each tenant's log data through the storage container.
[0004] However, the above-mentioned lifecycle management methods for multi-tenant log data have the problem of high management complexity. Summary of the Invention
[0005] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a log management method, apparatus, device, storage medium and program product that can manage multi-tenant log data at the granularity of retention time, avoid performing the same management operation on the log data of each tenant in a loop according to the tenant list, and effectively reduce management complexity.
[0006] Firstly, this application provides a log management method. The method includes: Receive log write requests, obtain the log data to be stored and the retention period of the log data, and look up the prefix code of the log data in the prefix configuration information based on the retention period; the prefix configuration information includes the correspondence between different retention periods and different prefix codes; The prefix encoding of the log data is used as the first path segment to construct the object key of the log data, and the log data and object key are uploaded to the pre-built storage container; Log data within a storage container is managed according to its management rules; different management rules for storage containers are used to indicate how log data with different prefix codes are managed.
[0007] In conjunction with the first aspect, in one possible implementation, different management rules are used to indicate the lifecycle management method for log data with different prefix codes. The log data in the storage container is managed according to the management rules, including: traversing the prefix codes of each object key, determining expired log data based on the retention period corresponding to the prefix code and the current date, and deleting expired log data.
[0008] In conjunction with the first aspect, in one possible implementation, the log management method further includes: if the prefix configuration information does not contain a prefix code corresponding to the retention period of the log data to be stored, then a prefix code for the log data is generated according to a preset encoding algorithm; the generated prefix code is inconsistent with the prefix code in the prefix configuration information.
[0009] In conjunction with the first aspect, in one possible implementation, the prefix encoding of the log data is used as the first-level path segment to construct the object key of the log data, including: a first-level path segment with the prefix encoding of the log data as the object key, and concatenation elements with log type, tenant identifier, domain name, current date, and file name of the log data to construct the object key of the log data according to a preset format; the preset format is used to indicate the construction order of each concatenation element.
[0010] In conjunction with the first aspect, in one possible implementation, the log management method further includes: determining the updated prefix code based on the updated retention period, and updating the object key of the log data based on the updated prefix code; and re-uploading the log data with the updated object key and tenant identifier to the storage container.
[0011] In conjunction with the first aspect, in one possible implementation, obtaining the retention duration of log data includes: parsing the log write request to determine the tenant identifier of the log data; searching for the retention duration corresponding to the tenant identifier in the retention duration configuration information based on the tenant identifier; the retention duration configuration information includes the correspondence between different tenant identifiers and different retention durations.
[0012] In conjunction with the first aspect, in one possible implementation, obtaining the retention duration of log data includes: responding to a log write request, instructing the tenant to configure the retention duration of log data, and receiving the retention duration configured by the tenant.
[0013] Secondly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method described in the first aspect.
[0014] Thirdly, this application also provides a computer-readable storage medium. This computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the method described in the first aspect.
[0015] Fourthly, this application also provides a computer program product. This computer program product includes a computer program that, when executed by a processor, implements the method described in the first aspect.
[0016] This application provides a log management method, apparatus, device, storage medium, and program product. It can receive log write requests, obtain the log data to be stored and the retention period of the log data, and search for the prefix code of the log data based on the retention period in prefix configuration information that includes the correspondence between different retention periods and different prefix codes. It then constructs an object key for the log data using the prefix code as the first-level path segment, and uploads the log data and object key to a pre-built storage container. Finally, it manages the log data with different prefix codes according to the management rules of the storage container and the configured management method. The method provided in this application manages multi-tenant log data at the retention period granularity based on object storage, avoiding the need to perform the same management operations on the log data of each tenant in a loop according to the tenant list, thus effectively reducing management complexity. Furthermore, based on object storage, this application configures multiple management rules corresponding to the prefix code in a storage container in real time, thereby avoiding the creation of too many storage containers based on the number of tenants, reducing the complexity of log data writing logic and log data management. Furthermore, regardless of the number of tenants, multi-tenant log data can be managed based on a small number of management rules that match the retention period (or prefix encoding), improving the reliability and scalability of the log management method. Additionally, based on object storage, the prefix-scanning-based log data management method is more efficient than the application-layer polling of the tenant list. Attached Figure Description
[0017] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart illustrating the multi-tenant log management method in the existing technology; Figure 2 This is a flowchart illustrating a log management method in one embodiment; Figure 3 This is another flowchart illustrating the log management method in one embodiment; Figure 4 This is another flowchart illustrating the log management method in one embodiment; Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0018] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0019] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The present application will now be described in detail with reference to the accompanying drawings and embodiments. Furthermore, the term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The terms "first" and "second," etc., in the specification and claims of the embodiments of this application are used to distinguish different objects, not to describe a specific order of objects.
[0020] A Content Delivery Network (CDN) is an intelligent virtual network built on top of existing networks. Relying on edge servers deployed in various locations, it uses a central platform's load balancing, content distribution, and scheduling modules to allow users to access content from the nearest server. This reduces network congestion and improves user access response speed and hit rate. Large-scale internet services like CDNs often serve multiple tenants, generating log data characterized by massive volumes, high-concurrency writes, and multi-tenant isolation.
[0021] Currently, when managing the lifecycle of log data in a CDN, considering the varying retention duration requirements of different tenants, a common practice is to write timers to periodically clean up expired CDN log data daily according to the retention duration configured for each tenant. Specifically, for example... Figure 1 As shown, a pre-written timer, referencing the retention period specified by each customer in the customer list, cyclically deletes expired log data for each customer. The number of tenants served by the CDN represents the number of cycles for cleaning up expired log data. This method, which periodically scans the customer list and performs deletion operations through business code, consumes significant computing resources and has complex lifecycle management logic, making it prone to missed or accidental deletions. Furthermore, the cyclical cleanup based on the tenant list is time-consuming and inefficient.
[0022] Alternatively, log data can be uploaded to an object storage system, and a new bucket can be created for each tenant. A global retention period can be configured on the bucket to achieve independent management for different customers. This approach has the problem of complex log data writing logic, and creating a bucket for each tenant can easily lead to an explosion in the number of buckets, resulting in high management complexity.
[0023] Based on this, embodiments of this application provide a log management method, apparatus, device, storage medium, and program product that can manage multi-tenant log data at the retention time granularity, avoiding the need to perform the same management operations on the log data of each tenant in a loop according to the tenant list, and effectively reducing management complexity.
[0024] In one embodiment, such as Figure 2 As shown, a log management method is provided that can be applied to large-scale Internet services such as CDN. The method includes the following steps: Step 101: Receive the log write request, obtain the log data to be stored and the retention period of the log data, and look up the prefix code of the log data in the prefix configuration information based on the retention period.
[0025] In this embodiment of the application, the log collector in the CDN can receive log write requests sent by edge nodes, parse the log write requests, and determine the log data and related information of the log data (such as tenant identifier, log type, retention time configured by the tenant, etc.).
[0026] Considering that managing log data at the tenant level can easily lead to high management complexity as the number of tenants increases, this embodiment of the application changes the management granularity of log data to retention time. Unified management of log data with the same retention time avoids performing the same management operations on the log data of each tenant in a loop according to the tenant list, effectively reducing management complexity. Therefore, after parsing the log write request, the main needs are to obtain the log data to be stored and the retention time of the log data. One retention time can correspond to multiple tenants (i.e., different tenants can configure the same retention time for log data), and one tenant corresponds to one retention time (i.e., all log data corresponding to one tenant has the same retention time).
[0027] Furthermore, to ensure the orderly management of log data based on retention duration, this application can manage log data of multiple tenants based on an object storage system. Specifically, referencing the characteristic of object storage systems that manage objects with the same prefix by using "prefix matching," this application embodiment uses log data as the object and encodes the retention duration configured by the tenant as the prefix of the log data's object key, enabling the object storage system to uniformly manage log data with the same prefix (retention duration) through the "prefix matching" feature.
[0028] Specifically, in this embodiment, prefix configuration information can be pre-defined. This prefix configuration information includes the correspondence between different retention durations and different prefix codes. When the log collector obtains the log data to be stored and the retention duration, it searches the prefix configuration information based on the retention duration of the log data to determine the prefix code corresponding to the retention duration, which is the prefix code of the object key of the log data to be stored. For example, a set of mapping relationship tables can be pre-defined. Stored locally. To retain the duration, Prefix encoding is used. An example illustrating this mapping table is provided below: =30 days =MzBk; =45 days =NDVk; =60 days =NjBk. To avoid conflicts in management methods, the prefix codes in the prefix configuration information are mutually exclusive; that is, multiple prefix codes in the prefix configuration information are different and have different retention durations.
[0029] In one possible implementation, if the corresponding prefix code is not found in the prefix configuration information based on the retention period of the log data to be stored, that is, if there is no prefix code corresponding to the retention period of the log data to be stored in the prefix configuration information, then the prefix code of the log data is generated according to the preset encoding algorithm.
[0030] In this implementation, for cases where the prefix configuration information lacks a prefix code that matches the retention period of the log data to be stored, to ensure successful log data writing, a prefix code for the log data to be stored can be directly generated using a preset encoding algorithm based on the tenant's configured retention period. The prefix code in the prefix configuration information is also generated using this encoding algorithm based on the corresponding retention period. This ensures that the generated prefix code is inconsistent with the prefix code in the prefix configuration information, thus ensuring mutual exclusion of prefix codes.
[0031] In one possible implementation, after generating the prefix code using the encoding algorithm, a mapping relationship between the retention period and the generated prefix code can be constructed, and this mapping relationship can be added to the prefix configuration information to update the prefix configuration information.
[0032] Step 102: Use the prefix encoding of the log data as the first path segment to construct the object key of the log data, and upload the log data and object key to the pre-built storage container.
[0033] In this embodiment, after determining the prefix encoding of the log data's object key, the construction of the log data's object key can begin. Specifically, the prefix encoding is used as the first-level path segment (i.e., the prefix) of the object key, and other information from the log data is concatenated after the first-level path segment to obtain the log data's object key. This allows the object key to serve as the logical address of the log data, facilitating subsequent indexing of the log data.
[0034] Specifically, the object key can be constructed using the prefix encoding of the log data as the first path segment, with concatenated elements including log type, tenant identifier, domain name, current date, and log data filename, according to a preset format. The preset format indicates the construction order of each concatenated element. For example, the preset format might indicate the construction order as: log type, tenant identifier, domain name, current date, and log data filename. For instance, the retention period for the currently acquired log data to be stored is 60 days, corresponding to the prefix encoding NjBk. Based on this prefix encoding and other relevant information about the log data, the object key constructed according to the preset format could be NjBk / download-log / 881 / xxx / 2026-03-06 / filename. Here, download-log is the log type, 881 is the tenant identifier, xxx is the domain name, 2026-03-06 is the current date (the storage date of the log data), and filename is the filename of the log data.
[0035] After constructing the object key, the object storage interface can be called to upload the log data and the object key to the object storage system. Specifically, the object key is used as metadata for the log data, and the log data is stored in a pre-built storage container. This storage container can be a bucket.
[0036] In one possible implementation, after the log data upload is complete, the object storage system can generate an access URL for the log data and send it back to the CDN or tenant client for download and viewing.
[0037] Step 103: Manage the log data in the storage container according to the management rules of the storage container.
[0038] In this embodiment, multiple management rules can be pre-configured in the storage container. Different management rules in the storage container are used to indicate the management method for log data with different prefix codes, so as to manage log data with different prefix codes. That is, log data with the same prefix code (retention duration) can be uniformly managed through the configured management rules.
[0039] Specifically, the object storage system manages the log data within storage containers according to the management rules of those containers. During management, it iterates through the prefix codes of each object key, and for the log data corresponding to object keys with the same prefix code, it manages the selected log data using the management method indicated by the pre-configured management rules corresponding to that prefix code.
[0040] In one possible implementation, the management method could specifically be lifecycle management, that is, deleting log data that exceeds its retention period. Therefore, different management rules are used to indicate the lifecycle management method for log data with different prefix codes. For example, it could be according to a format... :Filter.Prefix=pi / ,Action.Expiration.Days= Here, `Filter.Prefix=pi / ` indicates that the management rule is valid for objects (log data) in the bucket whose prefix encoding is `pi / `; `Action.Expiration.Days=` The representation of the matched objects is in their creation (storage). After that, it was automatically deleted.
[0041] In this case, managing the log data in the storage container according to the management rules may include the following steps: traversing the prefix codes of each object key, determining expired log data based on the retention period corresponding to the prefix code and the current date, and deleting the expired log data.
[0042] In this implementation, when iterating through the prefix codes of each object key and filtering log data with the same prefix code, the retention period corresponding to the prefix code can be determined. Then, the storage period of the log data is calculated based on the storage date of the log data indicated in the object key and the current date. Next, the storage period and the retention period are compared. If the storage period reaches or exceeds the retention period, the log data is determined to be expired, and a deletion operation is performed on the log data.
[0043] The log management method provided in this application can receive log write requests, obtain the log data to be stored and the retention period of the log data, and search for the prefix code of the log data in the prefix configuration information, which includes the correspondence between different retention periods and different prefix codes, based on the retention period. The prefix code of the log data is used as the first-level path segment to construct the object key of the log data, and the log data and object key are uploaded to a pre-built storage container. Log data with different prefix codes is managed according to the management rules of the storage container and the configured management method. The method provided in this application manages multi-tenant log data at the retention period granularity based on object storage, avoiding the need to perform the same management operations on the log data of each tenant in a loop according to the tenant list, thus effectively reducing management complexity. Furthermore, based on object storage, this application's real-time example configures multiple management rules corresponding to the prefix code in a storage container, thereby avoiding the creation of too many storage containers based on the number of tenants, reducing the complexity of log data write logic and log data management. Furthermore, regardless of the number of tenants, multi-tenant log data can be managed based on a small number of management rules that match the retention period (or prefix encoding), improving the reliability and scalability of the log management method. Additionally, based on object storage, the prefix-scanning-based log data management method is more efficient than the application-layer polling of the tenant list.
[0044] In one embodiment, there is a situation where a tenant changes the retention period. In this case, to ensure effective management of the tenant's log data, the object storage for the tenant's log data needs to be updated. This embodiment includes, for example... Figure 3 The steps shown are as follows: Step 201: Determine the updated prefix code based on the updated retention period, and update the object key of the log data based on the updated prefix code.
[0045] In this embodiment, a retention duration configuration change request sent by a tenant on the client can be received, parsed, and the updated retention duration determined. Based on the updated retention duration, the prefix configuration information is queried to determine the updated prefix code. The updated prefix code is used as the first path segment of the object key, and relevant information from the log data is concatenated to obtain the updated object key for the log data.
[0046] Step 202: Re-upload the updated object key and tenant identifier log data to the storage container.
[0047] In this embodiment, the updated object key and log data are re-uploaded to the object storage system, and the updated object key is used as metadata to store the log data in the storage container. Understandably, the log data at the original storage address needs to be deleted to avoid wasting storage resources.
[0048] The method provided in this application can update the object key of the log data and re-store the log data in response to the tenant's retention time update operation. That is, it updates the logical address of the log data, ensuring accurate access and management of the log data.
[0049] The embodiments described above illustrate a scheme for obtaining the retention period of log data in response to a log write request. In another embodiment of this application, the retention period of log data can be determined locally. For example, the "obtaining the retention period of log data" mentioned above may include, for instance,... Figure 4 The steps shown are as follows: Step 301: Parse the log write request and determine the tenant identifier of the log data.
[0050] In this embodiment, when different tenants access the CDN, the tenants can be instructed to configure the retention period for log data. The tenant identifier and retention period are associated and stored locally as the retention period configuration information. Thus, upon receiving and parsing a log write request, the tenant identifier of the log data to be stored can be determined first.
[0051] Step 302: Based on the tenant identifier, find the retention duration corresponding to the tenant identifier in the duration configuration information.
[0052] In this embodiment of the application, after the tenant identifier is determined, it can be searched in the duration configuration information stored locally in advance to determine the retention duration corresponding to the tenant identifier, thereby obtaining the retention duration of the log data.
[0053] In one possible implementation, if a tenant does not configure a retention period when accessing the CDN (i.e., the retention period corresponding to the tenant identifier cannot be found in the retention configuration information), the tenant needs to configure it promptly. Specifically, in response to a log write request, the system instructs the tenant to configure the retention period for log data and receives the retention period configured by the tenant.
[0054] In this implementation, in response to a log write request, if there is no retention duration corresponding to the tenant identifier in either the log write request or the local duration configuration information, a configuration message is sent to the tenant client to instruct the tenant to configure the retention duration, and the retention duration configured by the tenant is received.
[0055] The method provided in this application embodiment can pre-store the retention period configured by the tenant locally to improve the writing efficiency of log data. Even when not pre-stored, it can also promptly instruct the tenant to configure the retention period, ensuring effective writing of log data.
[0056] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system 500 suitable for implementing terminal devices or servers in the embodiments of this application.
[0057] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0058] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.
[0059] In particular, according to embodiments of this disclosure, the above references Figure 2 The described process can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing instructions for performing... Figure 2 The program code for the method. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable media 511.
[0060] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0061] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0062] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be located in a processor. The names of these units or modules do not, in certain circumstances, constitute a limitation on the unit or module itself.
[0063] On the other hand, this application also provides a computer-readable storage medium, which may be included in the computer device described in the above embodiments, or may exist independently and not assembled into the computer device. The aforementioned computer-readable storage medium stores one or more programs that, when used by one or more processors, execute the methods described in this application. For example, it may execute... Figure 2 The steps of the method shown.
[0064] This application provides a computer program product including instructions that, when executed, cause the method described in this application to be performed. For example, it can execute... Figure 2 The steps of the method shown.
[0065] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0066] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A log management method, characterized in that, The method includes: The system receives a log write request, obtains the log data to be stored and the retention period of the log data, and searches for the prefix code of the log data in the prefix configuration information based on the retention period; the prefix configuration information includes the correspondence between different retention periods and different prefix codes. The prefix encoding of the log data is used as the first path segment to construct the object key of the log data, and the log data and the object key are uploaded to the pre-built storage container; The log data within the storage container is managed according to the management rules of the storage container; the different management rules of the storage container are used to indicate the management method of log data with different prefix codes.
2. The method according to claim 1, characterized in that, The different management rules are used to indicate the lifecycle management method for log data with different prefix codes. Managing the log data within the storage container according to the management rules includes: Iterate through the prefix codes of each object key, determine the expired log data based on the retention period corresponding to the prefix code and the current date, and delete the expired log data.
3. The method according to claim 1, characterized in that, The method further includes: If the prefix configuration information does not contain a prefix code corresponding to the retention period of the log data to be stored, then the prefix code of the log data is generated according to a preset encoding algorithm; the generated prefix code is inconsistent with the prefix code in the prefix configuration information.
4. The method according to claim 1, characterized in that, The step of constructing the object key of the log data using the prefix encoding of the log data as the first-level path segment includes: The object key is constructed using the prefix encoding of the log data as the first path segment of the object key, and the concatenation elements of log type, tenant identifier, domain name, current date, and file name of the log data are constructed according to a preset format; the preset format is used to indicate the construction order of each concatenation element.
5. The method according to claim 1, characterized in that, The method further includes: The updated prefix code is determined based on the updated retention period, and the object key of the log data is updated based on the updated prefix code; The updated object key and tenant identifier log data are re-uploaded to the storage container.
6. The method according to claim 1, characterized in that, Obtain the retention period for log data, including: Parse the log write request to determine the tenant identifier of the log data; Based on the tenant identifier, the retention duration corresponding to the tenant identifier is found in the duration configuration information; the duration configuration information includes the correspondence between different tenant identifiers and different retention durations.
7. The method according to claim 1, characterized in that, Obtain the retention period for log data, including: In response to the log write request, instruct the tenant to configure the retention period of the log data, and receive the retention period configured by the tenant.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
