[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN110019045A - Method and device is landed in log - Google Patents

Method and device is landed in log Download PDF

Info

Publication number
CN110019045A
CN110019045A CN201711489249.3A CN201711489249A CN110019045A CN 110019045 A CN110019045 A CN 110019045A CN 201711489249 A CN201711489249 A CN 201711489249A CN 110019045 A CN110019045 A CN 110019045A
Authority
CN
China
Prior art keywords
log
landing
component
category
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711489249.3A
Other languages
Chinese (zh)
Other versions
CN110019045B (en
Inventor
严锁鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201711489249.3A priority Critical patent/CN110019045B/en
Publication of CN110019045A publication Critical patent/CN110019045A/en
Application granted granted Critical
Publication of CN110019045B publication Critical patent/CN110019045B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明提供了一种日志落地方法及装置,该方法包括:接收业务的日志访问请求,所述日志访问请求中携带有所需访问的日志类别以及至少一个目标落地组件;解析所述日志访问请求,根据所述日志类别确定所述业务访问的日志属于已消费日志;根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地。基于本发明提供的日志落地方法,对于将已消费日志落地至新落地组件时,只需在日志的配置文件中增加需要落地的目标落地组件的配置信息即可实现日志的落地,可以避免对同一份日志的重复消费,快速并有效为业务将日志落地到组件中,进而提升业务接入的效率。

The present invention provides a log landing method and device. The method includes: receiving a log access request of a service, the log access request carrying a log category to be accessed and at least one target landing component; parsing the log access request , according to the log category, it is determined that the log of the business access belongs to the consumed log; according to the type of the target landing component, the configuration information of the target landing component is added to the configuration file of the log, and the log is written In the target landing component, log landing is completed. Based on the log landing method provided by the present invention, when the consumed logs are landed on a new landing component, the log landing can be realized only by adding the configuration information of the target landing component that needs to be landed in the configuration file of the log. It can quickly and effectively implement the log into the components for the business, thereby improving the efficiency of business access.

Description

日志落地方法及装置Log landing method and device

技术领域technical field

本发明涉及计算机技术领域,特别是涉及一种日志落地方法及装置。The present invention relates to the field of computer technology, and in particular, to a log landing method and device.

背景技术Background technique

随着计算机技术的不断发展,各种数据的存储量及计算量也越来越大。面对日益庞大的数据量,当业务需要进行数据访问时,如何有效且快速的为各业务写入其所需要日志数据则为亟待解决的问题。With the continuous development of computer technology, the amount of storage and calculation of various data is also increasing. Facing the increasingly huge amount of data, when the business needs data access, how to effectively and quickly write the required log data for each business is an urgent problem to be solved.

传统技术中,数据库集群接收到数据访问请求时,需要将数据日志落地到各自的目标系统中,如果不同的目标系统对日志的需求的相同的话,数据库集群则需要对每个目标系统都要实现相关的代码,并且会重复开发,对日志进行重复消费。采用上述方式不仅会造成浪费资源,还会降低数据访问效率,减缓系统的运行速度。In the traditional technology, when a database cluster receives a data access request, it needs to land the data log in its respective target system. If different target systems have the same log requirements, the database cluster needs to implement the log for each target system. Relevant code, and will be developed repeatedly, and the logs will be repeatedly consumed. Using the above method will not only waste resources, but also reduce data access efficiency and slow down the running speed of the system.

发明内容SUMMARY OF THE INVENTION

本发明提供了一种日志落地方法及装置以克服上述问题或者至少部分地解决上述问题。The present invention provides a log landing method and device to overcome the above problems or at least partially solve the above problems.

根据本发明的一个方面,提供了一种日志落地方法,包括:According to an aspect of the present invention, a log landing method is provided, comprising:

接收业务的日志访问请求,所述日志访问请求中携带有所需访问的日志类别以及至少一个目标落地组件;Receive a log access request from the business, where the log access request carries the log category to be accessed and at least one target landing component;

解析所述日志访问请求,根据所述日志类别确定所述业务访问的日志属于已消费日志;Parse the log access request, and determine, according to the log category, that the service access log belongs to a consumed log;

根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地。The configuration information of the target landing component is added to the configuration file of the log according to the type of the target landing component, and the log is written into the target landing component to complete the log landing.

可选地,所述解析所述日志访问请求,根据所述日志类别确定所述业务访问的日志属于已消费日志,包括:Optionally, the parsing the log access request, and determining that the service access log belongs to the consumed log according to the log category, including:

解析所述日志访问请求,获取所述日志访问请求中携带的日志类别,判断该日志类别是否存在于预设日类别列表中;Parse the log access request, obtain the log category carried in the log access request, and determine whether the log category exists in the preset day category list;

若是,则确定所述业务访问的日志属于已消费日志。If so, it is determined that the log of the service access belongs to the consumed log.

可选地,所述解析所述日志访问请求,获取所述日志类别,判断该日志类别是否存在于预设日类别列表中之后,还包括:Optionally, after parsing the log access request, obtaining the log category, and judging whether the log category exists in the preset daily category list, the method further includes:

若否,则确定所述业务访问的日志属于未消费日志;If not, it is determined that the log of the service access belongs to the unconsumed log;

将所述日志类别添加至所述预设日志类别列表中,并从指定集群中消费日志。Add the log category to the preset log category list, and consume logs from the specified cluster.

可选地,所述将所述日志类别添加至所述预设日志类别列表中,并从指定集群中消费日志,包括:Optionally, adding the log category to the preset log category list and consuming logs from a specified cluster includes:

在所述预设日志类别列表中添加所述日志类别相应的字段信息;adding field information corresponding to the log category in the preset log category list;

从指定集群中收集与所述日志类别对应的日志信息。Collect log information corresponding to the log category from the specified cluster.

可选地,所述根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地,包括:Optionally, adding the configuration information of the target landing component to the configuration file of the log according to the type of the target landing component, writing the log into the target landing component, and completing the log landing, including: :

在所述日志的配置文件中指定的落地组件命令中添加所述目标落地组件的字段信息;adding the field information of the target landing component to the landing component command specified in the configuration file of the log;

根据所述目标落地组件的类型确定该目标落地组件实现日志落地所需的基本配置信息;Determine the basic configuration information required by the target landing component to implement log landing according to the type of the target landing component;

在所述配置文件中添加所述目标落地组件的基本配置信息,以提供所述目标落地组件的访问接口,将所述日志写入所述目标落地组件中,完成日志落地。The basic configuration information of the target landing component is added to the configuration file to provide an access interface of the target landing component, and the log is written into the target landing component to complete the log landing.

可选地,所述根据所述目标落地组件的类型在所述配置文件中添加所述目标落地组件的配置信息之后,还包括:Optionally, after adding the configuration information of the target landing component in the configuration file according to the type of the target landing component, the method further includes:

重启与所述日志类别对应的应用。Restart the application corresponding to the log category.

可选地,所述日志访问请求中还携带有将所述日志写入所述目标落地组件的落地路径;Optionally, the log access request also carries a landing path for writing the log into the target landing component;

所述根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地之后,还包括:The adding the configuration information of the target landing component in the configuration file of the log according to the type of the target landing component, writing the log into the target landing component, and after completing the log landing, further includes:

向所述业务返回日志落地成功的消息,由所述业务基于所述落地路径读取所述日志。A message of successful log landing is returned to the service, and the service reads the log based on the landing path.

可选地,所述方法应用于Kafka系统。Optionally, the method is applied to a Kafka system.

根据本发明的另一个方面,还提供了一种日志落地装置,包括:According to another aspect of the present invention, there is also provided a log landing device, comprising:

请求接收模块,配置为接收业务的日志访问请求,所述日志访问请求中携带有所需访问的日志类别以及至少一个目标落地组件;a request receiving module, configured to receive a service log access request, where the log access request carries the log category to be accessed and at least one target landing component;

解析模块,配置为解析所述日志访问请求,根据所述日志类别确定所述业务访问的日志属于已消费日志;A parsing module, configured to parse the log access request, and determine according to the log category that the business access log belongs to a consumed log;

落地模块,配置为根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地。The landing module is configured to add configuration information of the target landing component in the configuration file of the log according to the type of the target landing component, write the log into the target landing component, and complete the log landing.

可选地,所述解析模块包括:Optionally, the parsing module includes:

判断单元,配置为解析所述日志访问请求,获取所述日志访问请求中携带的日志类别,判断该日志类别是否存在于预设日类别列表中;a judging unit, configured to parse the log access request, obtain the log category carried in the log access request, and determine whether the log category exists in the preset day category list;

第一确定单元,配置为当该日志类别存在于预设日类别列表中时,确定所述业务访问的日志属于已消费日志。The first determining unit is configured to determine that the log of the service access belongs to the consumed log when the log category exists in the preset day category list.

可选地,所述解析模块还包括:Optionally, the parsing module further includes:

第二确定单元,配置为配置为当该日志类别不存在于预设日类别列表中时,则确定所述业务访问的日志属于未消费日志;将所述日志类别添加至所述预设日志类别列表中,并从指定集群中消费日志。The second determination unit is configured to be configured to, when the log category does not exist in the preset daily category list, determine that the log of the service access belongs to an unconsumed log; and add the log category to the preset log category list and consume logs from the specified cluster.

可选地,所述第二确定单元还配置为:Optionally, the second determining unit is further configured to:

在所述预设日志类别列表中添加所述日志类别相应的字段信息;从指定集群中收集与所述日志类别对应的日志信息。Field information corresponding to the log category is added to the preset log category list; log information corresponding to the log category is collected from a specified cluster.

可选地,所述落地模块还配置为:Optionally, the landing module is further configured as:

在所述日志的配置文件中指定的落地组件命令中添加所述目标落地组件的字段信息;adding the field information of the target landing component to the landing component command specified in the configuration file of the log;

根据所述目标落地组件的类型确定该目标落地组件实现日志落地所需的基本配置信息;Determine the basic configuration information required by the target landing component to implement log landing according to the type of the target landing component;

在所述配置文件中添加所述目标落地组件的基本配置信息,以提供所述目标落地组件的访问接口,将所述日志写入所述目标落地组件中,完成日志落地。The basic configuration information of the target landing component is added to the configuration file to provide an access interface of the target landing component, and the log is written into the target landing component to complete the log landing.

可选地,上述装置还包括:重启模块,配置为重启与所述日志类别对应的应用。Optionally, the above apparatus further includes: a restart module configured to restart the application corresponding to the log category.

可选地,所述日志访问请求中还携带有将所述日志写入所述目标落地组件的落地路径;Optionally, the log access request also carries a landing path for writing the log into the target landing component;

所述装置还包括:信息发送模块,配置为向所述业务返回日志落地成功的消息,由所述业务基于所述落地路径读取所述日志。The device further includes: an information sending module configured to return a log landing success message to the service, and the service reads the log based on the landing path.

根据本发明的另一个方面,还提供了一种电子设备,包括:According to another aspect of the present invention, an electronic device is also provided, comprising:

处理器;以及processor; and

被安排成存储计算机可执行指令的存储器,所述可执行指令在被执行时使所述处理器执行根据上述任一项所述的日志落地方法。A memory arranged to store computer executable instructions which, when executed, cause the processor to perform a log landing method according to any of the above.

根据本发明的另一个方面,还提供了一种计算机可读存储介质,其中,所述计算机可读存储介质存储一个或多个程序,所述一个或多个程序当被包括多个应用程序的电子设备执行时,使得所述电子设备执行根据上述任一项所述的日志落地方法。According to another aspect of the present invention, there is also provided a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, when the one or more programs are included as a plurality of application programs When the electronic device executes, the electronic device is caused to execute the log landing method according to any one of the above.

本发明提供了一种更加高效的日志落地方法及装置,本发明提供的日志落地方法中,在接收到业务的日志访问请求后,通过解析该日志访问请求获取业务所需访问的日志类别以及日志的目标落地组件,当确定与该日志类别所对应的日志属于已消费日志时,可以直接在该日志的配置文件中增加目标落地组件的配置信息,以将日志写入目标落地组件中进而完成日志落地。基于本发明提供的日志落地方法,对于将已消费日志落地至新落地组件时,只需在日志的配置文件中增加需要落地的目标落地组件的配置信息即可实现日志的落地,可以避免对同一份日志的重复消费,快速并有效为业务将日志落地到组件中,进而提升业务接入的效率。The present invention provides a more efficient log landing method and device. In the log landing method provided by the present invention, after receiving the log access request of the business, the log category and the log required to be accessed by the business are obtained by parsing the log access request. When it is determined that the log corresponding to the log category belongs to the consumed log, you can directly add the configuration information of the target landing component to the configuration file of the log to write the log into the target landing component to complete the log. landing. Based on the log landing method provided by the present invention, when landing the consumed log to a new landing component, the log landing can be realized by adding the configuration information of the target landing component that needs to be landing in the log configuration file, which can avoid the need for the same It can quickly and effectively implement the log into the components for the business, thereby improving the efficiency of business access.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, in order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.

根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明的上述以及其他目的、优点和特征。The above and other objects, advantages and features of the present invention will be more apparent to those skilled in the art from the following detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are for the purpose of illustrating preferred embodiments only and are not to be considered limiting of the invention. Also, the same components are denoted by the same reference numerals throughout the drawings. In the attached image:

图1是根据本发明实施例的日志落地方法流程示意图;1 is a schematic flowchart of a log landing method according to an embodiment of the present invention;

图2是根据本发明实施例的Hamal统一落地框架结构示意图;2 is a schematic structural diagram of a Hamal unified landing frame according to an embodiment of the present invention;

图3是根据本发明实施例的基于Hamal统一落地框架的数据流示意图;3 is a schematic diagram of a data flow based on the Hamal unified landing framework according to an embodiment of the present invention;

图4是根据本发明实施例的日志落地装置结构示意图;4 is a schematic structural diagram of a log landing device according to an embodiment of the present invention;

图5是根据本发明优选实施例的日志落地装置结构示意图;5 is a schematic structural diagram of a log landing device according to a preferred embodiment of the present invention;

图6是根据本发明实施例的用于执行根据本发明的日志落地方法的计算设备的框图示意图;以及6 is a schematic block diagram of a computing device for executing the log landing method according to the present invention according to an embodiment of the present invention; and

图7是根据本发明实施例的用于保持或者携带实现根据本发明的日志落地方法的程序代码的存储单元示意图。7 is a schematic diagram of a storage unit for holding or carrying a program code for implementing the log landing method according to the present invention according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.

图1是根据本发明实施例的日志落地方法流程示意图,如图1所示,根据本发明实施例的日志落地方法包括:FIG. 1 is a schematic flowchart of a log landing method according to an embodiment of the present invention. As shown in FIG. 1 , the log landing method according to an embodiment of the present invention includes:

步骤S102,接收业务的日志访问请求,日志访问请求中携带有所需访问的日志类别以及至少一个目标落地组件;Step S102, receiving the log access request of the business, and the log access request carries the log category to be accessed and at least one target landing component;

步骤S104,解析上述日志访问请求,根据日志类别确定业务访问的日志属于已消费日志;Step S104, parse the above log access request, and determine according to the log category that the log of business access belongs to the consumed log;

步骤S106,根据目标落地组件的类型在日志的配置文件中添加目标落地组件的配置信息,将日志写入所述目标落地组件中,完成日志落地。Step S106, according to the type of the target landing component, add the configuration information of the target landing component to the configuration file of the log, write the log into the target landing component, and complete the log landing.

本发明实施例提供了一种更加高效的日志落地方法,接收到业务的日志访问请求后,通过解析该日志访问请求获取业务所需访问的日志类别以及日志的目标落地组件,当确定与该日志类别所对应的日志属于已消费日志时,可以直接在该日志的配置文件中增加目标落地组件的配置信息,以将日志写入目标落地组件中进而完成日志落地。基于本发明实施例提供的日志落地方法,对于将已消费日志落地至新落地组件时,只需在日志的配置文件中增加需要落地的目标落地组件的配置信息即可实现日志的落地,可以避免对同一份日志的重复消费,快速并有效为业务将日志落地到组件中,进而提升业务接入的效率。The embodiment of the present invention provides a more efficient log landing method. After receiving a log access request from a business, the log type required to be accessed by the business and the target landing component of the log are obtained by parsing the log access request. When the log corresponding to the category belongs to the consumed log, you can directly add the configuration information of the target landing component to the configuration file of the log to write the log into the target landing component to complete the log landing. Based on the log landing method provided by the embodiment of the present invention, when the consumed log is landed on a new landing component, it is only necessary to add the configuration information of the target landing component that needs to be landed in the log configuration file to realize the landing of the log, which can be avoided. The repeated consumption of the same log can quickly and effectively implement the log into the component for the business, thereby improving the efficiency of business access.

消费日志,即从数据存储系统中拉取数据。本发明实施例优选应用于Kafka系统。Kafka是一种分布式基于发布/订阅的消息系统。在本发明实施例中,Kafka其实是一个桥梁一样的存储,各数据库中的数据都会进入到Kafka,而Kafka只是通过读到这些数据为各个业务提供服务。各个业务需要读取数据时,会到Kafka中拉取数据。比如说不同的业务需要将同一份日志分别落到HDFS(Hadoop分布式文件系统)、Redis、HBase等多个落地组件中时,对于同一份日志可能会消费很多遍,造成很多重复消费,进而浪费资源。Consume logs, that is, pull data from the data storage system. The embodiments of the present invention are preferably applied to the Kafka system. Kafka is a distributed publish/subscribe based messaging system. In the embodiment of the present invention, Kafka is actually a bridge-like storage, the data in each database will enter Kafka, and Kafka only provides services for each business by reading these data. When each business needs to read data, it will pull data from Kafka. For example, when different businesses need to drop the same log into multiple landing components such as HDFS (Hadoop Distributed File System), Redis, HBase, etc., the same log may be consumed many times, resulting in a lot of repeated consumption and waste. resource.

在本发明实施例提供的日志落地方法中,当接收到业务需要消费某个日志的请求时,会将该业务所需要的日志落地到新的落地组件中。这时,可以先判断该日志是否已经被消费过,如果是的话,则可直接在日志的配置文件中增加该新的落地组件的配置信息。以一份日志举例来说,原来业务只有落HDFS的需求,现在业务想在Redis也落地一份相同的日志,则只需要在该日志的在配置文件中加入Redis相关的配置就可以实现。In the log landing method provided by the embodiment of the present invention, when a request that a business needs to consume a certain log is received, the log required by the business will be dropped into a new landing component. At this time, you can first determine whether the log has been consumed, and if so, you can directly add the configuration information of the new landing component to the configuration file of the log. Taking a log as an example, the original business only needs HDFS. Now, if the business wants to have the same log in Redis, it only needs to add Redis-related configuration to the configuration file of the log.

可选地,上述步骤S104可进一步通过以下方式确定日志属于已消费日志时:解析日志访问请求,获取日志访问请求中携带的日志类别,判断该日志类别是否存在于预设日类别列表中;若是,则确定该业务访问的日志属于已消费日志。若否,则确定业务访问的日志属于未消费日志;将该日志类别添加至预设日志类别列表中,并从指定集群中消费日志。Optionally, the above step S104 may further determine that the log belongs to the consumed log in the following manner: parsing the log access request, obtaining the log category carried in the log access request, and judging whether the log category exists in the preset day category list; , then it is determined that the logs accessed by the service belong to the consumed logs. If not, it is determined that the logs accessed by the business belong to unconsumed logs; the log category is added to the preset log category list, and logs are consumed from the specified cluster.

对于Kafka集群来说,每条发布到Kafka集群的消息都有一个类别,这个类别被称为topic,每条消费都必须指定它的topic。在本发明实施例中,当接收到业务的数据访问请求时,该请求可以指定从Kafka中消费的topic。集群中可以预存有topics或topic list(类别列表),在接收一个新业务的请求之后,对其进行解析,获取该请求中需要消费的topic,并判断该topic是否存在于预设的topic list中,如果存在的话,可直接确定该topic已消费。如果该topic不在预设topic list中,则将该topic添加到预设的topic list中。For the Kafka cluster, each message published to the Kafka cluster has a category, which is called topic, and each consumer must specify its topic. In this embodiment of the present invention, when a service data access request is received, the request may specify a topic consumed from Kafka. Topics or topic lists (category lists) can be pre-stored in the cluster. After receiving a request for a new service, it parses it, obtains the topic that needs to be consumed in the request, and determines whether the topic exists in the preset topic list. , if it exists, it can be directly determined that the topic has been consumed. If the topic is not in the preset topic list, add the topic to the preset topic list.

优选地,在将日志类别添加至预设日志类别列表中,并从指定集群中消费日志可以包括:在预设日志类别列表中添加日志类别相应的字段信息;从指定集群中收集与日志类别对应的日志信息。举例来说,可以在已有的topic列表中添加请求中所携带的该topic字段。再根据解析该topic的协议进行消费,即实现日志的收集。也就是说,topic list中topic字段可根据业务的需求进行任意增减。Preferably, adding the log category to the preset log category list and consuming logs from the specified cluster may include: adding field information corresponding to the log category in the preset log category list; collecting the log category corresponding to the log category from the specified cluster log information. For example, the topic field carried in the request can be added to the existing topic list. Then consume according to the protocol of parsing the topic, that is, realize the collection of logs. That is to say, the topic field in the topic list can be arbitrarily increased or decreased according to the needs of the business.

在上述步骤S106提及,可以根据目标落地组件的类型在日志的配置文件中添加目标落地组件的配置信息,将日志写入至目标落地组件中,完成日志落地。其中,在日志的配置文件中添加落地组件的配置信息,实际上就是接口的实现。本发明实施例中对于已消费日志的访问接口可以是一个可负载的接口。由于会包括例如Redis、HBase、HDFS等多个落地组件,当业务需要将日志落地到其中的一个或多个组件时,例如Redis,只需要实现一个Redis的接口就能够满足业务的需求。而在本实施例中,在日志的配置文件中添加Redis的相关配置信息,即该日志实现了可供Redis访问接口的实现,就相当于就是业务需要的那份日志就会写入到Redis进去,进而完成日志的落地。As mentioned in the above step S106, the configuration information of the target landing component can be added to the configuration file of the log according to the type of the target landing component, and the log is written into the target landing component to complete the log landing. Among them, adding the configuration information of the landing component to the configuration file of the log is actually the implementation of the interface. In this embodiment of the present invention, the access interface for the consumed logs may be a loadable interface. Since it will include multiple landing components such as Redis, HBase, HDFS, etc., when the business needs to land logs on one or more of these components, such as Redis, it only needs to implement a Redis interface to meet the business needs. In this embodiment, the relevant configuration information of Redis is added to the configuration file of the log, that is, the log implements the implementation of the interface available for Redis access, which is equivalent to the log required by the business will be written to Redis. , and then complete the landing of the log.

实际应用中,每个落地组件的配置信息是不一样的。比如业务需要将日志落地至HDFS,需要添加的配置信息可以包括:落地的根目录、压缩方式还有落地的格式。也就是说,每个落地组件都会有自己的配置信息,然后需要进行日志落地时,只要提供相关的这些信息即可实现。In practical applications, the configuration information of each landing component is different. For example, if the business needs to land logs to HDFS, the configuration information that needs to be added can include: the root directory of the landing, the compression method and the landing format. That is to say, each landing component will have its own configuration information, and then when the log landing needs to be performed, it can be achieved by providing the relevant information.

另外,如果业务所提交的访问请求中同时申请将日志落地至HDFS,Redis两个组件,会将日志双写到这两个组件中,并且将日志写入不同的落地组件时,可以根据落地组件各自的数据存储格式对日志的格式进行转换,以符合各落地组件的数据格式要求,快速并高效为业务提供接入服务。In addition, if the access request submitted by the business applies for the landing of logs to HDFS and Redis at the same time, the logs will be double-written to these two components, and when the logs are written to different landing components, you can use the landing components according to the landing components. The respective data storage formats convert the log format to meet the data format requirements of each landing component, and provide access services for businesses quickly and efficiently.

可选地,在日志的配置文件中添加落地组件的配置信息之后,可以重启与该日志类别对应的应用,即Application。Application就是相当于是业务级别的,每个日志其实是属于一个业务的,当业务要增加落地组件的话,其实就是只要重启日志对应的Application,以使新增的配置信息生效。Optionally, after adding the configuration information of the landing component to the configuration file of the log, the application corresponding to the log category, that is, the Application, can be restarted. Application is equivalent to a business level. Each log actually belongs to a business. When a business needs to add landing components, it is only necessary to restart the Application corresponding to the log to make the new configuration information take effect.

进一步地,日志访问请求中还携带有将日志写入目标落地组件的落地路径,将日志的配置文件修改好之后,可以向业务返回日志落地成功的消息,由业务基于该落地路径读取日志。其中,向业务返回的日志落地成功的消息,可以是给业务发邮件,也可以是其他形式的消息,表示根据业务的请求将指定日志落地到指定的落地组件中,本发明不做限定。Further, the log access request also carries the landing path for writing the log into the target landing component. After the configuration file of the log is modified, a message that the log landing is successful can be returned to the business, and the business can read the log based on the landing path. The message of successful log landing returned to the business may be an email sent to the business or other forms of messages, indicating that the specified log will be placed in the specified landing component according to the request of the business, which is not limited in the present invention.

上文提及,会将业务请求的日志写入各落地组件以实现日志的落地。优选地,本实施例中的各落地组件可由Flink实现并管理。除上述各落地组件之外,Flink还可以实现多种source、sink组件,sink组件就是上文提及的目标落地组件,比如HDFS、Redis、HBase、Hive、ELK等等。As mentioned above, the log of the business request will be written to each landing component to realize the landing of the log. Preferably, each landing component in this embodiment can be implemented and managed by Flink. In addition to the above landing components, Flink can also implement a variety of source and sink components. The sink component is the target landing component mentioned above, such as HDFS, Redis, HBase, Hive, ELK, and so on.

基于上述实施例提供的日志落地方法,本发明实施例可提供一种由Kafka以及Flink共同实现的落地架构Hamal,基于该框架做数据的统一的监控以及管理。如图2所示,本发明实施例提供的基于Kafka和Flink的统一落地架构Hamal。该框架由Kafka处理数据流,通过Kafka offset保存消费者消费的进度。Based on the log landing method provided by the above embodiments, the embodiments of the present invention can provide a landing architecture Hamal jointly implemented by Kafka and Flink, and based on the framework, data can be monitored and managed uniformly. As shown in FIG. 2 , the unified landing architecture Hamal based on Kafka and Flink provided by the embodiment of the present invention. The framework processes the data stream by Kafka, and saves the progress of consumer consumption through Kafka offset.

offset就是有记录说从哪个点开始获取日志信息,虽然是从Kafka去取的,但是未必是实时去取的,也有可能通过offset定位到两天前或几天前的数据,在所定位到的两天前或几天前的日志之后,根据业务的需要落地至sink组件。当所定位到的时间段的日志已经落地,则后面的数据就可以实时落地。Offset is a record from which point to obtain log information. Although it is obtained from Kafka, it may not be obtained in real time. It is also possible to locate the data two days ago or a few days ago through offset. After the log two days ago or a few days ago, it will be landed on the sink component according to the needs of the business. When the log of the located time period has landed, the subsequent data can be landed in real time.

在本实施例提供的统一落地架构中,offset主要包括CheckPointer(检查点)以及burrow(Lag Monitor)两个线程。In the unified landing architecture provided by this embodiment, the offset mainly includes two threads: CheckPointer (checkpoint) and burrow (Lag Monitor).

CheckPointer作用,一旦用户改变数据,缓冲区就变脏了。用户的commit并不意味着改动已经写入数据文件,即WAL日志(write-ahead log,预写式日志)文件,而是需要检查点进程来完成这项工作。当发生一个检查点操作,所有脏的page都会被写入表和索引文件中;此时一个特殊的检查点记录被写入WAL日志文件。当发生崩溃时,崩溃恢复程序查看最新的检查点记录,通过WAL日志文件中的特殊检查点记录来决定从哪里开始REDO(重做日志我文件)操作。因此,执行完一个检查点之后,我们就不再需要这个点之前的日志区段了。CheckPointer function, once the user changes the data, the buffer becomes dirty. The user's commit does not mean that the changes have been written to the data file, that is, the WAL log (write-ahead log, write-ahead log) file, but the checkpoint process is required to complete this work. When a checkpoint operation occurs, all dirty pages are written to the table and index files; at this time a special checkpoint record is written to the WAL log file. When a crash occurs, the crash recovery program looks at the latest checkpoint record and decides where to start the REDO (redo log file) operation through a special checkpoint record in the WAL log file. Therefore, after a checkpoint is performed, we no longer need log segments prior to that point.

Burrow是监控Kafka消费者健康情况这一棘手问题的恰当方式,它为用户提供了消费者状态的综合概览,并提供了无需指定阈值的消费者延迟验证服务。Burrow会按照topic分区来监控所有消费者所提交数据的偏差值,并根据需求计算相应消费者的状态。Burrow is an appropriate way to monitor the thorny problem of Kafka consumer health, providing users with a comprehensive overview of the consumer's state and providing a service for lazily verifying consumers without specifying thresholds. Burrow will monitor the deviation value of the data submitted by all consumers according to the topic partition, and calculate the status of the corresponding consumers according to the demand.

本发明实施例提供的Hamal统一落地框架中,Kafka可以与Hamal Framework(Hamal架构)、Flink on Yarn Runtime(Flink on Yarn运行时)进行结合,并基于Flink实现的多个sink组件,sink组件可以包括:HDFS(BucketingSink)、HBase(HBase Sink)、Graylog(Graylog Sink)、Redis、cassandra等等。把上述各组件实现当做插件一样,实现一遍就可以给业务任意搭配使用了,将各落地组件进行统一开发管理,当接收到业务的日志访问请求时,在该请求中携带所访问日志的日志类型以及该日志的落地组件,然后进行相关的配置即可。基于上述框架的数据流可以如图3所示。In the Hamal unified landing framework provided by the embodiment of the present invention, Kafka can be combined with the Hamal Framework (Hamal architecture) and Flink on Yarn Runtime (Flink on Yarn runtime), and based on multiple sink components implemented by Flink, the sink components may include : HDFS (Bucketing Sink), HBase (HBase Sink), Graylog (Graylog Sink), Redis, cassandra, etc. The implementation of the above components is like a plug-in. Once implemented, it can be used in any combination for the business. Unified development and management of each landing component is carried out. When a log access request from a business is received, the log type of the accessed log is carried in the request. And the landing component of the log, and then configure it. The data flow based on the above framework can be shown in Figure 3.

Kafka Consumer,消息消费者,向Kafka broker读取消息的客户端,consumer从broker拉取(pull)日志数据后,进行反序列化处理,将处理后的数据根据组件类型的不同进行格式转换后,写入各组件,完成日志落地。Kafka Consumer, a message consumer, is a client that reads messages from a Kafka broker. After the consumer pulls log data from the broker, it performs deserialization processing. The processed data is formatted according to the component type. Write each component to complete the log landing.

下面通过一个优选实施例对上述实施例进行详细说明。The above embodiment will be described in detail below through a preferred embodiment.

1、接收来自业务的日志访问请求,该请求中携带有将特定日志落地至hdfs、kafka以及相应的落地路径;1. Receive a log access request from the business, and the request carries the landing of a specific log to hdfs, kafka and the corresponding landing path;

2、修改日志的配置文件,在该日志的落地组件命令中添加hdfs、kafka字段,并添加hdfs、kafka的基本配置信息;2. Modify the configuration file of the log, add hdfs and kafka fields to the landing component command of the log, and add the basic configuration information of hdfs and kafka;

3、重启日志对应的Application;在重启的同时即可根据日志访问请求中携带的落地路径将该日志分别写入hdfs、kafka中3. Restart the application corresponding to the log; at the same time, the log can be written to hdfs and kafka according to the landing path carried in the log access request.

4、向业务反馈落地成功的信息,业务可直接根据日志访问请求中的落地路径中读取日志。4. Feedback the successful landing information to the business, and the business can directly read the log according to the landing path in the log access request.

上述优选实施例的过程可以通过以下代码实现:The process of the above preferred embodiment can be implemented by the following code:

//指定从哪个Kafka集群消费//Specify which Kafka cluster to consume from

kafka.clusterId=shbt2kafka.clusterId=shbt2

kafka.retries=5kafka.retries=5

kafka.auto.offset.reset=earliestkafka.auto.offset.reset=earliest

//以下为需要从kafka中消费的topics,可按业务增减topic//The following are the topics that need to be consumed from kafka, which can be increased or decreased according to the business

hamal.source.kafka.topics=d.x.6.m,d.x.6,d.u.6.m,d.u.6,d.s.6.m,d.s.6,d.c.6.m,d.c.6hamal.source.kafka.topics=d.x.6.m,d.x.6,d.u.6.m,d.u.6,d.s.6.m,d.s.6,d.c.6.m,d.c.6

//定义如何解析上述topic的协议//Define the protocol of how to parse the above topic

hamal.source.kafka.message.deserializer.class=com.mvad.hamal.lib.source.io.RawlogDeserializerhamal.source.kafka.message.deserializer.class=com.mvad.hamal.lib.source.io.RawlogDeserializer

//在数据处理过程中是否要做一些特殊处理,比如过滤,采样等操作//Whether to do some special processing in the process of data processing, such as filtering, sampling and other operations

hamal.processor.class=com.mvad.hamal.lib.processor.DSPProcessorhamal.processor.class=com.mvad.hamal.lib.processor.DSPProcessor

//指定落地到hdfs,kafka这两个组件(kafka本身也是一个可以落地的组件)//Specify the two components that land on hdfs and kafka (kafka itself is also a component that can be landed)

hamal.sink.target=hdfs,kafka//也可以再加一个redishamal.sink.target=hdfs,kafka//You can also add a redis

//kafka sink组件的配置//Configuration of kafka sink component

hamal.sink.kafka.clusterId=shbt2hamal.sink.kafka.clusterId=shbt2

hamal.sink.kafka.message.serializer.class=com.mvad.hamal.lib.source.io.D SPSampleKafkaMessageSerializerhamal.sink.kafka.message.serializer.class=com.mvad.hamal.lib.source.io.D SPSampleKafkaMessageSerializer

//hdfs sink组件的配置信息//Configuration information of hdfs sink component

hamal.sink.hdfs.basedir=/mvad/rawlog/dsphamal.sink.hdfs.basedir=/mvad/rawlog/dsp

hamal.sink.hdfs.format=LzoThriftBlockWithMetahamal.sink.hdfs.format=LzoThriftBlockWithMeta

hamal.sink.hdfs.bucketing.filename.prefix=dsphamal.sink.hdfs.bucketing.filename.prefix=dsp

hamal.sink.hdfs.bucketing.filename.suffix=.dsp.lzohamal.sink.hdfs.bucketing.filename.suffix=.dsp.lzo

由上述实施例可知,日志的配置文件中配置了几个组件,就需要对应的增加各组件的配置信息,业务通过增减消费的topic、或增减组件,可以灵活配置。It can be seen from the above embodiment that if several components are configured in the configuration file of the log, the configuration information of each component needs to be correspondingly added, and the business can be flexibly configured by increasing or decreasing consumption topics or increasing or decreasing components.

基于同一发明构思,本发明实施例还提供了一种日志落地装置。如图4所示,根据本发明实施例的日志落地装置可以包括:Based on the same inventive concept, an embodiment of the present invention also provides a log landing device. As shown in FIG. 4 , a log landing device according to an embodiment of the present invention may include:

请求接收模块410,配置为接收业务的日志访问请求,日志访问请求中携带有所需访问的日志类别以及至少一个目标落地组件;The request receiving module 410 is configured to receive the log access request of the business, and the log access request carries the log category to be accessed and at least one target landing component;

解析模块420,配置为解析日志访问请求,根据日志类别确定该业务访问的日志属于已消费日志;The parsing module 420 is configured to parse the log access request, and determine that the log accessed by the business belongs to the consumed log according to the log category;

落地模块430,配置为根据目标落地组件的类型在该日志的配置文件中添加上述目标落地组件的配置信息,将该日志写入目标落地组件中,完成日志落地。The landing module 430 is configured to add the configuration information of the above-mentioned target landing component to the configuration file of the log according to the type of the target landing component, and write the log into the target landing component to complete the log landing.

在本发明的一个优选实施例中,如图5所示,解析模块420可以包括:In a preferred embodiment of the present invention, as shown in FIG. 5 , the parsing module 420 may include:

判断单元421,配置为解析日志访问请求,获取日志访问请求中携带的日志类别,判断该日志类别是否存在于预设日类别列表中;The judging unit 421 is configured to parse the log access request, obtain the log category carried in the log access request, and determine whether the log category exists in the preset daily category list;

第一确定单元422,配置为当该日志类别存在于预设日类别列表中时,确定业务访问的日志属于已消费日志。The first determining unit 422 is configured to, when the log category exists in the preset daily category list, determine that the log accessed by the service belongs to the consumed log.

在本发明的一个优选实施例中,如图5所示,解析模块420还可以包括:In a preferred embodiment of the present invention, as shown in FIG. 5 , the parsing module 420 may further include:

第二确定单元423,配置为配置为当该日志类别不存在于预设日类别列表中时,则确定业务访问的日志属于未消费日志;将日志类别添加至预设日志类别列表中,并从指定集群中消费日志。The second determining unit 423 is configured to be configured to, when the log category does not exist in the preset daily category list, determine that the log accessed by the business belongs to an unconsumed log; add the log category to the preset log category list, and select the log category from the list of preset log categories. Specifies the consumption log in the cluster.

在本发明的一个优选实施例中,第二确定单元423还可以配置为:在预设日志类别列表中添加日志类别相应的字段信息;从指定集群中收集与日志类别对应的日志信息。In a preferred embodiment of the present invention, the second determining unit 423 may be further configured to: add field information corresponding to the log category in the preset log category list; collect log information corresponding to the log category from a specified cluster.

在本发明的一个优选实施例中,落地模块430还可以配置为:In a preferred embodiment of the present invention, the landing module 430 can also be configured as:

在日志的配置文件中指定的落地组件命令中添加目标落地组件的字段信息;根据目标落地组件的类型确定该目标落地组件实现日志落地所需的基本配置信息;在配置文件中添加目标落地组件的基本配置信息,以提供目标落地组件的访问接口,将日志写入目标落地组件中,完成日志落地。Add the field information of the target landing component to the landing component command specified in the log configuration file; determine the basic configuration information required by the target landing component to implement the log landing according to the type of the target landing component; add the target landing component to the configuration file. Basic configuration information to provide the access interface of the target landing component, write the log to the target landing component, and complete the log landing.

在本发明的一个优选实施例中,如图5所示,上述装置还可以包括:In a preferred embodiment of the present invention, as shown in FIG. 5 , the above-mentioned device may further include:

重启模块440,配置为重启与日志类别对应的应用。The restart module 440 is configured to restart the application corresponding to the log category.

在本发明的一个优选实施例中,日志访问请求中还携带有将日志写入目标落地组件的落地路径;In a preferred embodiment of the present invention, the log access request also carries a landing path for writing the log into the target landing component;

如图5所示,上述装置还可以包括:As shown in Figure 5, the above-mentioned device may also include:

信息发送模块450,配置为向业务返回日志落地成功的消息,由业务基于落地路径读取日志。The information sending module 450 is configured to return a message of successful log landing to the service, and the service reads the log based on the landing path.

本发明实施例提供了一种日志落地方法及装置,在接收到业务的日志访问请求后,通过解析该日志访问请求获取业务所需访问的日志类别以及日志的目标落地组件,当确定与该日志类别所对应的日志属于已消费日志时,可以直接在该日志的配置文件中增加目标落地组件的配置信息,以将日志写入目标落地组件中进而完成日志落地。基于本发明实施例提供的日志落地方法,对于将已消费日志落地至新落地组件时,只需在日志的配置文件中增加需要落地的目标落地组件的配置信息即可实现日志的落地,可以避免对同一份日志的重复消费,快速并有效为业务将日志落地到组件中,进而提升业务接入的效率。并且,本发明实施例中各落地组件可进行集中配置,当新的业务对同一份日志具有不同的落地请求时,可高效并快速为业务提供接入服务,通过增加在日志的配置文件中增加配置信息,达到配置即上线,大大提高接入效率。Embodiments of the present invention provide a log landing method and device. After receiving a log access request from a business, the log type required by the business and the target landing component of the log are obtained by parsing the log access request. When the log corresponding to the category belongs to the consumed log, you can directly add the configuration information of the target landing component to the configuration file of the log to write the log into the target landing component to complete the log landing. Based on the log landing method provided by the embodiment of the present invention, when the consumed log is landed on a new landing component, it is only necessary to add the configuration information of the target landing component that needs to be landed in the log configuration file to realize the landing of the log, which can be avoided. The repeated consumption of the same log can quickly and effectively implement the log into the component for the business, thereby improving the efficiency of business access. In addition, each landing component in the embodiment of the present invention can be configured centrally. When a new business has different landing requests for the same log, it can efficiently and quickly provide access services for the business. After the configuration information is reached, the configuration will go online, which greatly improves the access efficiency.

进一步地,本发明实施例的消费一份日志就可以落地到多个系统中,避免重复消费,大大节省资源,可扩展性、系统容忍错误的这种程度均可有效提升,还具备高可用,高扩展性。Further, the consumption of one log in the embodiment of the present invention can be implemented in multiple systems, repeated consumption is avoided, resources are greatly saved, the degree of scalability and error tolerance of the system can be effectively improved, and high availability is also provided. High scalability.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. It will be understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it is to be understood that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or its description. This disclosure, however, should not be construed as reflecting an intention that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. The modules or units or components in the embodiments may be combined into one module or unit or component, and further they may be divided into multiple sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method so disclosed may be employed in any combination, unless at least some of such features and/or procedures or elements are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will appreciate that although some of the embodiments described herein include certain features, but not others, included in other embodiments, that combinations of features of different embodiments are intended to be within the scope of the invention within and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的日志落地装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components of the log landing device according to the embodiment of the present invention. The present invention can also be implemented as apparatus or apparatus programs (eg, computer programs and computer program products) for performing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form.

本发明实施例还提供了一种电子设备,包括:处理器;以及被安排成存储计算机可执行指令的存储器,可执行指令在被执行时使处理器执行根据上述任一项所述的日志落地方法。An embodiment of the present invention also provides an electronic device, comprising: a processor; and a memory arranged to store computer-executable instructions, the executable instructions, when executed, cause the processor to execute the log landing according to any of the above method.

本发明实施例提供了一种计算机可读存储介质,其中,计算机可读存储介质存储一个或多个程序,一个或多个程序当被包括多个应用程序的电子设备执行时,使得电子设备执行根据上述任一项所述的日志落地方法。Embodiments of the present invention provide a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs, when executed by an electronic device including multiple application programs, cause the electronic device to execute The log landing method according to any one of the above.

例如,图6示出了可以实现日志落地方法的计算设备。该计算设备传统上包括处理器610和存储器620形式的计算机程序产品或者计算机可读介质。存储器620可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器620具有存储用于执行上述方法中的任何方法步骤的程序代码631的存储空间630。例如,存储程序代码的存储空间630可以包括分别用于实现上面的方法中的各种步骤的各个程序代码631。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为例如图7所示的便携式或者固定存储单元。该存储单元可以具有与图6的计算设备中的存储器620类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括用于执行本发明的方法步骤的计算机可读代码631’,即可以由诸如610之类的处理器读取的代码,当这些代码由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。For example, Figure 6 shows a computing device that can implement the log landing method. The computing device traditionally includes a computer program product or computer readable medium in the form of a processor 610 and a memory 620 . The memory 620 may be electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. The memory 620 has storage space 630 for storing program code 631 for performing any of the method steps in the above-described methods. For example, the storage space 630 for storing program codes may include respective program codes 631 for implementing various steps in the above methods, respectively. These program codes can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such a computer program product is typically a portable or fixed storage unit as shown in FIG. 7 . The storage unit may have storage segments, storage spaces, etc. arranged similarly to memory 620 in the computing device of FIG. 6 . The program code may, for example, be compressed in a suitable form. Typically, the storage unit includes computer readable code 631' for performing the method steps of the present invention, ie code readable by a processor such as 610, which when executed by a computing device, cause the computing device to execute the various steps in the method described above.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-described embodiments illustrate rather than limit the invention, and that alternative embodiments may be devised by those skilled in the art without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.

至此,本领域技术人员应认识到,虽然本文已详尽示出和描述了本发明的多个示例性实施例,但是,在不脱离本发明精神和范围的情况下,仍可根据本发明公开的内容直接确定或推导出符合本发明原理的许多其他变型或修改。因此,本发明的范围应被理解和认定为覆盖了所有这些其他变型或修改。By now, those skilled in the art will recognize that, although various exemplary embodiments of the present invention have been illustrated and described in detail herein, the present invention may still be implemented in accordance with the present disclosure without departing from the spirit and scope of the present invention. The content directly determines or derives many other variations or modifications consistent with the principles of the invention. Accordingly, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.

根据本发明的一个方面,提供了A1.一种日志落地方法,包括:According to one aspect of the present invention, A1. a log landing method is provided, comprising:

接收业务的日志访问请求,所述日志访问请求中携带有所需访问的日志类别以及至少一个目标落地组件;Receive a log access request from the business, where the log access request carries the log category to be accessed and at least one target landing component;

解析所述日志访问请求,根据所述日志类别确定所述业务访问的日志属于已消费日志;Parse the log access request, and determine, according to the log category, that the service access log belongs to a consumed log;

根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地。The configuration information of the target landing component is added to the configuration file of the log according to the type of the target landing component, and the log is written into the target landing component to complete the log landing.

A2.根据A1的方法,其中,所述解析所述日志访问请求,根据所述日志类别确定所述业务访问的日志属于已消费日志,包括:A2. The method according to A1, wherein, by analyzing the log access request, determining that the service access log belongs to a consumed log according to the log category, including:

解析所述日志访问请求,获取所述日志访问请求中携带的日志类别,判断该日志类别是否存在于预设日类别列表中;Parse the log access request, obtain the log category carried in the log access request, and determine whether the log category exists in the preset day category list;

若是,则确定所述业务访问的日志属于已消费日志。If so, it is determined that the log of the service access belongs to the consumed log.

A3.根据A2所述的方法,其中,所述解析所述日志访问请求,获取所述日志类别,判断该日志类别是否存在于预设日类别列表中之后,还包括:A3. The method according to A2, wherein after parsing the log access request, obtaining the log category, and judging whether the log category exists in the preset daily category list, the method further includes:

若否,则确定所述业务访问的日志属于未消费日志;If not, it is determined that the log of the service access belongs to the unconsumed log;

将所述日志类别添加至所述预设日志类别列表中,并从指定集群中消费日志。Add the log category to the preset log category list, and consume logs from the specified cluster.

A4.根据A3所述的方法,其中,所述将所述日志类别添加至所述预设日志类别列表中,并从指定集群中消费日志,包括:A4. The method according to A3, wherein the adding the log category to the preset log category list and consuming logs from a specified cluster includes:

在所述预设日志类别列表中添加所述日志类别相应的字段信息;adding field information corresponding to the log category in the preset log category list;

从指定集群中收集与所述日志类别对应的日志信息。Collect log information corresponding to the log category from the specified cluster.

A5.根据A1所述的方法,其中,所述根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地,包括:A5. The method according to A1, wherein the configuration information of the target landing component is added to the configuration file of the log according to the type of the target landing component, and the log is written to the target landing component , complete the log landing, including:

在所述日志的配置文件中指定的落地组件命令中添加所述目标落地组件的字段信息;adding the field information of the target landing component to the landing component command specified in the configuration file of the log;

根据所述目标落地组件的类型确定该目标落地组件实现日志落地所需的基本配置信息;Determine the basic configuration information required by the target landing component to implement log landing according to the type of the target landing component;

在所述配置文件中添加所述目标落地组件的基本配置信息,以提供所述目标落地组件的访问接口,将所述日志写入所述目标落地组件中,完成日志落地。The basic configuration information of the target landing component is added to the configuration file to provide an access interface of the target landing component, and the log is written into the target landing component to complete the log landing.

A6.根据A1所述的方法,其中,所述根据所述目标落地组件的类型在所述配置文件中添加所述目标落地组件的配置信息之后,还包括:A6. The method according to A1, wherein after adding the configuration information of the target landing component in the configuration file according to the type of the target landing component, the method further includes:

重启与所述日志类别对应的应用。Restart the application corresponding to the log category.

A7.根据A1-A6任一项所述的方法,其中,所述日志访问请求中还携带有将所述日志写入所述目标落地组件的落地路径;A7. The method according to any one of A1-A6, wherein the log access request also carries a landing path for writing the log into the target landing component;

所述根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地之后,还包括:The adding the configuration information of the target landing component in the configuration file of the log according to the type of the target landing component, writing the log into the target landing component, and after completing the log landing, further includes:

向所述业务返回日志落地成功的消息,由所述业务基于所述落地路径读取所述日志。A message of successful log landing is returned to the service, and the service reads the log based on the landing path.

A8.根据A1-A6任一项所述的方法,其中,所述方法应用于Kafka系统。A8. The method according to any one of A1-A6, wherein the method is applied to a Kafka system.

根据本发明的另一个方面,还提供了B9.一种日志落地装置,包括:According to another aspect of the present invention, B9. a log landing device is also provided, comprising:

请求接收模块,配置为接收业务的日志访问请求,所述日志访问请求中携带有所需访问的日志类别以及至少一个目标落地组件;a request receiving module, configured to receive a service log access request, where the log access request carries the log category to be accessed and at least one target landing component;

解析模块,配置为解析所述日志访问请求,根据所述日志类别确定所述业务访问的日志属于已消费日志;A parsing module, configured to parse the log access request, and determine according to the log category that the business access log belongs to a consumed log;

落地模块,配置为根据所述目标落地组件的类型在所述日志的配置文件中添加所述目标落地组件的配置信息,将所述日志写入所述目标落地组件中,完成日志落地。The landing module is configured to add configuration information of the target landing component in the configuration file of the log according to the type of the target landing component, write the log into the target landing component, and complete the log landing.

B10.根据B9所述的装置,其中,所述解析模块包括:B10. The apparatus according to B9, wherein the parsing module comprises:

判断单元,配置为解析所述日志访问请求,获取所述日志访问请求中携带的日志类别,判断该日志类别是否存在于预设日类别列表中;a judging unit, configured to parse the log access request, obtain the log category carried in the log access request, and determine whether the log category exists in the preset day category list;

第一确定单元,配置为当该日志类别存在于预设日类别列表中时,确定所述业务访问的日志属于已消费日志。The first determining unit is configured to determine that the log of the service access belongs to the consumed log when the log category exists in the preset day category list.

B11.根据B10所述的装置,其中,所述解析模块还包括:B11. The apparatus according to B10, wherein the parsing module further comprises:

第二确定单元,配置为配置为当该日志类别不存在于预设日类别列表中时,则确定所述业务访问的日志属于未消费日志;将所述日志类别添加至所述预设日志类别列表中,并从指定集群中消费日志。The second determination unit is configured to be configured to, when the log category does not exist in the preset daily category list, determine that the log of the service access belongs to an unconsumed log; and add the log category to the preset log category list and consume logs from the specified cluster.

B12.根据B11所述的装置,其中,所述第二确定单元还配置为:B12. The apparatus according to B11, wherein the second determining unit is further configured to:

在所述预设日志类别列表中添加所述日志类别相应的字段信息;从指定集群中收集与所述日志类别对应的日志信息。Field information corresponding to the log category is added to the preset log category list; log information corresponding to the log category is collected from a specified cluster.

B13.根据B9所述的装置,其中,所述落地模块还配置为:B13. The device according to B9, wherein the floor module is further configured to:

在所述日志的配置文件中指定的落地组件命令中添加所述目标落地组件的字段信息;adding the field information of the target landing component to the landing component command specified in the configuration file of the log;

根据所述目标落地组件的类型确定该目标落地组件实现日志落地所需的基本配置信息;Determine the basic configuration information required by the target landing component to implement log landing according to the type of the target landing component;

在所述配置文件中添加所述目标落地组件的基本配置信息,以提供所述目标落地组件的访问接口,将所述日志写入所述目标落地组件中,完成日志落地。The basic configuration information of the target landing component is added to the configuration file to provide an access interface of the target landing component, and the log is written into the target landing component to complete the log landing.

B14.根据B9所述的装置,其中,还包括:重启模块,配置为重启与所述日志类别对应的应用。B14. The apparatus according to B9, further comprising: a restart module configured to restart the application corresponding to the log category.

B15.根据B9-B14任一项所述的装置,其中,所述日志访问请求中还携带有将所述日志写入所述目标落地组件的落地路径;B15. The device according to any one of B9-B14, wherein the log access request further carries a landing path for writing the log into the target landing component;

所述装置还包括:信息发送模块,配置为向所述业务返回日志落地成功的消息,由所述业务基于所述落地路径读取所述日志。The device further includes: an information sending module configured to return a log landing success message to the service, and the service reads the log based on the landing path.

根据本发明的另一个方面,还提供了C16.一种电子设备,包括:According to another aspect of the present invention, C16. an electronic device is also provided, comprising:

处理器;以及processor; and

被安排成存储计算机可执行指令的存储器,所述可执行指令在被执行时使所述处理器执行根据A1-A8中任一项所述的日志落地方法。A memory arranged to store computer executable instructions which, when executed, cause the processor to perform the log landing method according to any of A1-A8.

根据本发明的另一个方面,还提供了D17.一种计算机可读存储介质,其中,所述计算机可读存储介质存储一个或多个程序,所述一个或多个程序当被包括多个应用程序的电子设备执行时,使得所述电子设备执行根据A1-A8中任一项所述的日志落地方法。According to another aspect of the present invention, D17. A computer-readable storage medium is also provided, wherein the computer-readable storage medium stores one or more programs, when the one or more programs are included with multiple applications When the electronic device of the program is executed, the electronic device is made to execute the log landing method according to any one of A1-A8.

Claims (10)

1. method is landed in a kind of log, comprising:
The log access of reception business is requested, the log category that accesses needed for carrying in the log access request and at least One target lands component;
The log access request is parsed, determines that the log of the business access belongs to according to the log category and has consumed day Will;
Matching for the target landing component is added in the configuration file of the log according to the type that the target lands component The log is written in the target landing component, completes log landing by confidence breath.
2. the method according to claim 1, wherein the parsing log access request is determined according to the log category The log of the business access, which belongs to, has consumed log, comprising:
The log access request is parsed, the log category carried in the log access request is obtained, judges the log category With the presence or absence of in default day list of categories;
If so, determining that the log of the business access belongs to has consumed log.
3. the log category is obtained according to the method described in claim 2, wherein, the parsing log access is requested, After judging that the log category whether there is in default day list of categories, further includes:
If not, it is determined that the log of the business access, which belongs to, does not consume log;
The log category is added in the default log category list, and consumes log from cluster-specific.
It is described the log category is added to the default log category to arrange 4. according to the method described in claim 3, wherein In table, and log is consumed from cluster-specific, comprising:
The corresponding field information of the log category is added in the default log category list;
Log information corresponding with the log category is collected from cluster-specific.
5. according to the method described in claim 1, wherein, the type according to target landing component is in the log The log is written in the target landing component configuration information that the target landing component is added in configuration file, complete It is landed at log, comprising:
The field information of the target landing component is added in the landing component order specified in the configuration file of the log;
Determine that target landing component realizes the required basic configuration letter of log landing according to the type that the target lands component Breath;
The basic configuration information of the target landing component is added, in the configuration file to provide the target landing component Access interface, the log is written in target landing component, log landing is completed.
6. according to the method described in claim 1, wherein, the type for landing component according to the target is literary in the configuration After the configuration information for adding the target landing component in part, further includes:
Restart application corresponding with the log category.
7. method according to claim 1-6, wherein also carry in the log access request by the day The landing path of the target landing component is written in will;
The type for landing component according to the target adds the target in the configuration file of the log and lands component Configuration information, the log is written in target landing component, after completing log landing, further includes:
Log is returned to the business and lands successful message, and the landing path is based on by the business and reads the log.
8. a kind of log apparatus for descending, comprising:
Request receiving module is configured to the log access request of reception business, carries required visit in the log access request The log category asked and at least one target land component;
Parsing module is configured to parse the log access request, the day of the business access is determined according to the log category Will, which belongs to, has consumed log;
Module is landed, the type for being configured to land component according to the target adds the mesh in the configuration file of the log Village component configuration information, the log is written in target landing component, log landing is completed.
9. a kind of electronic equipment, comprising:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the processor when executed It executes log described in any one of -7 according to claim 1 and lands method.
10. a kind of computer readable storage medium, wherein the computer-readable recording medium storage one or more program, One or more of programs are when the electronic equipment for being included multiple application programs executes, so that the electronic equipment executes root Method is landed according to log of any of claims 1-7.
CN201711489249.3A 2017-12-29 2017-12-29 Log floor method and device Active CN110019045B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711489249.3A CN110019045B (en) 2017-12-29 2017-12-29 Log floor method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711489249.3A CN110019045B (en) 2017-12-29 2017-12-29 Log floor method and device

Publications (2)

Publication Number Publication Date
CN110019045A true CN110019045A (en) 2019-07-16
CN110019045B CN110019045B (en) 2024-04-16

Family

ID=67187196

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711489249.3A Active CN110019045B (en) 2017-12-29 2017-12-29 Log floor method and device

Country Status (1)

Country Link
CN (1) CN110019045B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110928906A (en) * 2019-11-08 2020-03-27 杭州安恒信息技术股份有限公司 Method for writing carbon data only once based on flink
CN111240858A (en) * 2020-01-07 2020-06-05 中国建设银行股份有限公司 Event scheduling method and component
CN113138858A (en) * 2020-01-17 2021-07-20 北京京东尚科信息技术有限公司 Data processing method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104243532A (en) * 2013-06-21 2014-12-24 鸿富锦精密工业(深圳)有限公司 Data access method and system
CN104281515A (en) * 2013-07-09 2015-01-14 腾讯科技(深圳)有限公司 Adjustment method and device for log data
CN105260293A (en) * 2015-11-06 2016-01-20 Tcl集团股份有限公司 Output method, output device and terminal equipment of log information
CN105830107A (en) * 2013-12-19 2016-08-03 维萨国际服务协会 Cloud-based transaction method and system
CN106021315A (en) * 2016-05-05 2016-10-12 智者四海(北京)技术有限公司 Log management method and system for application program
CN106598815A (en) * 2016-12-29 2017-04-26 广州华多网络科技有限公司 Real-time asynchronous log collection method and system
CN106874160A (en) * 2017-01-23 2017-06-20 上海斐讯数据通信技术有限公司 Log server and its management method
CN107025163A (en) * 2017-03-31 2017-08-08 北京商办通互联网科技有限公司 A kind of passive type production, the demand realization method and system of consumer computers daily record

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104243532A (en) * 2013-06-21 2014-12-24 鸿富锦精密工业(深圳)有限公司 Data access method and system
CN104281515A (en) * 2013-07-09 2015-01-14 腾讯科技(深圳)有限公司 Adjustment method and device for log data
CN105830107A (en) * 2013-12-19 2016-08-03 维萨国际服务协会 Cloud-based transaction method and system
CN105260293A (en) * 2015-11-06 2016-01-20 Tcl集团股份有限公司 Output method, output device and terminal equipment of log information
CN106021315A (en) * 2016-05-05 2016-10-12 智者四海(北京)技术有限公司 Log management method and system for application program
CN106598815A (en) * 2016-12-29 2017-04-26 广州华多网络科技有限公司 Real-time asynchronous log collection method and system
CN106874160A (en) * 2017-01-23 2017-06-20 上海斐讯数据通信技术有限公司 Log server and its management method
CN107025163A (en) * 2017-03-31 2017-08-08 北京商办通互联网科技有限公司 A kind of passive type production, the demand realization method and system of consumer computers daily record

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
YUNJIEQIU 等: "RTA:Real time actionable events detection as a service", 《2016 IEEE INTERNATIONAL CONFERENCE ON WEB SERVICES》, pages 1 - 4 *
陈付梅 等: "大数据环境下的分布式数据流处理关键技术探析", 《计算机应用》, vol. 37, no. 3, pages 620 - 627 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110928906A (en) * 2019-11-08 2020-03-27 杭州安恒信息技术股份有限公司 Method for writing carbon data only once based on flink
CN111240858A (en) * 2020-01-07 2020-06-05 中国建设银行股份有限公司 Event scheduling method and component
CN111240858B (en) * 2020-01-07 2024-04-26 中国建设银行股份有限公司 Event scheduling method and component
CN113138858A (en) * 2020-01-17 2021-07-20 北京京东尚科信息技术有限公司 Data processing method and device

Also Published As

Publication number Publication date
CN110019045B (en) 2024-04-16

Similar Documents

Publication Publication Date Title
CN111881011B (en) Log management method, platform, server and storage medium
CN107145489B (en) Information statistics method and device for client application based on cloud platform
CN104537076B (en) A kind of file read/write method and device
US8140591B2 (en) Enabling workflow awareness within a business process management (BPM) system
WO2016206600A1 (en) Information flow data processing method and device
CN111177237B (en) Data processing system, method and device
CN110515912A (en) Log processing method, device, computer installation and computer readable storage medium
CN103401934A (en) Method and system for acquiring log data
US10698935B2 (en) Optimization for real-time, parallel execution of models for extracting high-value information from data streams
WO2019200984A1 (en) Life cycle management method for distributed application, managers, device and medium
CN105608188A (en) Data processing method and data processing device
CN103927314B (en) A kind of method and apparatus of batch data processing
CN106202324A (en) The data processing method of a kind of real-time calculating platform and device
US9971563B2 (en) Systems and methods for low interference logging and diagnostics
US20180129712A1 (en) Data provenance and data pedigree tracking
US10698863B2 (en) Method and apparatus for clearing data in cloud storage system
CN108829505A (en) A kind of distributed scheduling system and method
CN108509313A (en) A kind of business monitoring method, platform and storage medium
CN105205167A (en) Log data system
CN110019045A (en) Method and device is landed in log
US9760576B1 (en) System and method for performing object-modifying commands in an unstructured storage service
CN113297245A (en) Method and device for acquiring execution information
CN113722114A (en) Data service processing method and device, computing equipment and storage medium
CN113326305A (en) Method and device for processing data
CN107480189A (en) A kind of various dimensions real-time analyzer and method

Legal Events

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