WO2020019436A1 - Log merging method, apparatus, electronic device, and medium - Google Patents

Log merging method, apparatus, electronic device, and medium Download PDF

Info

Publication number
WO2020019436A1
WO2020019436A1 PCT/CN2018/105540 CN2018105540W WO2020019436A1 WO 2020019436 A1 WO2020019436 A1 WO 2020019436A1 CN 2018105540 W CN2018105540 W CN 2018105540W WO 2020019436 A1 WO2020019436 A1 WO 2020019436A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
data
log
time
log file
Prior art date
Application number
PCT/CN2018/105540
Other languages
French (fr)
Chinese (zh)
Inventor
王倩
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020019436A1 publication Critical patent/WO2020019436A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application belongs to the field of data processing, and particularly relates to a method, a device, an electronic device, and a medium for merging logs.
  • Container-based virtualization technology represented by Docker is a hot topic of current virtualization technology.
  • Container technology enables lightweight virtualization by isolating processes and resources.
  • the application is deployed.
  • Multiple Docker containers can be deployed on a physical machine. Each Docker container is isolated from each other. This physical machine is generally called the host machine.
  • Docker containers can also run across hosts. When a Docker container runs across hosts, the resulting logs may also be scattered across the hosts. If multiple logs generated by a container are stored in multiple hosts, it is not conducive for the engineering staff to fully understand the progress of the project.
  • the existing log merge schemes are generally simple to merge multiple log data, and then merge them. The log data is often disordered, and it is difficult for engineers to analyze it well. At the same time, there is a lack of research on the overall properties of log data in the process of log merging, which also causes the problem of low utilization of log data.
  • the current log merging scheme has the problems that the merged log data is messy and the data utilization rate is low.
  • the current log merging scheme has the problems that the merged log data is messy and the data utilization rate is low.
  • a first aspect of the embodiments of the present application provides a method for merging logs, including:
  • a log directory is created, and a log file generated by the target container in each host is stored in the log directory; according to the generation time of the data in the log file, the log file of each of the log files is modified.
  • File name sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file; calculating the total time complexity
  • the total time complexity is used to indicate the number of unit times required to generate the data merge file; an average value of differences is calculated, and the average value of the differences is used to indicate the amount of data between each of the log files
  • the difference in time adding the total time complexity and the difference average to the data merge file to generate a log merge file.
  • a second aspect of the embodiments of the present application provides a log merging device, including:
  • a storage module configured to create a log directory after determining a target container, and store a log file generated by the target container in each host under the log directory; and a modification module configured to Generate time, modify the file names of each of the log files; a merge module for sorting each of the log files according to the file names of the log files, and sequentially sort the Data is merged to generate a data merged file; a first calculation module is configured to calculate a total time complexity, the total time complexity is used to represent a number of unit times required to generate the data merged file; a second calculation A module for calculating an average value of differences, where the average value of differences is used to indicate a difference in data amount between each of the log files; and a generating module is configured to convert the total time complexity and the difference The average value is added to the data merge file to generate a log merge file.
  • a third aspect of the embodiments of the present application provides a log merging electronic device, including a memory and a processor.
  • the memory stores computer-readable instructions that can run on the processor, and the processor executes all When describing computer-readable instructions, the following steps are implemented:
  • a log directory is created, and a log file generated by the target container in each host is stored in the log directory; according to the generation time of the data in the log file, the File name; sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file; calculating the total time complexity
  • the total time complexity is used to indicate the number of unit times required to generate the data merge file; an average value of differences is calculated, and the average value of the differences is used to indicate the amount of data between each of the log files The difference in time; adding the total time complexity and the difference average to the data merge file to generate a log merge file.
  • a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and is characterized in that the computer-readable instructions are implemented when executed by at least one processor. The following steps:
  • a log directory is created, and a log file generated by the target container in each host is stored in the log directory; according to the generation time of the data in the log file, the log file of each of the log files is modified.
  • File name sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file; calculating the total time complexity
  • the total time complexity is used to indicate the number of unit times required to generate the data merge file; an average value of differences is calculated, and the average value of the differences is used to indicate the amount of data between each of the log files
  • the difference in time adding the total time complexity and the difference average to the data merge file to generate a log merge file.
  • FIG. 1 is an implementation flowchart of a method for merging logs provided by an embodiment of the present application
  • FIG. 2 is a detailed implementation flowchart of a log merging method S103 provided in an embodiment of the present application
  • FIG. 3 is a detailed implementation flowchart of a log merging method S104 according to an embodiment of the present application.
  • FIG. 4 is a structural block diagram of a log merging device according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of an electronic device according to an embodiment of the present application.
  • FIG. 1 shows an implementation flow of a log merging method provided by an embodiment of the present application, and the method flow includes steps S101 to S106.
  • the specific implementation principle of each step is as follows.
  • Container-based virtualization technology represented by Docker is a hot topic of current virtualization technology.
  • Current Docker is an open source application container engine.
  • the application container engine can control the operation of multiple Docker containers. Multiple Docker containers can be deployed in a host, and programs in a Docker container can also run in different hosts.
  • the target container selected by the user is determined by receiving the container IP input by the user. Then create a basedir directory, and according to the host list corresponding to the container ip of the target container, copy and store the log files stored in the host in the host list and generated by the target container under the basedir directory, so that each destination is The log files generated by the target container stored in the host are merged for the first time to provide data support for subsequent merging and analysis processes.
  • S102 Modify the file name of each log file according to the generation time of the data in the log file.
  • the log file since each row of data in each log file in the log directory needs to be sorted in the subsequent process, in order to reduce the time consumed during sorting, the log file needs to be stored in Modify the file name for each host.
  • the modifying the file name of each log file according to the generation time of the data in the log file includes:
  • the time corresponding to the timestamp of the first line of data in the log file is taken as the first time of the log file, and the timestamp is used to record the generation time of the data;
  • the time corresponding to the timestamp is taken as the second time of the log file; the first time and the second time are written to the end of the file name of the log file to modify the file name of the log file .
  • the file name of the modified log file is: A (20180101100333, 20180104090234).
  • S103 Sort each of the log files according to the file name of the log file, and sequentially combine the data in each of the log files according to the sorted order to generate a data merged file.
  • sorting is performed by the file names of the log files, and it is not necessary to analyze the timestamp of each row of data in each log file each time data is merged, which is beneficial to reducing the sorting and merging process. time consumed.
  • the above S103 includes:
  • S1031 Sort each of the log files according to the first time in the file name of the log file in ascending order.
  • the file name of one log file is: A (20180101100333, 20180104090234), and the file name of the other log file is: B (20180102000003, 20180105090001).
  • 20180101100333 And 20180102000003 sorts the two log files. Understandably, according to the sorting rules in the embodiment of the present application, log file A (20180101100333, 20180104090234) will be ranked before log file B (20180102000003, 20180105090001).
  • S1032 Mark the log files sorted at the first position as the first log file, and mark the log files sorted at the second position as the second log file.
  • the second-ranked log file is the initial second-log file. Since this embodiment provides a circular execution process, the second-log file is variable. After each round of calculation, the next log file of the current second log file in the log directory is used as a new second log file, and a new round of execution process is repeated according to the new second log file.
  • the embodiment of the present application is actually a process of gradually adding data to a data merge file.
  • S1034 Determine whether the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last line of data in the data merge file.
  • the data merge file contains multiple lines of data, and each line of data has its corresponding time stamp.
  • each line of data contained in each log file is arranged from morning to night according to the time represented by the corresponding timestamp, and according to the following merge rules, each line of data in a data merge file is also The times represented by the corresponding timestamps are arranged from morning to night, so in the embodiment of the present application, it is determined whether the first time in the file name of the second log file is later than the data merged file.
  • the time corresponding to the time stamp of the last row of data can determine whether the generation time of all the data in the current second log file is later than the entire data in the current data merge file.
  • each line of data is sequentially used as the data to be inserted, and the data to be inserted is inserted into a specific area in the data merge file.
  • This specific The time corresponding to the time stamp of the previous line of data in the region is not later than the time corresponding to the time stamp of the data to be inserted, and the time corresponding to the time stamp of the next line of data in the specific region is not earlier than the time corresponding to the time stamp of the data to be inserted.
  • S1037 Mark the next log file next to the current second log file as a new second log file according to the order in which the log files in the log directory are sorted, and return to execute and judge the second log file. Whether the first time in the file name is later than the time corresponding to the time stamp of the last row of data in the data merge file, until the data in each of the log files in the log directory is stored in Describe the data merge files.
  • this embodiment provides a circular execution process, so the second log file is variable. After each round of calculation, the next log of the current second log file in the log directory will be changed. The file serves as a new second log file, and a new round of execution process is repeated according to the new second log file.
  • the number of times of time comparison of each line of data in the second log file when inserting the data merge file can be reduced; second, because the file name of each log file includes the first time and The second time, so the time of analyzing the timestamp can be shortened during the actual sorting, which is beneficial to improve the efficiency of the single time comparison.
  • the rows of data in multiple log files are arranged and integrated in an orderly manner, which is beneficial for users to browse. And analyze log file data.
  • the data merge file mentioned above integrates the data originally stored in various log files in different hosts, no new data or parameters are generated.
  • the data characteristics of the log file itself need to calculate the total time complexity, thereby improving the utilization of the data in the log file.
  • the above S104 includes:
  • the formula 1 is: Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1 i represents the i-th occurrence of the The first time in the file name of the second log file is later than the number of the first data lines when the time corresponding to the time stamp of the last line of data in the data merge file, the linum2 i represents the i-th occurrence The first time in the file name of the second log file is not later than the number of the second data lines when the time corresponding to the time stamp of the last line of data in the data merge file.
  • the current data merge file is Multiple ordered data are composed, and the current second log file is also composed of multiple ordered data.
  • the calculation rule based on the time complexity of the ordered queue merge if there are two ordered queues, the data amount of an ordered queue is m, and the data amount of an ordered queue is n, the time complexity of the merge of the two is O (n + m), so in the embodiment of the present application, all cases where the first time in the file name of the second log file is not later than the time corresponding to the time stamp of the last row of data in the data merge file , The total time complexity is
  • formula 2 Calculate the average of the difference, the logsize i represents the data amount of the i-th log file from top to bottom according to the order, lognum is the total amount of the log file, and logmean is the average of the difference.
  • the total time complexity and the average value of the differences can be added to the first line of the data merge file to more clearly reflect the characteristics of the log file generated by the target container, and it is convenient for users to grasp the overall operation of the target container. happening.
  • log directory is created, and the log files generated by the target container in each host are stored in the log directory, and each of the modifications is modified according to the generation time of the data in the log file.
  • Log file file names and after sorting each log file based on the file names, combine the data in each log file to generate a data merge file, calculate the total time complexity in generating the data merge process, and The average value of the difference between the amount of data, and finally add the total time complexity and the average value of the difference to the data merge file to generate a log merge file to achieve reasonable integration of a large number of log files, making it easy for users to browse and find logs File information, and in the process of integration, the relevant parameters of the log file are calculated to improve data utilization.
  • FIG. 4 shows a structural block diagram of the log merging device provided in the embodiment of the present application.
  • the device includes:
  • the storage module 401 is configured to create a log directory after the target container is determined, and store a log file generated by the target container in each host under the log directory; and a modification module 402 is configured to store the log file according to the log file.
  • a merging module 403 is configured to sort each of the log files according to the file names of the log files, and sequentially sort each of the logs according to the sorted order The data in the files are merged to generate a data merged file.
  • the first calculation module 404 is configured to calculate a total time complexity, where the total time complexity is used to indicate the number of unit times required to generate the data merged file.
  • a second calculation module 405, configured to calculate an average value of the difference, the average value of the difference is used to indicate a difference in the amount of data between each of the log files; and a generation module 406 is used to complicate the total time Degree and the difference average value are added to the data merge file to generate a log merge file.
  • the modifying the file name of each log file according to the generation time of the data in the log file includes:
  • the time corresponding to the timestamp of the first line of data in the log file is taken as the first time of the log file, and the timestamp is used to record the generation time of the data;
  • the time corresponding to the timestamp is taken as the second time of the log file; the first time and the second time are written to the end of the file name of the log file to modify the file name of the log file.
  • sorting each of the log files according to the file name of the log file, and sequentially combining the data in each of the log files according to the sorted order to generate a data merged file includes: Sorting each of the log files according to the first time in the file name of the log file in ascending order; marking the log file ranked first as the first log file, and The second-ranked log file is marked as a second log file; the data in the first log file is stored in the data merge file; and the second log file in the file name of the second log file is judged. Whether a time is later than the time corresponding to the time stamp of the last line of data in the data merge file;
  • the calculating the total time complexity includes:
  • the time when the first time in the file name of the second log file appears later than the last line of data in the data merge file is counted The number of times corresponding to the timestamp is taken as the first number; in the process of sequentially merging data in each of the log files, the first time in the file name of the second log file appears Number of times later than the time corresponding to the time stamp of the last line of data in the data merge file, as the second number; when the first time in the file name of the second log file appears, the data merge is not later than the data
  • the time corresponding to the time stamp of the last line of data in the file is recorded, the current number of data lines in the second log file is recorded as the first data line number, and the current number of data lines in the data merge file is recorded as Number of second data rows; by formula: Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1
  • the calculating the average of the difference includes:
  • logsize i represents the data amount of the i-th log file from top to bottom according to the order
  • lognum is the total amount of the log file
  • logmean is the average of the difference
  • FIG. 5 is a schematic diagram of an electronic device according to an embodiment of the present application.
  • the electronic device 5 of this embodiment includes: a processor 50, a memory 51, and computer-readable instructions 52 stored in the memory 51 and executable on the processor 50, such as a merge of logs. program.
  • the processor 50 executes the computer-readable instructions 52
  • the steps in the embodiment of the method for merging the above logs are implemented, for example, steps 101 to 106 shown in FIG.
  • the processor 50 executes the computer-readable instructions 52
  • the functions of the modules / units in the foregoing device embodiments are implemented, for example, the functions of the units 401 to 406 shown in FIG. 4.
  • the computer-readable instructions 52 may be divided into one or more modules / units, the one or more modules / units are stored in the memory 51 and executed by the processor 50, To complete this application.
  • the one or more modules / units may be a series of computer-readable instruction instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 52 in the electronic device 5.
  • the electronic device 5 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the electronic device may include, but is not limited to, a processor 50 and a memory 51.
  • FIG. 5 is only an example of the electronic device 5 and does not constitute a limitation on the electronic device 5. It may include more or fewer components than shown in the figure, or combine some components or different components.
  • the electronic device may further include an input / output device, a network access device, a bus, and the like.
  • the processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 51 may be an internal storage unit of the electronic device 5, such as a hard disk or a memory of the electronic device 5.
  • the memory 51 may also be an external storage device of the electronic device 5, such as a plug-in hard disk, a Smart Media Card (SMC), and a Secure Digital (SD) provided on the electronic device 5. Card, flash card, etc. Further, the memory 51 may further include both an internal storage unit of the electronic device 5 and an external storage device.
  • the memory 51 is configured to store the computer-readable instructions and other programs and data required by the electronic device.
  • the memory 51 may also be used to temporarily store data that has been output or is to be output.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application is used in the field of data processing, and provides a log merging method, apparatus, electronic device, and medium; after determining a target container, a log directory is created and log files generated by the target container in each host machine are stored in said log directory; according to the generation time of the data in the log file, the file name of each of the log files is modified, and after sorting the log files on the basis of file name, the data in each log file is merged to generate a data merge file; the total time complexity and the average value of the differences in the amount of data between individual log files during the process of generating data merges are calculated; finally, the total time complexity and the average of the differences are added to the data merge file to generate a log merge file; thus the reasonable integration of a large number of log files is achieved, making it convenient for a user to browse and find log file information; also, during the process of integration, the relevant parameters of the log file are calculated, increasing data utilization.

Description

一种日志的归并方法、装置、电子设备及介质Method, device, electronic equipment and medium for merging logs
本申请要求于2018年7月25日提交中国专利局、申请号为201810824218.7、发明名称为“日志的归并方法及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on July 25, 2018, with application number 201810824218.7, and the invention name is "Merger of Logging and Terminal Equipment", the entire contents of which are incorporated herein by reference. .
技术领域Technical field
本申请属于数据处理领域,尤其涉及一种日志的归并方法、装置、电子设备及介质。The present application belongs to the field of data processing, and particularly relates to a method, a device, an electronic device, and a medium for merging logs.
背景技术Background technique
以Docker为代表的基于容器的虚拟化技术是当前虚拟技术的热点。容器技术通过隔离进程和资源,实现轻量级虚拟化。容器创建并运行后,应用程序即部署完成,一台物理机上可以部署多个Docker容器,每个Docker容器之间相互隔离,该物理机一般被称为宿主机。在现有技术中,Docker容器也可以跨宿主机运行,当Docker容器跨宿主机运行时,由此产生的日志也可能分散在各个宿主机中。如果一个容器产生的多个日志分别存储在多个宿主机中,则不利于工程人员全面的了解工程的进展,现有的日志归并方案一般都是简单的将多条日志数据进行合并,归并后的日志数据往往是杂乱无序的,工程人员难以很好的进行分析,同时在日志归并过程中并缺乏对日志数据整体属性的研究,这也导致了日志数据的利用率低的问题。Container-based virtualization technology represented by Docker is a hot topic of current virtualization technology. Container technology enables lightweight virtualization by isolating processes and resources. After the container is created and run, the application is deployed. Multiple Docker containers can be deployed on a physical machine. Each Docker container is isolated from each other. This physical machine is generally called the host machine. In the prior art, Docker containers can also run across hosts. When a Docker container runs across hosts, the resulting logs may also be scattered across the hosts. If multiple logs generated by a container are stored in multiple hosts, it is not conducive for the engineering staff to fully understand the progress of the project. The existing log merge schemes are generally simple to merge multiple log data, and then merge them. The log data is often disordered, and it is difficult for engineers to analyze it well. At the same time, there is a lack of research on the overall properties of log data in the process of log merging, which also causes the problem of low utilization of log data.
综上,当前的日志归并方案存在归并后的日志数据较为杂乱以及数据利用率低的问题。In summary, the current log merging scheme has the problems that the merged log data is messy and the data utilization rate is low.
技术问题technical problem
当前的日志归并方案存在归并后的日志数据较为杂乱以及数据利用率低的问题。The current log merging scheme has the problems that the merged log data is messy and the data utilization rate is low.
技术解决方案Technical solutions
本申请实施例的第一方面提供了一种日志的归并方法,包括:A first aspect of the embodiments of the present application provides a method for merging logs, including:
在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;将所述总时间复杂度以 及所述差值平均值添加进所述数据合并文件,生成日志归并文件。After the target container is determined, a log directory is created, and a log file generated by the target container in each host is stored in the log directory; according to the generation time of the data in the log file, the log file of each of the log files is modified. File name; sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file; calculating the total time complexity The total time complexity is used to indicate the number of unit times required to generate the data merge file; an average value of differences is calculated, and the average value of the differences is used to indicate the amount of data between each of the log files The difference in time; adding the total time complexity and the difference average to the data merge file to generate a log merge file.
本申请实施例的第二方面提供了一种日志的归并装置,包括:A second aspect of the embodiments of the present application provides a log merging device, including:
存储模块,用于在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;修改模块,用于根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;合并模块,用于根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;第一计算模块,用于计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;第二计算模块,用于计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;生成模块,用于将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。A storage module configured to create a log directory after determining a target container, and store a log file generated by the target container in each host under the log directory; and a modification module configured to Generate time, modify the file names of each of the log files; a merge module for sorting each of the log files according to the file names of the log files, and sequentially sort the Data is merged to generate a data merged file; a first calculation module is configured to calculate a total time complexity, the total time complexity is used to represent a number of unit times required to generate the data merged file; a second calculation A module for calculating an average value of differences, where the average value of differences is used to indicate a difference in data amount between each of the log files; and a generating module is configured to convert the total time complexity and the difference The average value is added to the data merge file to generate a log merge file.
本申请实施例的第三方面提供了一种日志的归并电子设备,包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A third aspect of the embodiments of the present application provides a log merging electronic device, including a memory and a processor. The memory stores computer-readable instructions that can run on the processor, and the processor executes all When describing computer-readable instructions, the following steps are implemented:
在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。After the target container is determined, a log directory is created, and a log file generated by the target container in each host is stored in the log directory; according to the generation time of the data in the log file, the File name; sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file; calculating the total time complexity The total time complexity is used to indicate the number of unit times required to generate the data merge file; an average value of differences is calculated, and the average value of the differences is used to indicate the amount of data between each of the log files The difference in time; adding the total time complexity and the difference average to the data merge file to generate a log merge file.
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and is characterized in that the computer-readable instructions are implemented when executed by at least one processor. The following steps:
在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。After the target container is determined, a log directory is created, and a log file generated by the target container in each host is stored in the log directory; according to the generation time of the data in the log file, the log file of each of the log files is modified. File name; sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file; calculating the total time complexity The total time complexity is used to indicate the number of unit times required to generate the data merge file; an average value of differences is calculated, and the average value of the differences is used to indicate the amount of data between each of the log files The difference in time; adding the total time complexity and the difference average to the data merge file to generate a log merge file.
有益效果Beneficial effect
便于用户浏览和查找日志文件信息,并在整合的过程中,对日志文件的相关参数进行计算,从而提高数据利用率。It is convenient for users to browse and find log file information, and to calculate related parameters of the log file during the integration process, thereby improving data utilization.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present application. For some embodiments, for those of ordinary skill in the art, other drawings can be obtained according to these drawings without paying creative labor.
图1是本申请实施例提供的日志的归并方法的实现流程图;FIG. 1 is an implementation flowchart of a method for merging logs provided by an embodiment of the present application; FIG.
图2是本申请实施例提供的日志的归并方法S103的具体实现流程图;FIG. 2 is a detailed implementation flowchart of a log merging method S103 provided in an embodiment of the present application;
图3是本申请实施例提供的日志的归并方法S104的具体实现流程图;FIG. 3 is a detailed implementation flowchart of a log merging method S104 according to an embodiment of the present application; FIG.
图4是本申请实施例提供的日志的归并装置的结构框图;4 is a structural block diagram of a log merging device according to an embodiment of the present application;
图5是本申请实施例提供的电子设备的示意图。FIG. 5 is a schematic diagram of an electronic device according to an embodiment of the present application.
本发明的实施方式Embodiments of the invention
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are provided in order to thoroughly understand the embodiments of the present application. However, it should be clear to a person skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary details.
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solution described in this application, specific examples are used for description below.
图1示出了本申请实施例提供的日志的归并方法的实现流程,该方法流程包括步骤S101至S106。各步骤的具体实现原理如下。FIG. 1 shows an implementation flow of a log merging method provided by an embodiment of the present application, and the method flow includes steps S101 to S106. The specific implementation principle of each step is as follows.
S101:在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下。S101: After the target container is determined, a log directory is created, and a log file generated by the target container in each host is stored in the log directory.
由于容器技术可以实现程序的快速部署,日益成为了人们生活中经常使用的技术,以Docker为代表的基于容器的虚拟化技术是当前虚拟技术的热点,当前的Docker是一个开源的应用容器引擎,该应用容器引擎可以控制多个Docker容器的运行。一个宿主机内可以部署多个Docker容器,同时一个Docker容器中的程序还可以在不同的宿主机中运行。As container technology can realize the rapid deployment of programs, it has become a technology often used in people's lives. Container-based virtualization technology represented by Docker is a hot topic of current virtualization technology. Current Docker is an open source application container engine. The application container engine can control the operation of multiple Docker containers. Multiple Docker containers can be deployed in a host, and programs in a Docker container can also run in different hosts.
可以理解地,当一个Docker容器中的程序在不同的宿主机中运行时,生成的相关的日志文件也会存储于不同的宿主机中,因此用户难以对该Docker容器的整体运行情况进行分 析。Understandably, when a program in a Docker container runs on different hosts, the related log files generated will also be stored in different hosts, so it is difficult for users to analyze the overall operation of the Docker container.
可选地,在本申请实施例中,通过接收用户输入的容器IP,确定用户选择的目标容器。再创建一个basedir目录,根据目标容器的容器ip对应的宿主机列表,将宿主机列表中的宿主机内存储的且由目标容器生成的日志文件拷贝并存储于该basedir目录下,从而对各个宿主机中存储的由目标容器生成的日志文件作一个初次合并,为后续的归并及分析过程提供数据支持。Optionally, in the embodiment of the present application, the target container selected by the user is determined by receiving the container IP input by the user. Then create a basedir directory, and according to the host list corresponding to the container ip of the target container, copy and store the log files stored in the host in the host list and generated by the target container under the basedir directory, so that each destination is The log files generated by the target container stored in the host are merged for the first time to provide data support for subsequent merging and analysis processes.
S102:根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名。S102: Modify the file name of each log file according to the generation time of the data in the log file.
在本申请实施例中,由于需要在后续的过程中对日志目录下的各个日志文件中的各行数据进行排序,为了减少排序时所消耗的时间,所以在本步骤中需要对日志文件在存储于各个宿主机时的文件名进行修改。In the embodiment of the present application, since each row of data in each log file in the log directory needs to be sorted in the subsequent process, in order to reduce the time consumed during sorting, the log file needs to be stored in Modify the file name for each host.
可选地,所述根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名,包括:Optionally, the modifying the file name of each log file according to the generation time of the data in the log file includes:
将所述日志文件中的第一行数据的时间戳对应的时间作为所述日志文件的第一时间,所述时间戳用于记录数据的生成时间;将所述日志文件中的最后一行数据的时间戳对应的时间作为所述日志文件的第二时间;将所述第一时间和所述第二时间写入所述日志文件的文件名的末尾,以修改所述所述日志文件的文件名。The time corresponding to the timestamp of the first line of data in the log file is taken as the first time of the log file, and the timestamp is used to record the generation time of the data; The time corresponding to the timestamp is taken as the second time of the log file; the first time and the second time are written to the end of the file name of the log file to modify the file name of the log file .
示例性地,假设一个日志文件的原来的文件名为:A,若该日志文件的第一行数据的时间戳对应的时间为20180101100333,而该日志文件的第一行数据的时间戳对应的时间为20180104090234,则修改后的日志文件的文件名为:A(20180101100333,20180104090234)。Exemplarily, assuming that the original file name of a log file is: A, if the time stamp corresponding to the time stamp of the first line of data in the log file is 20180101100333, and the time stamp corresponding to the time stamp of the first line of data in the log file Is 20180104090234, the file name of the modified log file is: A (20180101100333, 20180104090234).
S103,根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件。S103: Sort each of the log files according to the file name of the log file, and sequentially combine the data in each of the log files according to the sorted order to generate a data merged file.
可以理解地,在本申请实施例中,通过日志文件的文件名进行排序,不需要在每次数据合并时都分析一次各个日志文件中各行数据的时间戳,有利于减少排序以及合并过程中所消耗的时间。Understandably, in the embodiment of the present application, sorting is performed by the file names of the log files, and it is not necessary to analyze the timestamp of each row of data in each log file each time data is merged, which is beneficial to reducing the sorting and merging process. time consumed.
作为本申请的一个实施例,如图2所示,上述S103包括:As an embodiment of the present application, as shown in FIG. 2, the above S103 includes:
S1031,根据所述日志文件的文件名内的所述第一时间由小到大的顺序,对各个所述日志文件进行排序。S1031: Sort each of the log files according to the first time in the file name of the log file in ascending order.
示例性地,如上文示例所述,一个日志文件的文件名为:A(20180101100333,20180104090234),另一个日志文件的文件名为:B(20180102000003,20180105090001)则在本申请实施例中,根据20180101100333以及20180102000003对两个日志文件进行排序,可以理解地,根据本申请实施例中的排序规则,日志文件A(20180101100333, 20180104090234)会排在日志文件B(20180102000003,20180105090001)之前。Exemplarily, as described in the example above, the file name of one log file is: A (20180101100333, 20180104090234), and the file name of the other log file is: B (20180102000003, 20180105090001). In the embodiment of the present application, according to 20180101100333 And 20180102000003 sorts the two log files. Understandably, according to the sorting rules in the embodiment of the present application, log file A (20180101100333, 20180104090234) will be ranked before log file B (20180102000003, 20180105090001).
S1032,将排序在第一位的所述日志文件标记为第一日志文件,将排序在第二位的所述日志文件标记为第二日志文件。S1032: Mark the log files sorted at the first position as the first log file, and mark the log files sorted at the second position as the second log file.
值得注意地,在本申请实施例中,排序在第二位的日志文件是初始的第二日志文件,由于本实施例提供的是一个循环执行的过程,所以第二日志文件是可变的,在每一轮计算之后,就会将日志目录中当前的第二日志文件的下一个日志文件作为新的第二日志文件,并根据新的第二日志文件重复进行新的一轮执行过程。It is worth noting that, in the embodiment of the present application, the second-ranked log file is the initial second-log file. Since this embodiment provides a circular execution process, the second-log file is variable. After each round of calculation, the next log file of the current second log file in the log directory is used as a new second log file, and a new round of execution process is repeated according to the new second log file.
S1033,将所述第一日志文件内的数据存入所述数据合并文件。S1033. Store data in the first log file into the data merge file.
可以理解地,在所述第一日志文件内的数据存入之前,数据合并文件已经创建,只是在第一日志文件内的数据存入之前,数据合并文件内并没有数据。本申请实施例实际上是一个逐渐向数据合并文件添加数据的过程。Understandably, before the data in the first log file is stored, a data merge file has been created, but before the data in the first log file is stored, there is no data in the data merge file. The embodiment of the present application is actually a process of gradually adding data to a data merge file.
S1034:判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间。S1034: Determine whether the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last line of data in the data merge file.
可以理解地,在第一日志文件内的数据存入数据合并文件之后,数据合并文件内包含有多行数据,每一行数据都有其对应的时间戳。而且由于在本申请实施例中,每一个日志文件内包含的各行数据是按照对应的时间戳代表的时间由早至晚排列的,而且根据下文的合并规则,一个数据合并文件内的各行数据也是按照对应的时间戳代表的时间由早至晚排列的,所以在本申请实施例中,通过判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间,就可以判断出当前的第二日志文件内的全部数据的生成时间是否整体晚于当前的数据合并文件内的全部数据。Understandably, after the data in the first log file is stored in the data merge file, the data merge file contains multiple lines of data, and each line of data has its corresponding time stamp. Moreover, in the embodiment of the present application, each line of data contained in each log file is arranged from morning to night according to the time represented by the corresponding timestamp, and according to the following merge rules, each line of data in a data merge file is also The times represented by the corresponding timestamps are arranged from morning to night, so in the embodiment of the present application, it is determined whether the first time in the file name of the second log file is later than the data merged file. The time corresponding to the time stamp of the last row of data can determine whether the generation time of all the data in the current second log file is later than the entire data in the current data merge file.
S1035,若所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间,则将所述第二日志文件内的全部数据统一存入所述数据合并文件的末行数据之后。S1035: If the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last row of data in the data merge file, all data in the second log file is unified After the last line of data is stored in the data merge file.
S1036,若所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间,则按照所述第二日志文件中各条数据的时间戳,将所述第二日志文件中的各条数据依次插入所述数据合并文件中,以使插入后的所述数据合并文件内各行数据的时间戳对应的时间由小到大排列。S1036, if the first time in the file name of the second log file is not later than the time corresponding to the timestamp of the last row of data in the data merge file, according to each piece of data in the second log file Inserting each piece of data in the second log file into the data merge file in sequence, so that the time corresponding to the timestamp of each line of data in the inserted data merge file is arranged from small to large.
在本申请实施例中的本步骤中,按照第二日志文件中各行数据的时间戳对应的时间,将各行数据依次作为待插数据,将待插数据插入数据合并文件中的特定区域,这个特定区域的上一行数据的时间戳对应的时间不晚于待插数据的时间戳对应的时间,特定区域的下一行数据的时间戳对应的时间不早于待插数据的时间戳对应的时间。In this step in the embodiment of the present application, according to the time corresponding to the timestamp of each line of data in the second log file, each line of data is sequentially used as the data to be inserted, and the data to be inserted is inserted into a specific area in the data merge file. This specific The time corresponding to the time stamp of the previous line of data in the region is not later than the time corresponding to the time stamp of the data to be inserted, and the time corresponding to the time stamp of the next line of data in the specific region is not earlier than the time corresponding to the time stamp of the data to be inserted.
S1037,按照所述日志目录下各个日志文件排序的顺序,将当前的所述第二日志文件的下一个所述日志文件标记为新的第二日志文件,并返回执行判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间的操作,直至所述日志目录下的各个所述日志文件内的数据均存入所述数据合并文件。S1037: Mark the next log file next to the current second log file as a new second log file according to the order in which the log files in the log directory are sorted, and return to execute and judge the second log file. Whether the first time in the file name is later than the time corresponding to the time stamp of the last row of data in the data merge file, until the data in each of the log files in the log directory is stored in Describe the data merge files.
如上文所述,本实施例提供的是一个循环执行的过程,所以第二日志文件是可变的,在每一轮计算之后,就会将日志目录中当前的第二日志文件的下一个日志文件作为新的第二日志文件,并根据新的第二日志文件重复进行新的一轮执行过程。As described above, this embodiment provides a circular execution process, so the second log file is variable. After each round of calculation, the next log of the current second log file in the log directory will be changed. The file serves as a new second log file, and a new round of execution process is repeated according to the new second log file.
可以理解地,通过上述排序以及合并的过程,首先可以减少第二日志文件中各行数据插入数据合并文件时对于时间的比对次数;其次由于每个日志文件的文件名中包含了第一时间以及第二时间,因此在实际排序时可以缩小分析时间戳的时间,有利于提高单次时间比对的效率;最后将多个日志文件中的各行数据进行有序的排列和整合,有利于用户浏览和分析日志文件的数据。Understandably, through the above-mentioned sorting and merging process, first, the number of times of time comparison of each line of data in the second log file when inserting the data merge file can be reduced; second, because the file name of each log file includes the first time and The second time, so the time of analyzing the timestamp can be shortened during the actual sorting, which is beneficial to improve the efficiency of the single time comparison. Finally, the rows of data in multiple log files are arranged and integrated in an orderly manner, which is beneficial for users to browse. And analyze log file data.
S104,计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数。S104. Calculate a total time complexity, where the total time complexity is used to indicate a number of unit times required to generate the data merge file.
可以理解地,上文所提到的数据合并文件中虽然整合了原本存储于不同宿主机中各个日志文件的数据,但是并未生成新的数据或参数,在本申请实施例中,为了计算各个日志文件本身的数据特性,需要计算总时间复杂度,从而提高对于日志文件的数据的利用率。Understandably, although the data merge file mentioned above integrates the data originally stored in various log files in different hosts, no new data or parameters are generated. In the embodiment of the present application, in order to calculate each The data characteristics of the log file itself need to calculate the total time complexity, thereby improving the utilization of the data in the log file.
作为本申请的一个实施例,如图3所示,上述S104包括:As an embodiment of the present application, as shown in FIG. 3, the above S104 includes:
S1041,统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第一数量。S1041. Counting that in the process of sequentially combining data in each of the log files, the first time in the file name of the second log file that appears later than the last line of data in the data merge file The number of times corresponding to the timestamp, as the first number.
S1042,统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第二数量。S1042, it is counted that in the process of sequentially combining data in each of the log files, the first time in the file name of the second log file appears no later than the last line in the data merge file The number of times corresponding to the time stamp of the data, as the second number.
S1043,当出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时,记录当前的所述第二日志文件内数据的行数,作为第一数据行数,记录当前的所述数据合并文件内数据的行数,作为第二数据行数。S1043, when the first time in the file name of the second log file appears no later than the time corresponding to the time stamp of the last line of data in the data merge file, record the current time in the second log file The number of data lines is used as the first data line number, and the current number of data lines in the data merge file is recorded as the second data line number.
S1044,通过公式1计算所述总时间复杂度S1044. Calculate the total time complexity through Formula 1.
可选地,所述公式1为:
Figure PCTCN2018105540-appb-000001
计算所述总时间复杂度,所述Ticom表示所述总时间复杂度,所述num1为所述第一数量,所述num2为所述第二数量,所述linum1 i表示第i次出现所述第二日志文件的文件名内的所述第一时间晚于 所述数据合并文件内末行数据的时间戳对应的时间时的所述第一数据行数,所述linum2 i表示第i次出现所述所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第二数据行数。
Optionally, the formula 1 is:
Figure PCTCN2018105540-appb-000001
Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1 i represents the i-th occurrence of the The first time in the file name of the second log file is later than the number of the first data lines when the time corresponding to the time stamp of the last line of data in the data merge file, the linum2 i represents the i-th occurrence The first time in the file name of the second log file is not later than the number of the second data lines when the time corresponding to the time stamp of the last line of data in the data merge file.
可以理解地,情况1,由于当出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间时,只需要进行一次对比,就可以将第二日志文件内的全部数据统一存入所述数据合并文件的末行数据之后,所以在这种情况下的时间复杂度为1,所以如果一共出现了num1次的第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间的情况,则这种情况对应的总的时间复杂度为num1。Understandably, in case 1, since the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last row of data in the data merge file, only one comparison is required. , All the data in the second log file can be uniformly stored in the last line of data in the data merge file, so the time complexity in this case is 1, so if the second log appears num1 times in total If the first time in the file name of the file is later than the time corresponding to the time stamp of the last row of data in the data merge file, then the total time complexity corresponding to this case is num1.
可以理解地,情况2,由于当第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时,当前的数据合并文件是由多个有序排列的数据组成,而当前的第二日志文件也是由多个有序排列的数据组成。基于有序队列合并的时间复杂度的计算规则:若有两个有序队列,一个有序队列的数据量为m,一个有序队列的数据量为n,则二者合并的时间复杂度为O(n+m),所以本申请实施例中,所有符合第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间的情况的,总的时间复杂度为
Figure PCTCN2018105540-appb-000002
Understandably, in case 2, when the first time in the file name of the second log file is not later than the time corresponding to the time stamp of the last row of data in the data merge file, the current data merge file is Multiple ordered data are composed, and the current second log file is also composed of multiple ordered data. The calculation rule based on the time complexity of the ordered queue merge: if there are two ordered queues, the data amount of an ordered queue is m, and the data amount of an ordered queue is n, the time complexity of the merge of the two is O (n + m), so in the embodiment of the present application, all cases where the first time in the file name of the second log file is not later than the time corresponding to the time stamp of the last row of data in the data merge file , The total time complexity is
Figure PCTCN2018105540-appb-000002
可以理解地,结合上述两种情况,计算出的总时间复杂度为
Figure PCTCN2018105540-appb-000003
Figure PCTCN2018105540-appb-000004
Understandably, the total time complexity calculated by combining the above two cases is
Figure PCTCN2018105540-appb-000003
Figure PCTCN2018105540-appb-000004
S105,计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况。S105. Calculate a difference average value, where the difference average value is used to indicate a difference in data amount between the log files.
可选地,通过公式2:
Figure PCTCN2018105540-appb-000005
计算所述差值平均值,所述logsize i表示依据排序从上至下第i个日志文件的数据量,lognum为所述日志文件的总量,logmean为所述差值平均值。
Optionally, by formula 2:
Figure PCTCN2018105540-appb-000005
Calculate the average of the difference, the logsize i represents the data amount of the i-th log file from top to bottom according to the order, lognum is the total amount of the log file, and logmean is the average of the difference.
S106,将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。S106. Add the total time complexity and the difference average to the data merge file to generate a log merge file.
可选地,可以将总时间复杂度以及所述差值平均值添加在所述数据合并文件的首行,以更加清晰地体现目标容器生成的日志文件的特性,便于用户掌握目标容器运行的整体情况。Optionally, the total time complexity and the average value of the differences can be added to the first line of the data merge file to more clearly reflect the characteristics of the log file generated by the target container, and it is convenient for users to grasp the overall operation of the target container. Happening.
可以理解地,通过在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下,根据日志文件中数据的生成时间,修改各个所述日志文件的文件名,并在基于文件名对各个日志文件进行排序之后,将各个日志文件内的数 据进行合并,生成数据合并文件,计算生成数据合并过程中的总时间复杂度以及各个日志文件之间的数据量的差值平均值,最后将总时间复杂度以及所述差值平均值添加进数据合并文件,生成日志归并文件,实现对大量的日志文件进行合理整合,便于用户浏览和查找日志文件信息,并在整合的过程中,对日志文件的相关参数进行计算,以提高数据利用率。Understandably, after the target container is determined, a log directory is created, and the log files generated by the target container in each host are stored in the log directory, and each of the modifications is modified according to the generation time of the data in the log file. Log file file names, and after sorting each log file based on the file names, combine the data in each log file to generate a data merge file, calculate the total time complexity in generating the data merge process, and The average value of the difference between the amount of data, and finally add the total time complexity and the average value of the difference to the data merge file to generate a log merge file to achieve reasonable integration of a large number of log files, making it easy for users to browse and find logs File information, and in the process of integration, the relevant parameters of the log file are calculated to improve data utilization.
对应于上文实施例所述的日志的归并方法,图4示出了本申请实施例提供的日志的归并装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。参照图4,该装置包括:Corresponding to the log merging method described in the foregoing embodiment, FIG. 4 shows a structural block diagram of the log merging device provided in the embodiment of the present application. For convenience of explanation, only a part related to the embodiment of the application is shown. Referring to FIG. 4, the device includes:
存储模块401,用于在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;修改模块402,用于根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;合并模块403,用于根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;第一计算模块404,用于计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;第二计算模块405,用于计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;生成模块406,用于将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。The storage module 401 is configured to create a log directory after the target container is determined, and store a log file generated by the target container in each host under the log directory; and a modification module 402 is configured to store the log file according to the log file. When the data is generated, the file names of each of the log files are modified; a merging module 403 is configured to sort each of the log files according to the file names of the log files, and sequentially sort each of the logs according to the sorted order The data in the files are merged to generate a data merged file. The first calculation module 404 is configured to calculate a total time complexity, where the total time complexity is used to indicate the number of unit times required to generate the data merged file. A second calculation module 405, configured to calculate an average value of the difference, the average value of the difference is used to indicate a difference in the amount of data between each of the log files; and a generation module 406 is used to complicate the total time Degree and the difference average value are added to the data merge file to generate a log merge file.
可选地,所述根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名,包括:Optionally, the modifying the file name of each log file according to the generation time of the data in the log file includes:
将所述日志文件中的第一行数据的时间戳对应的时间作为所述日志文件的第一时间,所述时间戳用于记录数据的生成时间;将所述日志文件中的最后一行数据的时间戳对应的时间作为所述日志文件的第二时间;将所述第一时间和所述第二时间写入所述日志文件的文件名的末尾,以修改所述日志文件的文件名。The time corresponding to the timestamp of the first line of data in the log file is taken as the first time of the log file, and the timestamp is used to record the generation time of the data; The time corresponding to the timestamp is taken as the second time of the log file; the first time and the second time are written to the end of the file name of the log file to modify the file name of the log file.
可选地,所述根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件,包括:根据所述日志文件的文件名内的所述第一时间由小到大的顺序,对各个所述日志文件进行排序;将排序在第一位的所述日志文件标记为第一日志文件,将排序在第二位的所述日志文件标记为第二日志文件;将所述第一日志文件内的数据存入所述数据合并文件;判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间;Optionally, sorting each of the log files according to the file name of the log file, and sequentially combining the data in each of the log files according to the sorted order to generate a data merged file includes: Sorting each of the log files according to the first time in the file name of the log file in ascending order; marking the log file ranked first as the first log file, and The second-ranked log file is marked as a second log file; the data in the first log file is stored in the data merge file; and the second log file in the file name of the second log file is judged. Whether a time is later than the time corresponding to the time stamp of the last line of data in the data merge file;
若所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间,则将所述第二日志文件内的全部数据统一存入所述数据合并文件的末行数据之后;若所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行 数据的时间戳对应的时间,则按照所述第二日志文件中各条数据的时间戳,将所述第二日志文件中的各条数据依次插入所述数据合并文件中,以使插入后的所述数据合并文件内各行数据的时间戳对应的时间由小到大排列;按照所述日志目录下各个日志文件排序的顺序,将当前的所述第二日志文件的下一个所述日志文件标记为新的第二日志文件,并返回执行判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间的操作,直至所述日志目录下的各个所述日志文件内的数据均存入所述数据合并文件。If the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last row of data in the data merge file, all the data in the second log file are stored in a unified manner After the last line of data in the data merge file; if the first time in the file name of the second log file is no later than the time corresponding to the time stamp of the last line of data in the data merge file, The timestamp of each piece of data in the second log file is described, and each piece of data in the second log file is sequentially inserted into the data merge file, so that the timestamp of each line of data in the inserted data merge file The corresponding time is arranged from small to large; according to the sort order of each log file in the log directory, the next log file of the current second log file is marked as a new second log file, and returned to execute An operation of judging whether the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last line of data in the data merge file, until the log destination The data in each of the recorded log files is stored in the data merge file.
可选地,所述计算所述总时间复杂度,包括:Optionally, the calculating the total time complexity includes:
统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第一数量;统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第二数量;当出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时,记录当前的所述第二日志文件内数据的行数,作为第一数据行数,记录当前的所述数据合并文件内数据的行数,作为第二数据行数;通过公式:
Figure PCTCN2018105540-appb-000006
计算所述总时间复杂度,所述Ticom表示所述总时间复杂度,所述num1为所述第一数量,所述num2为所述第二数量,所述linum1 i表示第i次出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第一数据行数,所述linum2 i表示第i次出现所述所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第二数据行数。
In the process of sequentially merging data in each of the log files, the time when the first time in the file name of the second log file appears later than the last line of data in the data merge file is counted The number of times corresponding to the timestamp is taken as the first number; in the process of sequentially merging data in each of the log files, the first time in the file name of the second log file appears Number of times later than the time corresponding to the time stamp of the last line of data in the data merge file, as the second number; when the first time in the file name of the second log file appears, the data merge is not later than the data When the time corresponding to the time stamp of the last line of data in the file is recorded, the current number of data lines in the second log file is recorded as the first data line number, and the current number of data lines in the data merge file is recorded as Number of second data rows; by formula:
Figure PCTCN2018105540-appb-000006
Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1 i represents the i-th occurrence of the The first time in the file name of the second log file is later than the number of the first data lines when the time corresponding to the time stamp of the last line of data in the data merge file, the linum2 i represents the i-th occurrence The first time in the file name of the second log file is not later than the number of the second data lines when the time corresponding to the time stamp of the last line of data in the data merge file.
可选地,所述计算所述差值平均值,包括:Optionally, the calculating the average of the difference includes:
通过公式:
Figure PCTCN2018105540-appb-000007
计算所述差值平均值,所述logsize i表示依据排序从上至下第i个日志文件的数据量,lognum为所述日志文件的总量,logmean为所述差值平均值。
By formula:
Figure PCTCN2018105540-appb-000007
Calculate the average of the difference, the logsize i represents the data amount of the i-th log file from top to bottom according to the order, lognum is the total amount of the log file, and logmean is the average of the difference.
图5是本申请一实施例提供的电子设备的示意图。如图5所示,该实施例的电子设备5包括:处理器50、存储器51以及存储在所述存储器51中并可在所述处理器50上运行的计算机可读指令52,例如日志的归并程序。所述处理器50执行所述计算机可读指令52时实现上述各个日志的归并方法实施例中的步骤,例如图1所示的步骤101至106。或者,所述处理器50执行所述计算机可读指令52时实现上述各装置实施例中各模块/单元的功能,例如 图4所示单元401至406的功能。FIG. 5 is a schematic diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 5, the electronic device 5 of this embodiment includes: a processor 50, a memory 51, and computer-readable instructions 52 stored in the memory 51 and executable on the processor 50, such as a merge of logs. program. When the processor 50 executes the computer-readable instructions 52, the steps in the embodiment of the method for merging the above logs are implemented, for example, steps 101 to 106 shown in FIG. Alternatively, when the processor 50 executes the computer-readable instructions 52, the functions of the modules / units in the foregoing device embodiments are implemented, for example, the functions of the units 401 to 406 shown in FIG. 4.
示例性的,所述计算机可读指令52可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器51中,并由所述处理器50执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令指令段,该指令段用于描述所述计算机可读指令52在所述电子设备5中的执行过程。Exemplarily, the computer-readable instructions 52 may be divided into one or more modules / units, the one or more modules / units are stored in the memory 51 and executed by the processor 50, To complete this application. The one or more modules / units may be a series of computer-readable instruction instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 52 in the electronic device 5.
所述电子设备5可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述电子设备可包括,但不仅限于,处理器50、存储器51。本领域技术人员可以理解,图5仅仅是电子设备5的示例,并不构成对电子设备5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备还可以包括输入输出设备、网络接入设备、总线等。The electronic device 5 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The electronic device may include, but is not limited to, a processor 50 and a memory 51. Those skilled in the art can understand that FIG. 5 is only an example of the electronic device 5 and does not constitute a limitation on the electronic device 5. It may include more or fewer components than shown in the figure, or combine some components or different components. For example, the electronic device may further include an input / output device, a network access device, a bus, and the like.
所称处理器50可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
所述存储器51可以是所述电子设备5的内部存储单元,例如电子设备5的硬盘或内存。所述存储器51也可以是所述电子设备5的外部存储设备,例如所述电子设备5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述电子设备5的内部存储单元也包括外部存储设备。所述存储器51用于存储所述计算机可读指令以及所述电子设备所需的其他程序和数据。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。The memory 51 may be an internal storage unit of the electronic device 5, such as a hard disk or a memory of the electronic device 5. The memory 51 may also be an external storage device of the electronic device 5, such as a plug-in hard disk, a Smart Media Card (SMC), and a Secure Digital (SD) provided on the electronic device 5. Card, flash card, etc. Further, the memory 51 may further include both an internal storage unit of the electronic device 5 and an external storage device. The memory 51 is configured to store the computer-readable instructions and other programs and data required by the electronic device. The memory 51 may also be used to temporarily store data that has been output or is to be output.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For a part that is not detailed or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to describe the technical solution of the present application, but are not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing implementations. The technical solutions described in the examples are modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in Within the scope of this application.

Claims (20)

  1. 一种日志的归并方法,其特征在于,包括:A method for merging logs, including:
    在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;After the target container is determined, a log directory is created, and a log file generated by the target container in each host is stored in the log directory;
    根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;Modify the file name of each log file according to the generation time of the data in the log file;
    根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;Sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file;
    计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;Calculating a total time complexity, where the total time complexity is used to represent the number of unit times required to generate the data merge file;
    计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;Calculating a difference average value, where the difference average value is used to indicate a difference in data amount between each of the log files;
    将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。Adding the total time complexity and the difference average to the data merge file to generate a log merge file.
  2. 如权利要求1所述的日志的归并方法,其特征在于,所述根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名,包括:The method for merging logs according to claim 1, wherein the modifying the file name of each log file according to the generation time of the data in the log file comprises:
    将所述日志文件中的第一行数据的时间戳对应的时间作为所述日志文件的第一时间,所述时间戳用于记录数据的生成时间;Taking the time corresponding to the time stamp of the first line of data in the log file as the first time of the log file, where the time stamp is used to record the generation time of the data;
    将所述日志文件中的最后一行数据的时间戳对应的时间作为所述日志文件的第二时间;Taking the time corresponding to the time stamp of the last line of data in the log file as the second time of the log file;
    将所述第一时间和所述第二时间写入所述日志文件的文件名的末尾,以修改所述日志文件的文件名。Writing the first time and the second time to the end of the file name of the log file to modify the file name of the log file.
  3. 如权利要求2所述的日志的归并方法,其特征在于,所述根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件,包括:The method for merging logs according to claim 2, wherein each of the log files is sorted according to the file name of the log file, and the log files in each of the log files are sequentially sorted according to the sorted order. Data is merged to generate a data merge file, including:
    根据所述日志文件的文件名内的所述第一时间由小到大的顺序,对各个所述日志文件进行排序;Sorting each of the log files according to the order of the first time in the file name of the log file from small to large;
    将排序在第一位的所述日志文件标记为第一日志文件,将排序在第二位的所述日志文件标记为第二日志文件;Mark the log files sorted in the first position as the first log file, and mark the log files sorted in the second position as the second log file;
    将所述第一日志文件内的数据存入所述数据合并文件;Storing data in the first log file into the data merge file;
    判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间;Determining whether the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last line of data in the data merge file;
    若所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间,则将所述第二日志文件内的全部数据统一存入所述数据合并文件的末行数据之后;If the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last row of data in the data merge file, all the data in the second log file are stored in a unified manner After the data of the last line of the data merge file;
    若所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间,则按照所述第二日志文件中各条数据的时间戳,将所述第二日志文件中的各条数据依次插入所述数据合并文件中,以使插入后的所述数据合并文件内各行数据的时间戳对应的时间由小到大排列;If the first time in the file name of the second log file is not later than the time corresponding to the time stamp of the last row of data in the data merge file, the time of each piece of data in the second log file is Stamp, insert each piece of data in the second log file into the data merge file in order, so that the time corresponding to the time stamp of each line of data in the inserted data merge file is arranged from small to large;
    按照所述日志目录下各个日志文件排序的顺序,将当前的所述第二日志文件的下一个所述日志文件标记为新的第二日志文件,并返回执行判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间的操作,直至所述日志目录下的各个所述日志文件内的数据均存入所述数据合并文件。Mark the log file next to the current second log file as a new second log file according to the order of sorting of each log file in the log directory, and return to execute the judgment of the second log file Whether the first time in the name is later than the time corresponding to the time stamp of the last line of data in the data merge file, until the data in each of the log files in the log directory is stored in the data Merge files.
  4. 如权利要求3所述的日志的归并方法,其特征在于,所述计算所述总时间复杂度,包括:The method for merging logs according to claim 3, wherein the calculating the total time complexity comprises:
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第一数量;In the process of sequentially merging data in each of the log files, the time when the first time in the file name of the second log file appears later than the last line of data in the data merge file is counted The number of times corresponding to the time stamp, as the first number;
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第二数量;In the process of sequentially merging data in each of the log files, it appears that the first time in the file name of the second log file is no later than the last line of data in the data merge file. The number of times corresponding to the timestamp, as the second number;
    当出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时,记录当前的所述第二日志文件内数据的行数,作为第一数据行数,记录当前的所述数据合并文件内数据的行数,作为第二数据行数;When the first time in the file name of the second log file appears no later than the time corresponding to the time stamp of the last line of data in the data merge file, the current data in the second log file is recorded. Number of lines, as the number of first data lines, recording the current number of data lines in the data merge file, as the number of second data lines;
    通过公式:
    Figure PCTCN2018105540-appb-100001
    计算所述总时间复杂度,所述Ticom表示所述总时间复杂度,所述num1为所述第一数量,所述num2为所述第二数量,所述linum1 i表示第i次出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第一数据行数,所述linum2 i表示第i次出现所述所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第二数据行数。
    By formula:
    Figure PCTCN2018105540-appb-100001
    Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1 i represents the i-th occurrence of the The first time in the file name of the second log file is later than the number of the first data lines when the time corresponding to the time stamp of the last line of data in the data merge file, the linum2 i represents the i-th occurrence The first time in the file name of the second log file is not later than the number of the second data lines when the time corresponding to the time stamp of the last line of data in the data merge file.
  5. 如权利要求1所述的日志的归并方法,其特征在于,所述计算所述差值平均值,包括:The method for merging logs according to claim 1, wherein the calculating the average value of the differences comprises:
    通过公式:
    Figure PCTCN2018105540-appb-100002
    计算所述差值平均值,所述logsize i表示依据排序从上至下第i个日志文件的数据量,lognum为所述日志文件的总量,logmean为所述差值平均值。
    By formula:
    Figure PCTCN2018105540-appb-100002
    Calculate the average of the difference, the logsize i represents the data amount of the i-th log file from top to bottom according to the order, lognum is the total amount of the log file, and logmean is the average of the difference.
  6. 一种日志的归并装置,其特征在于,包括:A log merging device, comprising:
    存储模块,用于在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;A storage module, configured to create a log directory after determining a target container, and store a log file generated by the target container in each host machine under the log directory;
    修改模块,用于根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;A modification module, configured to modify a file name of each of the log files according to a generation time of data in the log files;
    合并模块,用于根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;A merging module, configured to sort each of the log files according to the file name of the log file, and sequentially combine the data in each of the log files according to the sorted order to generate a data merge file;
    第一计算模块,用于计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;A first calculation module, configured to calculate a total time complexity, where the total time complexity is used to represent a number of unit times required to generate the data merge file;
    第二计算模块,用于计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;A second calculation module, configured to calculate an average value of differences, where the average value of differences is used to indicate a difference in data amount between the log files;
    生成模块,用于将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。A generating module is configured to add the total time complexity and the average value of the differences to the data merge file to generate a log merge file.
  7. 如权利要求6所述的日志的归并装置,其特征在于,所述根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名,包括:The log merging device according to claim 6, wherein the modifying the file name of each of the log files according to the generation time of the data in the log file comprises:
    将所述日志文件中的第一行数据的时间戳对应的时间作为所述日志文件的第一时间,所述时间戳用于记录数据的生成时间;将所述日志文件中的最后一行数据的时间戳对应的时间作为所述日志文件的第二时间;将所述第一时间和所述第二时间写入所述日志文件的文件名的末尾,以修改所述日志文件的文件名。The time corresponding to the timestamp of the first line of data in the log file is taken as the first time of the log file, and the timestamp is used to record the generation time of the data; The time corresponding to the timestamp is taken as the second time of the log file; the first time and the second time are written to the end of the file name of the log file to modify the file name of the log file.
  8. 如权利要求7所述的日志的归并装置,其特征在于,所述根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件,包括:The apparatus for merging logs according to claim 7, wherein the sorting of each of the log files according to the file name of the log file, and sequentially sorting the contents of each of the log files according to the sorting order. Data is merged to generate a data merge file, including:
    根据所述日志文件的文件名内的所述第一时间由小到大的顺序,对各个所述日志文件进行排序;Sorting each of the log files according to the order of the first time in the file name of the log file from small to large;
    将排序在第一位的所述日志文件标记为第一日志文件,将排序在第二位的所述日志文件标记为第二日志文件;Mark the log files sorted in the first position as the first log file, and mark the log files sorted in the second position as the second log file;
    将所述第一日志文件内的数据存入所述数据合并文件;Storing data in the first log file into the data merge file;
    判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间;Determining whether the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last line of data in the data merge file;
    若所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间,则将所述第二日志文件内的全部数据统一存入所述数据合并文件的末行数据之后;If the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last row of data in the data merge file, all the data in the second log file are stored in a unified manner After the data of the last line of the data merge file;
    若所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间,则按照所述第二日志文件中各条数据的时间戳,将所述第二日志文件中的各条数据依次插入所述数据合并文件中,以使插入后的所述数据合并文件内各行数据的时间戳对应的时间由小到大排列;If the first time in the file name of the second log file is not later than the time corresponding to the time stamp of the last row of data in the data merge file, the time of each piece of data in the second log file is Stamp, insert each piece of data in the second log file into the data merge file in order, so that the time corresponding to the time stamp of each line of data in the inserted data merge file is arranged from small to large;
    按照所述日志目录下各个日志文件排序的顺序,将当前的所述第二日志文件的下一个所述日志文件标记为新的第二日志文件,并返回执行判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间的操作,直至所述日志目录下的各个所述日志文件内的数据均存入所述数据合并文件。Mark the log file next to the current second log file as a new second log file according to the order of sorting of each log file in the log directory, and return to execute the judgment of the second log file Whether the first time in the name is later than the time corresponding to the time stamp of the last line of data in the data merge file, until the data in each of the log files in the log directory is stored in the data Merge files.
  9. 如权利要求8所述的日志的归并装置,其特征在于,所述计算所述总时间复杂度,包括:The apparatus for merging logs according to claim 8, wherein the calculating the total time complexity comprises:
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第一数量;In the process of sequentially merging data in each of the log files, the time when the first time in the file name of the second log file appears later than the last line of data in the data merge file is counted The number of times corresponding to the time stamp, as the first number;
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第二数量;In the process of sequentially merging data in each of the log files, it appears that the first time in the file name of the second log file is no later than the last line of data in the data merge file. The number of times corresponding to the timestamp, as the second number;
    当出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时,记录当前的所述第二日志文件内数据的行数,作为第一数据行数,记录当前的所述数据合并文件内数据的行数,作为第二数据行数;When the first time in the file name of the second log file appears no later than the time corresponding to the time stamp of the last line of data in the data merge file, the current data in the second log file is recorded. Number of lines, as the number of first data lines, recording the current number of data lines in the data merge file, as the number of second data lines;
    通过公式:
    Figure PCTCN2018105540-appb-100003
    计算所述总时间复杂度,所述Ticom表示所述总时间复杂度,所述num1为所述第一数量,所述num2为所述第二数量,所述linum1 i表示第i次出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第一数据行数,所述linum2 i表示第i次出现所述所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第二数据行数。
    By formula:
    Figure PCTCN2018105540-appb-100003
    Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1 i represents the i-th occurrence of the The first time in the file name of the second log file is later than the number of the first data lines when the time corresponding to the time stamp of the last line of data in the data merge file, the linum2 i represents the i-th occurrence The first time in the file name of the second log file is not later than the number of the second data lines when the time corresponding to the time stamp of the last line of data in the data merge file.
  10. 如权利要求6所述的日志的归并装置,其特征在于,所述计算所述差值平均值,包 括:The log merging device according to claim 6, wherein the calculating the average value of the differences comprises:
    通过公式:
    Figure PCTCN2018105540-appb-100004
    计算所述差值平均值,所述logsize i表示依据排序从上至下第i个日志文件的数据量,lognum为所述日志文件的总量,logmean为所述差值平均值。
    By formula:
    Figure PCTCN2018105540-appb-100004
    Calculate the average of the difference, the logsize i represents the data amount of the i-th log file from top to bottom according to the order, lognum is the total amount of the log file, and logmean is the average of the difference.
  11. 一种日志的归并电子设备,其特征在于,所述日志的归并处理电子设备包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:An electronic device for merging logs, characterized in that the electronic device for merging logs includes a memory and a processor, and the memory stores computer-readable instructions that can be run on the processor, and the processor When the computer-readable instructions are executed, the following steps are implemented:
    在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;After the target container is determined, a log directory is created, and a log file generated by the target container in each host is stored in the log directory;
    根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;Modify the file name of each log file according to the generation time of the data in the log file;
    根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;Sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file;
    计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;Calculating a total time complexity, where the total time complexity is used to represent the number of unit times required to generate the data merge file;
    计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;Calculating a difference average value, where the difference average value is used to indicate a difference in data amount between each of the log files;
    将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。Adding the total time complexity and the difference average to the data merge file to generate a log merge file.
  12. 根据权利要求11所述的日志的归并电子设备,其特征在于,所述根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名,包括:The electronic device for merging logs according to claim 11, wherein the modifying the file name of each log file according to the generation time of the data in the log file comprises:
    将所述日志文件中的第一行数据的时间戳对应的时间作为所述日志文件的第一时间,所述时间戳用于记录数据的生成时间;Taking the time corresponding to the time stamp of the first line of data in the log file as the first time of the log file, where the time stamp is used to record the generation time of the data;
    将所述日志文件中的最后一行数据的时间戳对应的时间作为所述日志文件的第二时间;Taking the time corresponding to the time stamp of the last line of data in the log file as the second time of the log file;
    将所述第一时间和所述第二时间写入所述日志文件的文件名的末尾,以修改所述日志文件的文件名。Writing the first time and the second time to the end of the file name of the log file to modify the file name of the log file.
  13. 根据权利要求12所述的日志的归并电子设备,其特征在于,所述根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件,包括:The electronic device for merging logs according to claim 12, wherein each of the log files is sorted according to a file name of the log file, and each of the log files is sequentially sorted according to a sorted order. Data to merge to generate a data merge file, including:
    根据所述日志文件的文件名内的所述第一时间由小到大的顺序,对各个所述日志文件进行排序;Sorting each of the log files according to the order of the first time in the file name of the log file from small to large;
    将排序在第一位的所述日志文件标记为第一日志文件,将排序在第二位的所述日志文件标记为第二日志文件;Mark the log files sorted in the first position as the first log file, and mark the log files sorted in the second position as the second log file;
    将所述第一日志文件内的数据存入所述数据合并文件;Storing data in the first log file into the data merge file;
    判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间;Determining whether the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last line of data in the data merge file;
    若所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间,则将所述第二日志文件内的全部数据统一存入所述数据合并文件的末行数据之后;If the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last row of data in the data merge file, all the data in the second log file are stored in a unified manner After the data of the last line of the data merge file;
    若所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间,则按照所述第二日志文件中各条数据的时间戳,将所述第二日志文件中的各条数据依次插入所述数据合并文件中,以使插入后的所述数据合并文件内各行数据的时间戳对应的时间由小到大排列;If the first time in the file name of the second log file is not later than the time corresponding to the time stamp of the last row of data in the data merge file, the time of each piece of data in the second log file is Stamp, insert each piece of data in the second log file into the data merge file in order, so that the time corresponding to the time stamp of each line of data in the inserted data merge file is arranged from small to large;
    按照所述日志目录下各个日志文件排序的顺序,将当前的所述第二日志文件的下一个所述日志文件标记为新的第二日志文件,并返回执行判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间的操作,直至所述日志目录下的各个所述日志文件内的数据均存入所述数据合并文件。Mark the log file next to the current second log file as a new second log file according to the order of sorting of each log file in the log directory, and return to execute the judgment of the second log file Whether the first time in the name is later than the time corresponding to the time stamp of the last line of data in the data merge file, until the data in each of the log files in the log directory is stored in the data Merge files.
  14. 根据权利要求13所述的日志的归并电子设备,其特征在于,所述计算所述总时间复杂度,包括:The electronic device for merging logs according to claim 13, wherein the calculating the total time complexity comprises:
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第一数量;In the process of sequentially merging data in each of the log files, the time when the first time in the file name of the second log file appears later than the last line of data in the data merge file is counted The number of times corresponding to the time stamp, as the first number;
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第二数量;In the process of sequentially merging data in each of the log files, it appears that the first time in the file name of the second log file is no later than the last line of data in the data merge file. The number of times corresponding to the timestamp, as the second number;
    当出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时,记录当前的所述第二日志文件内数据的行数,作为第一数据行数,记录当前的所述数据合并文件内数据的行数,作为第二数据行数;When the first time in the file name of the second log file appears no later than the time corresponding to the time stamp of the last line of data in the data merge file, the current data in the second log file is recorded. Number of lines, as the number of first data lines, recording the current number of data lines in the data merge file, as the number of second data lines;
    通过公式:
    Figure PCTCN2018105540-appb-100005
    计算所述总时间复杂度,所述Ticom表示所述总时间复杂度,所述num1为所述第一数量,所述num2为所述第二数量,所述linum1 i表示第i次出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第一数据行数,所述linum2 i表示第i次出现 所述所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第二数据行数。
    By formula:
    Figure PCTCN2018105540-appb-100005
    Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1 i represents the i-th occurrence of the The first time in the file name of the second log file is later than the number of the first data lines when the time corresponding to the time stamp of the last line of data in the data merge file, the linum2 i represents the i-th occurrence The first time in the file name of the second log file is not later than the number of the second data lines when the time corresponding to the time stamp of the last line of data in the data merge file.
  15. 根据权利要求11所述的日志的归并电子设备,其特征在于,所述计算所述差值平均值,包括:The electronic device for merging logs according to claim 11, wherein the calculating the average value of the differences comprises:
    通过公式:
    Figure PCTCN2018105540-appb-100006
    计算所述差值平均值,所述logsize i表示依据排序从上至下第i个日志文件的数据量,lognum为所述日志文件的总量,logmean为所述差值平均值。
    By formula:
    Figure PCTCN2018105540-appb-100006
    Calculate the average of the difference, the logsize i represents the data amount of the i-th log file from top to bottom according to the order, lognum is the total amount of the log file, and logmean is the average of the difference.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A computer-readable storage medium storing computer-readable instructions, wherein the computer-readable instructions implement the following steps when executed by at least one processor:
    在确定目标容器后,创建日志目录,并将各个宿主机中所述目标容器生成的日志文件存储于所述日志目录下;After the target container is determined, a log directory is created, and a log file generated by the target container in each host is stored in the log directory;
    根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名;Modify the file name of each log file according to the generation time of the data in the log file;
    根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件;Sorting each of the log files according to the file name of the log file, and sequentially combining data in each of the log files according to the sorted order to generate a data merged file;
    计算总时间复杂度,所述总时间复杂度用于表示生成所述数据合并文件所需要的单位时间的个数;Calculating a total time complexity, where the total time complexity is used to represent the number of unit times required to generate the data merge file;
    计算差值平均值,所述差值平均值用于表示各个所述日志文件之间的数据量的差异情况;Calculating a difference average value, where the difference average value is used to indicate a difference in data amount between each of the log files;
    将所述总时间复杂度以及所述差值平均值添加进所述数据合并文件,生成日志归并文件。Adding the total time complexity and the difference average to the data merge file to generate a log merge file.
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述根据所述日志文件中数据的生成时间,修改各个所述日志文件的文件名,包括:The computer-readable storage medium according to claim 16, wherein the modifying the file name of each of the log files according to the generation time of the data in the log file comprises:
    将所述日志文件中的第一行数据的时间戳对应的时间作为所述日志文件的第一时间,所述时间戳用于记录数据的生成时间;Taking the time corresponding to the time stamp of the first line of data in the log file as the first time of the log file, where the time stamp is used to record the generation time of the data;
    将所述日志文件中的最后一行数据的时间戳对应的时间作为所述日志文件的第二时间;Taking the time corresponding to the time stamp of the last line of data in the log file as the second time of the log file;
    将所述第一时间和所述第二时间写入所述日志文件的文件名的末尾,以修改所述日志文件的文件名。Writing the first time and the second time to the end of the file name of the log file to modify the file name of the log file.
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述根据所述日志文件的文件名对各个所述日志文件进行排序,并根据排序的顺序,依次将各个所述日志文件内的数据进行合并,以生成数据合并文件,包括:The computer-readable storage medium according to claim 17, wherein each of the log files is sorted according to a file name of the log file, and each of the log files is sequentially sorted according to a sorted order. Data to merge to generate a data merge file, including:
    根据所述日志文件的文件名内的所述第一时间由小到大的顺序,对各个所述日志文件进行排序;Sorting each of the log files according to the order of the first time in the file name of the log file from small to large;
    将排序在第一位的所述日志文件标记为第一日志文件,将排序在第二位的所述日志文件标记为第二日志文件;Mark the log files sorted in the first position as the first log file, and mark the log files sorted in the second position as the second log file;
    将所述第一日志文件内的数据存入所述数据合并文件;Storing data in the first log file into the data merge file;
    判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间;Determining whether the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last line of data in the data merge file;
    若所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间,则将所述第二日志文件内的全部数据统一存入所述数据合并文件的末行数据之后;If the first time in the file name of the second log file is later than the time corresponding to the time stamp of the last row of data in the data merge file, all the data in the second log file are stored in a unified manner After the data of the last line of the data merge file;
    若所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间,则按照所述第二日志文件中各条数据的时间戳,将所述第二日志文件中的各条数据依次插入所述数据合并文件中,以使插入后的所述数据合并文件内各行数据的时间戳对应的时间由小到大排列;If the first time in the file name of the second log file is not later than the time corresponding to the time stamp of the last row of data in the data merge file, the time of each piece of data in the second log file is Stamp, insert each piece of data in the second log file into the data merge file in order, so that the time corresponding to the time stamp of each line of data in the inserted data merge file is arranged from small to large;
    按照所述日志目录下各个日志文件排序的顺序,将当前的所述第二日志文件的下一个所述日志文件标记为新的第二日志文件,并返回执行判断所述第二日志文件的文件名内的所述第一时间是否晚于所述数据合并文件内末行数据的时间戳对应的时间的操作,直至所述日志目录下的各个所述日志文件内的数据均存入所述数据合并文件。Mark the log file next to the current second log file as a new second log file according to the order of sorting of each log file in the log directory, and return to execute the judgment of the second log file Whether the first time in the name is later than the time corresponding to the time stamp of the last line of data in the data merge file, until the data in each of the log files in the log directory is stored in the data Merge files.
  19. 根据权利要求18所述的计算机可读存储介质,其特征在于,所述计算所述总时间复杂度,包括:The computer-readable storage medium of claim 18, wherein the calculating the total time complexity comprises:
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第一数量;In the process of sequentially merging data in each of the log files, the time when the first time in the file name of the second log file appears later than the last line of data in the data merge file is counted The number of times corresponding to the time stamp, as the first number;
    统计在所述依次将各个所述日志文件内的数据进行合并的过程中,出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间的次数,作为第二数量;In the process of sequentially merging data in each of the log files, it appears that the first time in the file name of the second log file is no later than the last line of data in the data merge file. The number of times corresponding to the timestamp, as the second number;
    当出现所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时,记录当前的所述第二日志文件内数据的行数,作为第一数据行数,记录当前的所述数据合并文件内数据的行数,作为第二数据行数;When the first time in the file name of the second log file appears no later than the time corresponding to the time stamp of the last line of data in the data merge file, the current data in the second log file is recorded. Number of lines, as the number of first data lines, recording the current number of data lines in the data merge file, as the number of second data lines;
    通过公式:
    Figure PCTCN2018105540-appb-100007
    计算所述总时间复杂度,所述Ticom表示所述总时间复杂度,所述num1为所述第一数量,所述num2为所述第二数量, 所述linum1 i表示第i次出现所述第二日志文件的文件名内的所述第一时间晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第一数据行数,所述linum2 i表示第i次出现所述所述第二日志文件的文件名内的所述第一时间不晚于所述数据合并文件内末行数据的时间戳对应的时间时的所述第二数据行数。
    By formula:
    Figure PCTCN2018105540-appb-100007
    Calculate the total time complexity, where Ticom represents the total time complexity, the num1 is the first quantity, the num2 is the second quantity, and the linum1 i represents the i-th occurrence of the The first time in the file name of the second log file is later than the number of the first data lines when the time corresponding to the time stamp of the last line of data in the data merge file, the linum2 i represents the i-th occurrence The first time in the file name of the second log file is not later than the number of the second data lines when the time corresponding to the time stamp of the last line of data in the data merge file.
  20. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述计算所述差值平均值,包括:The computer-readable storage medium of claim 16, wherein the calculating the average of the differences comprises:
    通过公式:
    Figure PCTCN2018105540-appb-100008
    计算所述差值平均值,所述logsize i表示依据排序从上至下第i个日志文件的数据量,lognum为所述日志文件的总量,logmean为所述差值平均值。
    By formula:
    Figure PCTCN2018105540-appb-100008
    Calculate the average of the difference, the logsize i represents the data amount of the i-th log file from top to bottom according to the order, lognum is the total amount of the log file, and logmean is the average of the difference.
PCT/CN2018/105540 2018-07-25 2018-09-13 Log merging method, apparatus, electronic device, and medium WO2020019436A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810824218.7 2018-07-25
CN201810824218.7A CN109165201B (en) 2018-07-25 2018-07-25 Log merging method and terminal equipment

Publications (1)

Publication Number Publication Date
WO2020019436A1 true WO2020019436A1 (en) 2020-01-30

Family

ID=64898006

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/105540 WO2020019436A1 (en) 2018-07-25 2018-09-13 Log merging method, apparatus, electronic device, and medium

Country Status (2)

Country Link
CN (1) CN109165201B (en)
WO (1) WO2020019436A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032565A (en) 2019-03-26 2019-07-19 阿里巴巴集团控股有限公司 A kind of method, system and electronic equipment generating statistical information
CN113010607A (en) * 2021-04-06 2021-06-22 工银科技有限公司 Method, device, computer system and storage medium for data synchronization between systems
CN114584346B (en) * 2022-01-28 2024-01-12 深圳融安网络科技有限公司 Log stream processing method, system, terminal equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101605028A (en) * 2009-02-17 2009-12-16 北京安天电子设备有限公司 A kind of combining log records method and system
US20100083046A1 (en) * 2008-09-30 2010-04-01 Fujitsu Limited Log management method and apparatus, information processing apparatus with log management apparatus and storage medium
CN107526674A (en) * 2017-08-31 2017-12-29 郑州云海信息技术有限公司 A kind of method and apparatus of embedded system log recording
CN107959587A (en) * 2017-11-23 2018-04-24 上海斐讯数据通信技术有限公司 Handling result daily record based on mass file merges device and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10311024B2 (en) * 2016-08-31 2019-06-04 Ca, Inc. Merging file storage directory structures through user interface visualization of refactoring decisions

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100083046A1 (en) * 2008-09-30 2010-04-01 Fujitsu Limited Log management method and apparatus, information processing apparatus with log management apparatus and storage medium
CN101605028A (en) * 2009-02-17 2009-12-16 北京安天电子设备有限公司 A kind of combining log records method and system
CN107526674A (en) * 2017-08-31 2017-12-29 郑州云海信息技术有限公司 A kind of method and apparatus of embedded system log recording
CN107959587A (en) * 2017-11-23 2018-04-24 上海斐讯数据通信技术有限公司 Handling result daily record based on mass file merges device and method

Also Published As

Publication number Publication date
CN109165201B (en) 2023-04-14
CN109165201A (en) 2019-01-08

Similar Documents

Publication Publication Date Title
US11544623B2 (en) Consistent filtering of machine learning data
US20170212781A1 (en) Parallel execution of blockchain transactions
Liu et al. HSim: a MapReduce simulator in enabling cloud computing
US11100420B2 (en) Input processing for machine learning
WO2020019436A1 (en) Log merging method, apparatus, electronic device, and medium
US11182691B1 (en) Category-based sampling of machine learning data
CN109471890A (en) Generation method, terminal device and the medium of report file
US9996394B2 (en) Scheduling accelerator tasks on accelerators using graphs
WO2022156574A1 (en) Blockchain-based method and apparatus for data processing, device, and readable storage medium
CN109145051A (en) The data summarization method and device and electronic equipment of distributed data base
US10885085B2 (en) System to organize search and display unstructured data
CN109815234A (en) A kind of multiple cuckoo filter under streaming computing model
WO2021057482A1 (en) Method and device for generating bloom filter in blockchain
CN110502583A (en) Distributed Data Synchronization method, apparatus, equipment and readable storage medium storing program for executing
Bala et al. Big-ETL: extracting-transforming-loading approach for Big Data
CN109542657A (en) The processing method and server of system exception
WO2024032781A1 (en) Algorithm testing method and apparatus, and storage medium
WO2023098058A1 (en) Method and apparatus for constructing read-write set of blockchain smart contract
Khan Hadoop performance modeling and job optimization for big data analytics
TWI777319B (en) Method and device for determining stem cell density, computer device and storage medium
KR101718739B1 (en) System and Method for Replicating Dynamic Data for Heterogeneous Hadoop
CN113641705A (en) Marketing disposal rule engine method based on calculation engine
CN112764935A (en) Big data processing method and device, electronic equipment and storage medium
CN112783775A (en) Special character input testing method and device
US20200272648A1 (en) Text Extraction and Processing

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18927586

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18927586

Country of ref document: EP

Kind code of ref document: A1