CN114564459A - Log file storage method, device and equipment and computer readable storage medium - Google Patents

Log file storage method, device and equipment and computer readable storage medium Download PDF

Info

Publication number
CN114564459A
CN114564459A CN202210204622.0A CN202210204622A CN114564459A CN 114564459 A CN114564459 A CN 114564459A CN 202210204622 A CN202210204622 A CN 202210204622A CN 114564459 A CN114564459 A CN 114564459A
Authority
CN
China
Prior art keywords
log
storage
file
log file
storage space
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.)
Pending
Application number
CN202210204622.0A
Other languages
Chinese (zh)
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.)
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202210204622.0A priority Critical patent/CN114564459A/en
Publication of CN114564459A publication Critical patent/CN114564459A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the field of artificial intelligence and distributed storage, and provides a log file storage method, a device, equipment and a computer readable storage medium, wherein the method comprises the following steps: when the generated log file is detected, determining the log category of the log file, and renaming the log file according to a file naming rule corresponding to the log category; storing the renamed log file into a storage space corresponding to the log category, wherein the storage capacity threshold and the first storage time threshold of the storage space corresponding to different log categories are different; and acquiring the stored time of each log file in the storage space at regular time, and deleting the log files of which the stored time exceeds the first storage time threshold corresponding to the storage space. The method and the device can reduce the storage pressure of the log file. The present application also relates to the field of blockchain, and the computer-readable storage medium may store data created from use of blockchain nodes.

Description

Log file storage method, device, equipment and computer readable storage medium
Technical Field
The present application relates to the field of log storage technologies, and in particular, to a log file storage method, apparatus, device, and computer-readable storage medium.
Background
The log file storage is an essential part in the development and operation of the application service, and developers can quickly trace to the places with problems or exceptions by means of the log file. At present, the existing log file storage is mainly to store log files under a specified directory by means of log components, so that developers can conveniently inquire the log files, however, as the number of users increases, the stored log files also increase, the storage pressure of a server is higher, the developers can not conveniently and accurately inquire the log files quickly, and the log file inquiry efficiency is lower.
Disclosure of Invention
The embodiment of the application provides a log file storage method, a log file storage device, log file storage equipment and a computer readable storage medium, and aims to reduce the storage pressure of log files and improve the query efficiency of the log files.
In a first aspect, an embodiment of the present application provides a log file storage method, including:
when the generated log file is detected, determining the log category of the log file, and renaming the log file according to a file naming rule corresponding to the log category;
storing the renamed log file into a storage space corresponding to the log category, wherein the storage capacity threshold and the first storage time threshold of the storage space corresponding to different log categories are different;
and acquiring the stored time of each log file in the storage space at regular time, and deleting the log files of which the stored time exceeds the storage time threshold corresponding to the storage space.
In a second aspect, an embodiment of the present application further provides a log file storage apparatus, where the log file storage apparatus includes:
the determining module is used for determining the log category of the log file when the generated log file is detected;
the renaming module is used for renaming the log file according to a file naming rule corresponding to the log category;
the storage module is used for storing the renamed log file into a storage space corresponding to the log category, and the storage capacity threshold value and the first storage time threshold value of the storage space corresponding to different log categories are different;
and the deleting module is used for acquiring the stored time of each log file in the storage space at regular time and deleting the log files of which the stored time exceeds the storage time threshold corresponding to the storage space.
In a third aspect, an embodiment of the present application further provides a computer device, where the computer device includes a processor, a memory, and a computer program stored on the memory and executable by the processor, where the computer program, when executed by the processor, implements the steps of the log file storage method as described above.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the log file storage method as described above.
The embodiment of the application provides a log file storage method, a device, equipment and a computer readable storage medium, which can reduce the storage pressure of log files by determining the log types of the log files, renaming the log files according to a file naming rule corresponding to the log types, then storing the renamed log files into storage spaces corresponding to the log types, wherein the storage capacity threshold and the storage time threshold of the storage spaces corresponding to different log types are different, finally acquiring the stored time of each log file in the storage space at regular time, deleting the log files of which the stored time exceeds the storage time threshold corresponding to the storage space, thereby realizing the classified storage of the log files, and because the storage capacity threshold and the storage time threshold of the storage spaces corresponding to different log types are different, the log files can be quickly inquired through the names of the log files, the query efficiency of the log files is greatly improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a log file storage method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another log file storage method provided in an embodiment of the present application;
FIG. 3 is a schematic block diagram of a log file storage device provided by an embodiment of the present application;
FIG. 4 is a schematic block diagram of a sub-module of the log file storage of FIG. 3;
fig. 5 is a schematic block diagram of a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further described with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The log file storage is an essential part in the development and operation of the application service, and developers can quickly trace to the places with problems or exceptions by means of the log file. At present, the existing log file storage is mainly to store log files under a specified directory by means of log components, so that developers can conveniently inquire the log files, however, as the number of users increases, the stored log files also increase, the storage pressure of a server is higher, the developers can not conveniently and accurately inquire the log files quickly, and the log file inquiry efficiency is lower.
In order to solve the above problems, embodiments of the present application provide a method, an apparatus, a device, and a computer-readable storage medium for storing log files, where the method determines log categories of log files, renames the log files according to file naming rules corresponding to the log categories, stores the renamed log files into storage spaces corresponding to the log categories, where storage capacity thresholds and storage time thresholds of the storage spaces corresponding to different log categories are different, and finally periodically obtains stored time of each log file in the storage space, deletes log files whose stored time exceeds the storage time threshold corresponding to the storage space, thereby implementing classified storage of the log files, and since the storage capacity thresholds and the storage time thresholds of the storage spaces corresponding to different log categories are different, the storage pressure of the log files can be reduced, the log file can be quickly inquired through the name of the log file, and the inquiry efficiency of the log file is greatly improved.
The log file storage method can be applied to a terminal device or a server, the terminal device can be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, a wearable device and the like, and the server can be an independent server or a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), big data, an artificial intelligent platform and the like.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a log file storage method according to an embodiment of the present disclosure.
As shown in fig. 1, the log file storage method includes steps S101 to S103.
Step S101, when the generated log file is detected, determining the log category of the log file, and renaming the log file according to the file naming rule corresponding to the log category.
Illustratively, the log files are divided into a plurality of log categories according to functions, services and log levels in advance, such as interface request log, remote call log, database operation log sql, cache query log, timing task log, service log (login log, order log, and pneumatic control log), regular log, error log, system log and the like, wherein the interface request log is used for recording entry and back-entry of each request, the remote call log is used for recording entry and back-entry of mutual call between applications, the database operation log sql is used for recording various operations on the database, the cache query log is used for recording various operations on the cache, the timing task log is used for recording use conditions of timing tasks, and the service log is used for recording relevant information of services.
Exemplarily, the importance degree index of the log file of each log category is determined according to the mapping relation between the pre-stored log categories and the importance degree index; determining a storage capacity threshold value and a first storage time threshold value of the log file of each log category according to the importance degree index of the log file of each log category; and according to the storage capacity threshold of the log file of each log category, creating a storage space corresponding to each log category in the computer equipment, and setting a corresponding first storage time threshold for each storage space. The higher the importance degree index is, the higher the storage capacity threshold value is, and the larger the first storage time threshold value is, the lower the importance degree index is, the smaller the storage capacity threshold value is, and the smaller the first storage time threshold value is.
Illustratively, different log categories correspond to different file naming rules, so that developers can quickly query log files based on the file names of the log files, and the query efficiency of the log files is improved.
In one embodiment, keywords are extracted from a log file; and determining the log category of the log file according to the keywords. Illustratively, the mapping relationship between the pre-stored keywords and the log categories is obtained, and the log categories of the log files are determined according to the extracted keywords and the mapping relationship between the pre-stored keywords and the log categories.
And S102, storing the renamed log file into a storage space corresponding to the log category, wherein the storage capacity threshold of the storage space corresponding to different log categories is different from the first storage time threshold.
For example, the divided log categories are: interface request logs, remote call logs, database operation logs, cache query logs, timed task logs, system logs, and the storage spaces corresponding to the interface request log, the remote call log, the database operation log, the cache query log, the timing task log and the system log are respectively a storage space A, a storage space B, a storage space C, a storage space D, a storage space E and a storage space F, when the log type of the generated log file is the system log, renaming the log file according to the file naming rule corresponding to the system log, storing the renamed log file into a storage space F corresponding to the system log, when the generated log type is the interface request log, renaming the log file according to the file naming rule corresponding to the interface request log, and storing the renamed log file into a storage space A corresponding to the interface request log.
In one embodiment, determining the residual storage capacity of the storage space corresponding to the log category, and storing the renamed log file into the storage space corresponding to the log category when the residual storage capacity is greater than or equal to a preset threshold; and when the residual storage capacity is smaller than a preset threshold value, acquiring the stored time of each log file in the storage space, and sequentially deleting the corresponding log files from the storage space according to the size sequence of the stored time of each log file until the residual storage capacity of the storage space is larger than or equal to the preset threshold value.
And step S103, acquiring the stored time of each log file in the storage space at regular time, and deleting the log files of which the stored time exceeds a first storage time threshold corresponding to the storage space.
Illustratively, the stored time of each log file in the storage space is acquired at preset intervals, and the log files with the stored time exceeding the first storage time threshold corresponding to the storage space are deleted. For example, the first storage time thresholds of the storage space a, the storage space B, the storage space C, the storage space D, the storage space E, and the storage space F are 7 days, 10 days, 15 days, 30 days, 15 days, and 90 days, the storage time of each log file in the storage space a is less than 7 days, the deletion process is not performed, the storage time of each log file B1 and log file B2 in the storage space B is greater than 10 days, the log file B1 and the log file B2 are deleted from the storage space B, and the storage time of each log file in the storage space C, the storage space D, the storage space E, and the storage space F is less than the corresponding first storage time threshold, and the deletion process is not performed.
In an embodiment, the renamed log file is sent to a search server, so that the search server stores the renamed log file, and a second storage time threshold is set for the renamed log file, wherein the first storage time threshold is smaller than the second storage time threshold. And when detecting that the storage time of the log files exceeds a second storage time threshold value set by the search server, deleting the log files of which the storage time exceeds the second storage time threshold value set by the search server. By setting the second storage time threshold, the storage time of the log file can be prolonged.
For example, the manner in which the search server sets the second storage time threshold value to the renamed log file may include: and acquiring the file name of the renamed log file, and setting a second storage time threshold corresponding to the file name for the renamed log file. For example, according to a mapping relation between a pre-stored file name and a storage time threshold, a second storage time threshold corresponding to the file name of the renamed log file is determined, and the second storage time threshold corresponding to the file name is set for the renamed log file.
Illustratively, the search server determines the label content of the log file according to the log record information in the log file, and establishes an index relationship between the log file and the label content; when a log query request sent by the terminal equipment is obtained, the label content in the log query request is obtained, a corresponding log file is obtained in the search server according to the label content and the index relation, and the obtained log file is sent to the terminal equipment. The log record information comprises an IP address, a service name, a mobile phone number, a user name, a log tracking ID, time consumption of request and the like. By performing labeling management on the log files, developers can conveniently and quickly query the log files, and the query efficiency is improved.
In one embodiment, after storing the renamed log file into a storage space corresponding to the log category, regularly determining whether the log file to be synchronized exists in the storage space, wherein the log file to be synchronized is a log file which is not synchronized to a file server in the storage space; if the log files to be synchronized exist in the storage space, all the log files to be synchronized in the storage space are sent to the file server, so that the file server can set a third storage time threshold value for the received log files, and the third storage time threshold value is larger than the second storage time threshold value. And when detecting that the storage time of the log file exceeds a third storage time threshold, the file server deletes the log file of which the storage time exceeds the third storage time threshold. By setting the third storage time threshold, the storage time of the log file can be further prolonged, and subsequent problem troubleshooting is facilitated.
The log file storage method provided by the above embodiment determines the log category of the log file, and renames the log file according to the file naming rule corresponding to the log category, then storing the renamed log files into storage spaces corresponding to log categories, wherein the storage capacity threshold and the storage time threshold of the storage spaces corresponding to different log categories are different, finally acquiring the stored time of each log file in the storage space at regular time, deleting the log files with the stored time exceeding the storage time threshold corresponding to the storage space, thereby realizing the classified storage of the log files, and reducing the storage pressure of the log files due to the different storage capacity threshold values and storage time threshold values of the storage spaces corresponding to different log categories, the log file can be quickly inquired through the name of the log file, and the inquiry efficiency of the log file is greatly improved.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another log file storage method according to an embodiment of the present application.
As shown in fig. 2, the log file storage method includes steps S201 to S207.
Step S201, when the generated log file is detected, determining the log category of the log file, and renaming the log file according to the file naming rule corresponding to the log category.
Illustratively, different log categories correspond to different file naming rules, so that developers can quickly query log files based on the file names of the log files, and the query efficiency of the log files is improved.
Step S202, determining whether a storage space corresponding to the log category exists.
Illustratively, acquiring a log label of each storage space, and determining the similarity between the log category and each log label; when the similarity between each log label and the log category is greater than or equal to the preset similarity, determining that a storage space corresponding to the log category exists in the server, and when the similarity between each log label and the log category is smaller than the preset similarity, determining that the storage space corresponding to the log category does not exist in the server.
Step S203, if the storage space corresponding to the log type does not exist, determining the importance degree index of the log file according to the log type.
For example, if there is no storage space corresponding to the log category, the importance index of the log file is determined according to the mapping relationship between the pre-stored log category and the importance index and the log category of the log file.
And step S204, determining a storage capacity threshold and a first storage time threshold of the log files of the log category according to the importance degree index.
Illustratively, acquiring a mapping relation among a pre-stored importance index, a storage capacity threshold and a storage time threshold; and determining the storage capacity threshold and the first storage time threshold of the log files of the log category according to the mapping relation between the importance index of the log files and the pre-stored importance index, the storage capacity threshold and the storage time threshold.
And S205, creating a storage space corresponding to the log category according to the storage capacity threshold, and setting a first storage time threshold for the created storage space.
For example, if the storage capacity threshold is 54G and the first storage time threshold is 7 days, a storage space with the storage capacity threshold of 54G is created, and a storage time threshold of 7 days is set for the created storage space of 54G.
And S206, storing the renamed log file into a storage space corresponding to the log category, wherein the storage capacity threshold of the storage space corresponding to different log categories is different from the first storage time threshold.
For example, the divided log categories are: the method comprises the steps that an interface request log, a remote call log, a database operation log, a cache query log, a timing task log and a system log are adopted, storage spaces corresponding to the interface request log, the remote call log, the database operation log, the cache query log, the timing task log and the system log are respectively a storage space A, a storage space B, a storage space C, a storage space D, a storage space E and a storage space F, when the log category of a generated log file is the system log, the log file is renamed according to a file naming rule corresponding to the system log, and then the renamed log file is stored in the storage space F corresponding to the system log.
Step S207, obtaining the stored time of each log file in the storage space at regular time, and deleting the log file whose stored time exceeds the first storage time threshold corresponding to the storage space.
For example, the first storage time thresholds of the storage space a, the storage space B, the storage space C, the storage space D, the storage space E, and the storage space F are 7 days, 10 days, 15 days, 30 days, 15 days, and 90 days, the storage times of the log file a1 and the log file a2 in the storage space a are both greater than 7 days, the log file a2 is deleted from the storage space a, the storage times of the log file B1 and the log file B2 in the storage space B are both greater than 10 days, the log file B1 and the log file B2 are deleted from the storage space B, and the storage times of the log files in the storage space C, the storage space D, the storage space E, and the storage space F are all less than the respective corresponding first storage time thresholds, and then no deletion process is performed.
The method for storing log files provided in the foregoing embodiment determines, when there is no storage space corresponding to a log category, an importance index of a log file according to the log category of the log file, determines a storage capacity threshold and a first storage time threshold of the log file of the log category according to the importance index, creates a storage space corresponding to the log category according to the storage capacity threshold, sets the first storage time threshold for the created storage space, stores the renamed log file into the storage space corresponding to the log category, finally periodically obtains the stored time of each log file in the storage space, deletes the log file whose stored time exceeds the first storage time threshold corresponding to the storage space, and can create a new storage space in real time to store the log file, thereby implementing classified storage of the log files, and because the storage capacity threshold and the storage time threshold of the storage space corresponding to different log types are different, the storage pressure of the log file can be reduced.
Referring to fig. 3, fig. 3 is a schematic block diagram of a log file storage device according to an embodiment of the present application.
As shown in fig. 3, the log file storage device 300 includes:
a determining module 310, configured to determine a log category of a generated log file when the log file is detected;
the renaming module 320 is used for renaming the log file according to a file naming rule corresponding to the log category;
the storage module 330 is configured to store the renamed log file into a storage space corresponding to the log category, where storage capacity thresholds of storage spaces corresponding to different log categories are different from a first storage time threshold;
the deleting module 340 is configured to obtain the stored time of each log file in the storage space at regular time, and delete the log file whose stored time exceeds the first storage time threshold corresponding to the storage space.
In one embodiment, as shown in fig. 4, the determining module 310 includes:
an extraction submodule 311, configured to extract keywords from the log file;
the determining sub-module 312 is configured to determine a log category of the log file according to the keyword.
In an embodiment, the determining module 310 is further configured to:
determining whether a storage space corresponding to the log category exists;
if the storage space corresponding to the log type does not exist, determining the importance degree index of the log file according to the log type;
determining a storage capacity threshold value and a first storage time threshold value of the log files of the log category according to the importance degree index;
and creating a storage space corresponding to the log category according to the storage capacity threshold, and setting the first storage time threshold for the created storage space.
In an embodiment, the determining module 310 is further configured to:
acquiring a mapping relation among a pre-stored importance degree index, a storage capacity threshold and a storage time threshold;
and determining the storage capacity threshold and the first storage time threshold of the log files of the log category according to the importance degree index of the log files and the mapping relation.
In one embodiment, the log file storage device 300 further comprises:
the first sending module is used for sending the renamed log file to a search server so that the search server can store the renamed log file, and setting a second storage time threshold value for the renamed log file, wherein the first storage time threshold value is smaller than the second storage time threshold value.
In an embodiment, the setting a second storage time threshold for the renamed log file includes: and acquiring the file name of the renamed log file, and setting a second storage time threshold corresponding to the file name for the renamed log file.
In one embodiment, the log file storage device 300 further comprises:
the determining module 310 is further configured to determine whether a log file to be synchronized exists in the storage space at regular time, where the log file to be synchronized is a log file that is not synchronized to a file server in the storage space;
and the second sending module is used for sending all the log files to be synchronized in the storage space to the file server if the log files to be synchronized exist in the storage space, so that the file server sets a third storage time threshold value for the received log files, and the third storage time threshold value is greater than a second storage time threshold value.
It should be noted that, as will be clearly understood by those skilled in the art, for convenience and simplicity of description, the specific working processes of the apparatus and each module and unit described above may refer to the corresponding processes in the foregoing log file storage method embodiment, and details are not described herein again.
The apparatus provided by the above embodiments may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 5.
Referring to fig. 5, fig. 5 is a schematic block diagram of a computer device according to an embodiment of the present disclosure. The computer device may be a server or a terminal device.
As shown in fig. 5, the computer device includes a processor, a memory, and a network interface connected by a system bus, wherein the memory may include a storage medium and an internal memory.
The storage medium may store an operating system and a computer program. The computer program includes program instructions that, when executed, cause a processor to perform any of the log file storage methods.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The network interface is used for network communication, such as sending assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in an embodiment, the processor is configured to run a computer program stored in the memory to implement the steps of:
when the generated log file is detected, determining the log category of the log file, and renaming the log file according to a file naming rule corresponding to the log category;
storing the renamed log file into a storage space corresponding to the log category, wherein the storage capacity threshold and the first storage time threshold of the storage space corresponding to different log categories are different;
and acquiring the stored time of each log file in the storage space at regular time, and deleting the log files of which the stored time exceeds the first storage time threshold corresponding to the storage space.
In one embodiment, the processor, in performing determining the log category of the log file, is configured to perform:
extracting keywords from the log file;
and determining the log category of the log file according to the keyword.
In an embodiment, before the storing the renamed log file into the storage space corresponding to the log category, the processor is further configured to:
determining whether a storage space corresponding to the log category exists;
if the storage space corresponding to the log type does not exist, determining the importance degree index of the log file according to the log type;
determining a storage capacity threshold value and a first storage time threshold value of the log files of the log category according to the importance degree index;
and creating a storage space corresponding to the log category according to the storage capacity threshold, and setting the first storage time threshold for the created storage space.
In an embodiment, the processor, when implementing determining the storage capacity threshold and the first storage time threshold of the log file of the log category according to the importance index, is configured to implement:
acquiring a mapping relation among a pre-stored importance degree index, a storage capacity threshold and a storage time threshold;
and determining the storage capacity threshold and the first storage time threshold of the log files of the log category according to the importance degree index of the log files and the mapping relation.
In an embodiment, after the renaming the log file according to the file naming rule corresponding to the log category is implemented, the processor is further configured to:
and sending the renamed log file to a search server for the search server to store the renamed log file, and setting a second storage time threshold for the renamed log file, wherein the first storage time threshold is smaller than the second storage time threshold.
In an embodiment, the setting a second storage time threshold for the renamed log file includes: and acquiring the file name of the renamed log file, and setting a second storage time threshold corresponding to the file name for the renamed log file.
In an embodiment, after the storing the renamed log file into the storage space corresponding to the log category, the processor is further configured to:
regularly determining whether log files to be synchronized exist in the storage space, wherein the log files to be synchronized are log files which are not synchronized to a file server in the storage space;
if the log files to be synchronized exist in the storage space, all the log files to be synchronized in the storage space are sent to the file server so that the file server can set a third storage time threshold value for the received log files, and the third storage time threshold value is larger than a second storage time threshold value.
It should be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the computer device described above may refer to the corresponding process in the foregoing log file storage method embodiment, and details are not described herein again.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed, a method implemented by the computer-readable storage medium may refer to the embodiments of the log file storage method of the present application.
The computer readable storage medium may be volatile or nonvolatile. The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A log file storage method is characterized by comprising the following steps:
when the generated log file is detected, determining the log category of the log file, and renaming the log file according to a file naming rule corresponding to the log category;
storing the renamed log file into a storage space corresponding to the log category, wherein the storage capacity threshold and the first storage time threshold of the storage space corresponding to different log categories are different;
and acquiring the stored time of each log file in the storage space at regular time, and deleting the log files of which the stored time exceeds the first storage time threshold corresponding to the storage space.
2. The method of claim 1, wherein the determining the log category of the log file comprises:
extracting keywords from the log file;
and determining the log category of the log file according to the keyword.
3. The method according to claim 1, wherein before storing the renamed log file into the storage space corresponding to the log category, the method further comprises:
determining whether a storage space corresponding to the log category exists;
if the storage space corresponding to the log type does not exist, determining the importance degree index of the log file according to the log type;
determining a storage capacity threshold value and a first storage time threshold value of the log files of the log category according to the importance degree index;
and creating a storage space corresponding to the log category according to the storage capacity threshold, and setting the first storage time threshold for the created storage space.
4. The method of claim 3, wherein determining the storage capacity threshold and the first storage time threshold for the log files of the log category according to the importance index comprises:
acquiring a mapping relation among a pre-stored importance degree index, a storage capacity threshold and a storage time threshold;
and determining the storage capacity threshold and the first storage time threshold of the log files of the log category according to the importance degree index of the log files and the mapping relation.
5. The log file storage method according to any one of claims 1 to 4, wherein after renaming the log file according to the file naming rule corresponding to the log category, the method comprises:
and sending the renamed log file to a search server for the search server to store the renamed log file, and setting a second storage time threshold for the renamed log file, wherein the first storage time threshold is smaller than the second storage time threshold.
6. The log file storage method of claim 5, wherein setting a second storage time threshold for the renamed log file comprises: and acquiring the file name of the renamed log file, and setting a second storage time threshold corresponding to the file name for the renamed log file.
7. The log file storage method according to any one of claims 1 to 4, wherein after storing the renamed log file into the storage space corresponding to the log category, the method further comprises:
regularly determining whether log files to be synchronized exist in the storage space, wherein the log files to be synchronized are log files which are not synchronized to a file server in the storage space;
if the log files to be synchronized exist in the storage space, all the log files to be synchronized in the storage space are sent to the file server so that the file server can set a third storage time threshold value for the received log files, and the third storage time threshold value is larger than a second storage time threshold value.
8. A log file storage apparatus, comprising:
the determining module is used for determining the log category of the log file when the generated log file is detected;
the renaming module is used for renaming the log file according to a file naming rule corresponding to the log category;
the storage module is used for storing the renamed log file into a storage space corresponding to the log category, and the storage capacity threshold value and the first storage time threshold value of the storage space corresponding to different log categories are different;
and the deleting module is used for acquiring the stored time of each log file in the storage space at regular time and deleting the log files of which the stored time exceeds the first storage time threshold corresponding to the storage space.
9. A computer arrangement comprising a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein the computer program, when executed by the processor, carries out the steps of the log file storage method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the log file storage method according to any one of claims 1 to 7.
CN202210204622.0A 2022-03-02 2022-03-02 Log file storage method, device and equipment and computer readable storage medium Pending CN114564459A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210204622.0A CN114564459A (en) 2022-03-02 2022-03-02 Log file storage method, device and equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210204622.0A CN114564459A (en) 2022-03-02 2022-03-02 Log file storage method, device and equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114564459A true CN114564459A (en) 2022-05-31

Family

ID=81716848

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210204622.0A Pending CN114564459A (en) 2022-03-02 2022-03-02 Log file storage method, device and equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114564459A (en)

Similar Documents

Publication Publication Date Title
US9262584B2 (en) Systems and methods for managing a master patient index including duplicate record detection
US11514188B1 (en) System and method for serving subject access requests
CN110532799B (en) Data desensitization control method, electronic device and computer readable storage medium
CN110275889B (en) Feature processing method and device suitable for machine learning
CA2868540C (en) Entity resolution from documents
CN113535677B (en) Data analysis query management method, device, computer equipment and storage medium
CN108287901A (en) Method and apparatus for generating information
CN112559526A (en) Data table export method and device, computer equipment and storage medium
CN115544050A (en) Operation log recording method, device, equipment and storage medium
CN108595685B (en) Data processing method and device
CN114238334A (en) Heterogeneous data encoding method and device, heterogeneous data decoding method and device, computer equipment and storage medium
CN114066533A (en) Product recommendation method and device, electronic equipment and storage medium
CN111339566B (en) Block summarization method, device, computer equipment and storage medium
CN109271431B (en) Data extraction method, device, computer equipment and storage medium
CN114564459A (en) Log file storage method, device and equipment and computer readable storage medium
CN113656466A (en) Policy data query method, device, equipment and storage medium
CN114461606A (en) Data storage method and device, computer equipment and storage medium
CN113312540A (en) Information processing method, device, equipment, system and readable storage medium
CN113377711A (en) Data processing method, device, equipment and computer readable storage medium
Montanari et al. Near duplicate document detection for large information flows
CN111611056A (en) Data processing method and device, computer equipment and storage medium
CN112612817A (en) Data processing method and device, terminal equipment and computer readable storage medium
CN112668019B (en) Authority configuration method, authority configuration device, computer equipment and storage medium
US11138275B1 (en) Systems and methods for filter conversion
CN113468528A (en) Malicious device identification method and device, server 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