[go: up one dir, main page]

CN107315756B - A log processing method and device - Google Patents

A log processing method and device Download PDF

Info

Publication number
CN107315756B
CN107315756B CN201610273047.4A CN201610273047A CN107315756B CN 107315756 B CN107315756 B CN 107315756B CN 201610273047 A CN201610273047 A CN 201610273047A CN 107315756 B CN107315756 B CN 107315756B
Authority
CN
China
Prior art keywords
log
processed
data
log data
processing
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.)
Active
Application number
CN201610273047.4A
Other languages
Chinese (zh)
Other versions
CN107315756A (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.)
China Mobile Group Anhui Co Ltd
Original Assignee
China Mobile Group Anhui 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 China Mobile Group Anhui Co Ltd filed Critical China Mobile Group Anhui Co Ltd
Priority to CN201610273047.4A priority Critical patent/CN107315756B/en
Publication of CN107315756A publication Critical patent/CN107315756A/en
Application granted granted Critical
Publication of CN107315756B publication Critical patent/CN107315756B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

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 embodiment of the invention discloses a log processing method, which is applied to processing nodes and comprises the following steps: acquiring log data corresponding to a first service log to be processed from a data cache; acquiring first processed log data according to the first service log to be processed and the log data; determining whether other processing nodes access log data corresponding to the first service log to be processed in the data cache or not; if no other processing node accesses the log data corresponding to the first service log to be processed in the data cache, storing the first processed log data in the data cache; and if other processing nodes access the log data corresponding to the first service log to be processed in the data cache, storing the first processed log data in a temporary cache. Furthermore, the embodiment of the invention also discloses a log processing device.

Description

一种日志处理方法及装置A log processing method and device

技术领域technical field

本发明涉及通信领域的数据处理技术,尤其涉及一种日志处理方法及装置。The present invention relates to data processing technology in the communication field, and in particular, to a log processing method and device.

背景技术Background technique

随着通信技术的发展,使用手机、固话、平板和电脑宽带等客户端的用户也越来越多,运营商为用户提供可种各样的业务,用户可以根据自身需求选择不同的业务。With the development of communication technology, more and more users are using mobile phone, fixed line, tablet and computer broadband. Operators provide users with various services, and users can choose different services according to their own needs.

现有技术中,用户办理业务的渠道包括实体营业厅和网上营业厅,用户在办理业务时会实时的产生业务日志,所述业务日志记录了用户标识,用户办理的业务标识,办理时间等信息。通过实时分析业务日志,实时监控业务办理时长、业务办理失败笔数、业务办理失败环节等指标,可以实时获取业务办理系统运行状态,及时定位系统故障,缩短系统故障解决时间,提高业务办理效率和用户体验。In the prior art, the channels for users to handle business include physical business halls and online business halls. When the user handles business, a business log is generated in real time, and the business log records information such as the user ID, the business ID handled by the user, and the processing time. . Through real-time analysis of business logs, real-time monitoring of business processing time, the number of business processing failures, and business processing failure links and other indicators, the operating status of the business processing system can be obtained in real time, system faults can be located in time, system fault resolution time can be shortened, and business processing efficiency and efficiency can be improved. user experience.

由于办理业务的用户众多,每天产生的业务日志数据量大,在对业务日志进行分析时,单台服务器的处理性能很难满足需求,因此需要采用集群分布式架构进行处理,即将大量日志数据分配到多个处理节点进行处理,提高处理速度。由于同一业务的业务日志需要进行上下文要关联处理,因此同一个业务的业务日志需要分配给同一个处理节点,然而用户办理的业务类型多种多样,有些业务产生的业务日志较多,有些业务产生的业务日志较少,因此容易出现分配给不同处理节点的业务日志的数量相差较大的情况,进而导致多个理节点的负载不均衡,影响系统稳定性。Due to the large number of users who handle the business, the amount of business log data generated every day is large. When analyzing business logs, the processing performance of a single server is difficult to meet the demand. Therefore, a cluster distributed architecture needs to be used for processing, that is, a large amount of log data is allocated. Go to multiple processing nodes for processing to improve processing speed. Since the business logs of the same business need to be processed in context, the business logs of the same business need to be assigned to the same processing node. However, there are various business types handled by users. Some businesses generate more business logs, and some businesses generate The number of business logs allocated to different processing nodes is likely to vary greatly, which in turn leads to unbalanced loads on multiple processing nodes and affects system stability.

发明内容SUMMARY OF THE INVENTION

为解决上述技术问题,本发明实施例期望提供一种日志处理方法及装置,能够采用多节点处理同一个业务的业务日志,使得多个处理节点的负载均衡,提高了系统稳定性。In order to solve the above technical problems, the embodiments of the present invention are expected to provide a log processing method and device, which can use multiple nodes to process the service log of the same service, so as to balance the load of multiple processing nodes and improve system stability.

本发明的技术方案是这样实现的:The technical scheme of the present invention is realized as follows:

一方面,本发明实施例提供一种日志处理方法,应用于处理节点,包括:On the one hand, an embodiment of the present invention provides a log processing method, which is applied to a processing node, including:

从数据缓存中获取第一待处理业务日志对应的日志数据;Obtain log data corresponding to the first pending business log from the data cache;

根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据;According to the first to-be-processed business log and the log data, obtain first processed log data;

确定当前是否还有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据;determining whether there are currently other processing nodes accessing log data corresponding to the first pending business log in the data cache;

若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于数据缓存;若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于临时缓存。If no other processing node currently accesses the log data corresponding to the first to-be-processed business log in the data cache, the first processed log data is stored in the data cache; if other processing nodes currently access the data cache For the log data corresponding to the first service log to be processed, the first processed log data is stored in a temporary cache.

可选的,在将所述第一处理后日志数据存储于临时缓存之后,所述方法还包括:Optionally, after storing the first processed log data in the temporary cache, the method further includes:

从所述数据缓存中获取第二待处理业务日志对应的日志数据;Obtain log data corresponding to the second business log to be processed from the data cache;

从所述临时缓存中获取所述第一处理后日志数据;obtaining the first processed log data from the temporary cache;

根据所述第二待处理业务日志、所述第二待处理业务日志对应的日志数据和所述第一处理后日志数据,获取第二处理后日志数据。The second processed log data is acquired according to the second to-be-processed business log, log data corresponding to the second to-be-processed business log, and the first processed log data.

可选的,所述从所述临时缓存中获取所述第一处理后日志数据包括:Optionally, the obtaining the first processed log data from the temporary cache includes:

根据所述第二待处理业务日志的键值,从所述临时缓存中获取与所述键值对应的所述第一处理后日志数据。According to the key value of the second to-be-processed business log, the first processed log data corresponding to the key value is acquired from the temporary cache.

可选的,在根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据之前,所述方法还包括:Optionally, before acquiring the first processed log data according to the first service log to be processed and the log data, the method further includes:

对所述第一待处理业务日志进行信息增强处理,获取第一增强待处理业务日志;performing information enhancement processing on the first to-be-processed business log to obtain a first enhanced to-be-processed business log;

所述根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据包括:The obtaining of the first processed log data according to the first to-be-processed business log and the log data includes:

根据所述第一增强待处理业务日志和所述日志数据,获取第一处理后日志数据。Obtain first processed log data according to the first enhanced service log to be processed and the log data.

可选的,在所述对所述第一待处理业务日志进行信息增强处理,获取第一增强待处理业务日志之前,所述方法还包括:Optionally, before the information enhancement processing is performed on the first service log to be processed and the first enhanced service log to be processed is obtained, the method further includes:

对所述第一待处理业务日志进行预处理,所述预处理包括日志信息格式规范化、空值、异常值检查。The first business log to be processed is preprocessed, and the preprocessing includes log information format normalization, null value, and abnormal value checking.

另一方面,本发明实施例提供一种日志处理装置,包括:On the other hand, an embodiment of the present invention provides a log processing device, including:

第一获取单元,用于从数据缓存中获取第一待处理业务日志对应的日志数据;a first obtaining unit, configured to obtain log data corresponding to the first business log to be processed from the data cache;

第二获取单元,用于根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据;a second obtaining unit, configured to obtain the first processed log data according to the first to-be-processed business log and the log data;

确定单元,用于确定当前是否还有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据;a determining unit, configured to determine whether there are currently other processing nodes accessing log data corresponding to the first to-be-processed business log in the data cache;

存储单元,用于若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于数据缓存;若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于临时缓存。A storage unit, configured to store the first processed log data in the data cache if no other processing node currently accesses the log data corresponding to the first to-be-processed business log in the data cache; if other processing nodes currently exist The log data corresponding to the first to-be-processed business log in the data cache is accessed, and the first processed log data is stored in the temporary cache.

可选的,所述装置还包括:Optionally, the device further includes:

第三获取单元,用于从所述数据缓存中获取第二待处理业务日志对应的日志数据;a third obtaining unit, configured to obtain log data corresponding to the second business log to be processed from the data cache;

第四获取单元,用于从所述临时缓存中获取所述第一处理后日志数据;a fourth obtaining unit, configured to obtain the first processed log data from the temporary cache;

第五获取单元,用于根据所述第二待处理业务日志、所述第二待处理业务日志对应的日志数据和所述第一处理后日志数据,获取第二处理后日志数据。A fifth obtaining unit, configured to obtain second processed log data according to the second to-be-processed business log, log data corresponding to the second to-be-processed business log, and the first processed log data.

可选的,所述第四获取单元具体用于:Optionally, the fourth obtaining unit is specifically used for:

根据所述第二待处理业务日志的键值,从所述临时缓存中获取与所述键值对应的所述第一处理后日志数据。According to the key value of the second to-be-processed business log, the first processed log data corresponding to the key value is acquired from the temporary cache.

可选的,所述装置还包括:Optionally, the device further includes:

增强单元,用于对所述第一待处理业务日志进行信息增强处理,获取第一增强待处理业务日志;an enhancement unit, configured to perform information enhancement processing on the first to-be-processed business log, and obtain the first enhanced to-be-processed business log;

所述第二获取单元具体用于:The second obtaining unit is specifically used for:

根据所述第一增强待处理业务日志和所述日志数据,获取第一处理后日志数据。Obtain first processed log data according to the first enhanced service log to be processed and the log data.

可选的,所述装置还包括:Optionally, the device further includes:

预处理单元,用于对所述第一待处理业务日志进行预处理,所述预处理包括日志信息格式规范化、空值、异常值检查。A preprocessing unit, configured to perform preprocessing on the first to-be-processed business log, where the preprocessing includes log information format normalization, null value, and abnormal value checking.

本发明实施例提供了一种日志处理方法及装置,所述日志处理方法应用于处理节点,包括:从数据缓存中获取第一待处理业务日志对应的日志数据;根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据;确定当前是否还有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据;若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于数据缓存;若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于临时缓存。相较于现有技术,由于可以根据不同的情况将第一处理后日志数据存储与数据缓存或临时缓存,实现了不同处理节点之间的信息共享,进而使得同一个业务产生的业务日志可以在不同的处理节点进行处理,从而可以为每个处理节点分配数量相同的业务日志,使得每个处理节点的负载均衡,提高了系统稳定性。Embodiments of the present invention provide a log processing method and device. The log processing method is applied to a processing node, and includes: acquiring log data corresponding to a first service log to be processed from a data cache; log and the log data, obtain the log data after the first processing; determine whether there are other processing nodes currently accessing the log data corresponding to the first pending business log in the data cache; if no other processing nodes currently access the log data; log data corresponding to the first service log to be processed in the data cache, and store the first processed log data in the data cache; if other processing nodes currently access the first service to be processed in the data cache For log data corresponding to the log, the first processed log data is stored in a temporary cache. Compared with the prior art, since the first post-processing log data can be stored in a data cache or a temporary cache according to different situations, information sharing between different processing nodes is realized, so that the business logs generated by the same business can be stored in the data cache. Different processing nodes perform processing, so that the same number of business logs can be allocated to each processing node, so that the load of each processing node is balanced and the system stability is improved.

附图说明Description of drawings

图1为本发明实施例提供的一种日志处理方法的流程示意图1;FIG. 1 is a schematic flowchart 1 of a log processing method provided by an embodiment of the present invention;

图2为本发明实施例提供的一种日志处理系统的结构示意图;2 is a schematic structural diagram of a log processing system according to an embodiment of the present invention;

图3为本发明实施例提供的一种日志处理方法的流程示意图2;3 is a schematic flowchart 2 of a log processing method provided by an embodiment of the present invention;

图4为本发明实施例提供的一种日志处理装置的结构示意图1;FIG. 4 is a schematic structural diagram 1 of a log processing apparatus provided by an embodiment of the present invention;

图5为本发明实施例提供的一种日志处理装置的结构示意图2;FIG. 5 is a schematic structural diagram 2 of a log processing apparatus provided by an embodiment of the present invention;

图6为本发明实施例提供的一种日志处理装置的结构示意图3;FIG. 6 is a schematic structural diagram 3 of a log processing apparatus provided by an embodiment of the present invention;

图7为本发明实施例提供的一种日志处理装置的结构示意图4。FIG. 7 is a schematic structural diagram 4 of a log processing apparatus according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

实施例一Example 1

本发明实施例提供一种日志处理方法,应用于处理节点,所述处理节点可以是处理器,单片机等硬件设施,也可以是依赖于硬件的软件程序,本发明实施例对此不做限定。如图1所示,所述日志处理方法包括:An embodiment of the present invention provides a log processing method, which is applied to a processing node. The processing node may be a hardware facility such as a processor and a single-chip microcomputer, or may be a hardware-dependent software program, which is not limited in the embodiment of the present invention. As shown in Figure 1, the log processing method includes:

步骤101、从数据缓存中获取第一待处理业务日志对应的日志数据。Step 101: Acquire log data corresponding to a first pending business log from a data cache.

示例的,假设用户当前在班里第一业务,所述第一待处理业务日志是所述第一业务产生的一个业务日志。处理节点在接收到分配的第一待处理业务之后,可以首先获取第一待处理业务的键值,然后将所述键值发送给数据缓存。所述数据缓存中按照不同的键值存储有多个日志数据,数据缓存在接收到处理节点发送的键值之后,查询该键值对应的日志数据,然后将该日志数据发送给处理节点。所述键值可以包括所述第一待处理业务日志对应的业务标识,所述第一待处理业务日志对应的用户标识等信息。For example, it is assumed that the user is currently in the first business in class, and the first business log to be processed is a business log generated by the first business. After receiving the allocated first service to be processed, the processing node may first obtain the key value of the first service to be processed, and then send the key value to the data cache. The data cache stores multiple log data according to different key values. After receiving the key value sent by the processing node, the data cache queries the log data corresponding to the key value, and then sends the log data to the processing node. The key value may include information such as a service identifier corresponding to the first to-be-processed service log, and a user identifier corresponding to the first to-be-processed service log.

步骤102、根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据。Step 102: Acquire first processed log data according to the first service log to be processed and the log data.

示例的,由于一笔业务的办理会持续较长时间,一般在半小时左右,部分业务会长达两个小时,即在长时间周期内产生的多个业务日志都是相关的,需要进行上下文关联或汇总处理。每次处理完之后,按照本次处理的业务日志的键值将对应业务最新的处理结果存储于数据缓存中,所述处理结果即为日志数据,当处理节点接收到该业务对应的下一个待处理业务日志时,可以根据待处理业务日志的键值从数据缓存中获取该键值对应的日志数据,然后根据日志数据和待处理业务日志获取新的日志数据。例如,数据缓存中获取的第一待处理业务日志对应的日志数据即为第一业务在产生第一待处理业务日志之前产生的多个业务日志的处理结果,在处理节点接收到第一待处理业务日志之后,根据第一待处理业务日志和从数据缓存中获取的第一待处理业务日志对应的日志数据,可以获取到新的日志数据,即第一处理后日志数据。For example, since the processing of a business will last for a long time, generally about half an hour, some businesses will take up to two hours, that is, multiple business logs generated in a long period of time are related and need to be contextualized. Associated or aggregated processing. After each processing, the latest processing result of the corresponding business is stored in the data cache according to the key value of the business log processed this time, and the processing result is the log data. When processing business logs, you can obtain log data corresponding to the key value from the data cache according to the key value of the business log to be processed, and then obtain new log data according to the log data and the business log to be processed. For example, the log data corresponding to the first to-be-processed business log obtained in the data cache is the processing result of multiple business logs generated by the first business before the first to-be-processed business log is generated. After the business log, according to the first pending business log and the log data corresponding to the first pending business log obtained from the data cache, new log data, that is, the first processed log data, can be acquired.

步骤103、确定当前是否还有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据。Step 103: Determine whether there are other processing nodes currently accessing log data corresponding to the first to-be-processed service log in the data cache.

示例的,由于同时可能有多个处理节点同时处理第一业务产生的业务日志,因此可能有多个处理节点同时访问数据缓存中第一业务的日志数据,该日志数据即为第一待处理业务日志对应的日志数据。如果在处理节点获取到第一处理后日志数据之后,直接将该第一处理后日志数据存储于数据缓存,替换数据缓存之前存储的第一待处理业务日志对应的日志数据,会导致其他处理节点无法完成处理的情况,因此可以首先判断是否存在其他节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据。For example, since there may be multiple processing nodes that simultaneously process the business log generated by the first service, there may be multiple processing nodes that simultaneously access the log data of the first service in the data cache, and the log data is the first service to be processed. The log data corresponding to the log. If the processing node directly stores the first processed log data in the data cache after obtaining the first processed log data, and replaces the log data corresponding to the first pending business log stored before the data cache, other processing nodes will be affected. In the case where the processing cannot be completed, it can be first determined whether there are other nodes accessing the log data corresponding to the first service log to be processed in the data cache.

步骤104、若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于数据缓存;若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于临时缓存。Step 104: If there is currently no other processing node accessing the log data corresponding to the first pending business log in the data cache, store the first processed log data in the data cache; if there are currently other processing nodes accessing the log data. log data corresponding to the first service log to be processed in the data cache, and store the first processed log data in the temporary cache.

示例的,若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,说明替换第一待处理业务日志对应的日志数据不会影响其他处理节点的处理进程,因此可以直接将所述第一处理后日志数据存储于数据缓存。Exemplarily, if no other processing node currently accesses the log data corresponding to the first to-be-processed business log in the data cache, it means that replacing the log data corresponding to the first to-be-processed business log will not affect the processing process of other processing nodes, Therefore, the first processed log data can be directly stored in the data cache.

若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,说明替换第一待处理业务日志对应的日志数据可能会影响其他处理节点的处理进程,使得其他处理节点无法获取到相关信息,因此可以将第一处理后日志数据存储于临时缓存,所述临时缓存与所述数据缓存不相同,这样既保存了第一业务最新的日志数据,又不会影响其他处理节点的处理进程。If other processing nodes currently access the log data corresponding to the first service log to be processed in the data cache, it means that replacing the log data corresponding to the first service log to be processed may affect the processing process of other processing nodes, causing other processing The node cannot obtain relevant information, so the log data after the first processing can be stored in a temporary cache, which is different from the data cache, so that the latest log data of the first service is saved without affecting other The processing process of the processing node.

这样一来,由于可以根据不同的情况将第一处理后日志数据存储与数据缓存或临时缓存,实现了不同处理节点之间的信息共享,进而使得同一个业务产生的业务日志可以在不同的处理节点进行处理,从而可以为每个处理节点分配数量相同的业务日志,使得每个处理节点的负载均衡,提高了系统稳定性。In this way, since the first processed log data can be stored with the data cache or temporary cache according to different situations, information sharing between different processing nodes is realized, so that the business logs generated by the same business can be processed in different The nodes are processed, so that the same number of business logs can be allocated to each processing node, so that the load of each processing node is balanced and the system stability is improved.

进一步的,在将所述第一处理后日志数据存储于临时缓存之后,还可以从所述数据缓存中获取第二待处理业务日志对应的日志数据,从所述临时缓存中获取所述第一处理后日志数据,然后根据所述第二待处理业务日志、所述第二待处理业务日志对应的日志数据和所述第一处理后日志数据,获取第二处理后日志数据。Further, after the first processed log data is stored in the temporary cache, log data corresponding to the second business log to be processed may be obtained from the data cache, and the first log data may be obtained from the temporary cache. After processing the log data, and then obtaining the second processed log data according to the second pending business log, the log data corresponding to the second pending business log, and the first processed log data.

示例的,在第一业务的办理过程中,还可能继续产生新的业务日志,即第二待处理业务日志,所述第二待处理业务日志和所述第一待处理业务日志的键值相同,表示两者均为第一业务产生的业务日志。在处理第二待处理业务日志时需要结合第二待处理业务日志之前产生的业务日志的处理结果,但是无法判断最新的处理结果是存储于数据缓存中的日志数据,还是存储于临时缓存中日志数据,因此可以分别从数据缓存获取第二待处理业务日志对应的日志数据,从临时缓存中获取第一处理后日志数据,然后根据第二待处理业务日志、所述第二待处理业务日志对应的日志数据和所述第一处理后日志数据,获取第二处理后日志数据。For example, in the process of handling the first business, it is possible to continue to generate a new business log, that is, a second business log to be processed, and the second business log to be processed has the same key value as the first business log to be processed. , indicating that both are business logs generated by the first business. When processing the second to-be-processed business log, the processing result of the business log generated before the second to-be-processed business log needs to be combined, but it is impossible to determine whether the latest processing result is the log data stored in the data cache or the log stored in the temporary cache. Therefore, the log data corresponding to the second business log to be processed can be obtained from the data cache, the first processed log data can be obtained from the temporary cache, and then the log data corresponding to the second business log to be processed can be obtained according to the second business log to be processed. The log data and the first processed log data are obtained, and the second processed log data is obtained.

可选的,在从所述临时缓存中获取所述第一处理后日志数据时,可以根据所述第二待处理业务日志的键值,从所述临时缓存中获取与所述键值对应的所述第一处理后日志数据。Optionally, when acquiring the first processed log data from the temporary cache, the data corresponding to the key value may be acquired from the temporary cache according to the key value of the second to-be-processed business log. the first processed log data.

示例的,可以按照第一待处理业务日志的键值将第一处理后日志数据存储于临时缓存中,当处理节点接收到第二待处理业务日志时,可以首先获取第二待处理业务日志的键值,由于第二待处理业务日志和第一待处理业务日志均为第一业务产生的业务日志,所以第二待处理业务日志和第一待处理业务日志的键值相同,因此根据第二待处理业务日志的键值可以从临时缓存中获取到与第二待处理业务日志的键值对应的所述第一处理后日志数据。For example, the first processed log data can be stored in the temporary cache according to the key value of the first pending business log, and when the processing node receives the second pending business log, it can first obtain the second pending business log. The key value, since the second business log to be processed and the first business log to be processed are both business logs generated by the first business, the key value of the second business log to be processed and the first business log to be processed are the same, so according to the second For the key value of the business log to be processed, the first processed log data corresponding to the key value of the second business log to be processed can be obtained from the temporary cache.

进一步的,在根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据之前,还可以对所述第一待处理业务日志进行信息增强处理,获取第一增强待处理业务日志,然后根据所述第一增强待处理业务日志和所述日志数据,获取第一处理后日志数据。Further, before obtaining the first post-processing log data according to the first business log to be processed and the log data, information enhancement processing may also be performed on the first business log to be processed to obtain the first enhanced business log to be processed. business log, and then obtain the first post-processing log data according to the first enhanced business log to be processed and the log data.

示例的,用户办理业务时,为了提高业务办理时间,业务日志均由简要信息构成。假设用户办理宽带业务,产生的第一待处理业务日志中仅包括宽带账户,但是在第一待处理业务日志的处理过程中还可能用到用户的身份证信息,家庭地址信息等,这些信息均与宽带账号对应存储,在接收到第一待处理业务日志之后,根据宽带账号,可以将用户的身份证信息,家庭地址信息等补充进第一待处理业务日志,形成第一增强待处理业务日志。For example, when a user handles a business, in order to improve the business processing time, the business log is composed of brief information. Assuming that the user handles the broadband service, the generated first pending service log only includes the broadband account, but the user's ID card information, home address information, etc. may also be used during the processing of the first pending service log. It is stored corresponding to the broadband account. After receiving the first pending business log, according to the broadband account, the user's ID card information, home address information, etc. can be supplemented into the first pending business log to form the first enhanced pending business log. .

进一步的,在所述对所述第一待处理业务日志进行信息增强处理,获取第一增强待处理业务日志之前,还可以对所述第一待处理业务日志进行预处理,所述预处理包括日志信息格式规范化、空值、异常值检查。Further, before the information enhancement processing is performed on the first to-be-processed business log and the first enhanced to-be-processed business log is obtained, the first to-be-processed business log may also be preprocessed, and the preprocessing includes: Log information format normalization, null value, outlier checking.

示例的,假设用户办理宽带业务,产生多个业务日志,格式多种多样,有些业务日志包括5个字段,相邻字段间采用“/”隔开,有些业务日志包括4个字段,相邻字段间采用“|”隔开;有些业务日志的第一个字段是宽带账号,有些业务日志的第一个字段是乱码,但是日志处理系统仅能处理预设格式的业务日志,例如日志处理系统预设格式指示业务日志需要包括5个字段,相邻字段间采用“/”隔开,且第一个字段是宽带账号,最后一个字段为业务标识。在接收到第一待处理业务日志后,可以首先判断第一待处理业务日志是否满足预设格式,若第一待处理业务日志不满足预设格式,可以对第一待处理业务日志进行预处理,所述预处理包括日志信息格式规范化、空值、异常值检查,使得第一待处理业务日志能够被日志处理系统识别并处理。其中,日志信息格式规范化、空值、异常值检查等均为现有技术,本发明实施例在此不做赘述。As an example, suppose a user handles broadband services and generates multiple service logs in various formats. Some service logs include 5 fields, and adjacent fields are separated by "/", and some service logs include 4 fields, and adjacent fields are The first field of some business logs is the broadband account number, and the first field of some business logs is garbled, but the log processing system can only process business logs in a preset format. The format indicates that the service log needs to include 5 fields, and adjacent fields are separated by "/", and the first field is the broadband account number, and the last field is the service identifier. After receiving the first business log to be processed, it may be first determined whether the first business log to be processed satisfies the preset format, and if the first business log to be processed does not meet the preset format, the first business log to be processed may be preprocessed , the preprocessing includes log information format normalization, null value, and abnormal value checking, so that the first business log to be processed can be identified and processed by the log processing system. The normalization of the log information format, null value, abnormal value checking, etc. are all in the prior art, which are not repeated in this embodiment of the present invention.

本发明实施例提供了一种日志处理方法,应用于处理节点,包括:从数据缓存中获取第一待处理业务日志对应的日志数据;根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据;确定当前是否还有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据;若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于数据缓存;若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于临时缓存。相较于现有技术,由于可以根据不同的情况将第一处理后日志数据存储与数据缓存或临时缓存,实现了不同处理节点之间的信息共享,进而使得同一个业务产生的业务日志可以在不同的处理节点进行处理,从而可以为每个处理节点分配数量相同的业务日志,使得每个处理节点的负载均衡,提高了系统稳定性。An embodiment of the present invention provides a log processing method, which is applied to a processing node, including: acquiring log data corresponding to a first pending business log from a data cache; and according to the first pending business log and the log data, Obtain the first processed log data; determine whether other processing nodes currently access the log data corresponding to the first pending business log in the data cache; if no other processing nodes currently access the first log data in the data cache log data corresponding to the business log to be processed, store the first processed log data in the data cache; if other processing nodes currently access the log data corresponding to the first business log to be processed in the data cache, store the log data corresponding to the first business log to be processed in the data cache. The first processed log data is stored in a temporary cache. Compared with the prior art, since the first post-processing log data can be stored in a data cache or a temporary cache according to different situations, information sharing between different processing nodes is realized, so that the business logs generated by the same business can be stored in the data cache. Different processing nodes perform processing, so that the same number of business logs can be allocated to each processing node, so that the load of each processing node is balanced and the system stability is improved.

实施例二Embodiment 2

本发明实施例提供一种日志处理方法,应用于日志处理系统,如图2所示,所述日志处理系统至少包括收发节点,第一处理节点,第二处理节点,数据缓存节点,状态缓存节点,临时缓存节点和输出节点。具体的,如图3所示,所述日志处理系统包括:An embodiment of the present invention provides a log processing method, which is applied to a log processing system. As shown in FIG. 2 , the log processing system at least includes a transceiver node, a first processing node, a second processing node, a data cache node, and a state cache node. , temporary cache nodes and output nodes. Specifically, as shown in Figure 3, the log processing system includes:

步骤301、收发节点获取多个用户办理业务时产生的多个业务日志,执行步骤302。Step 301: The transceiver node acquires multiple service logs generated when multiple users handle services, and executes step 302.

示例的,收发节点可以接收到多个用户办理业务时产生的多个业务日志,即多个业务日志可以汇总至收发节点,并通过收发节点进行分配,保证各处理节点的负载均衡。For example, the transceiver node may receive multiple business logs generated when multiple users handle services, that is, multiple business logs may be aggregated to the transceiver node, and distributed through the transceiver node to ensure load balance of each processing node.

步骤302、收发节点对所述多个业务日志进行预处理,所述预处理包括日志信息格式规范化、空值、异常值检查,执行步骤303。Step 302: The transceiver node preprocesses the plurality of service logs, and the preprocessing includes log information format normalization, null value, and abnormal value checking, and step 303 is executed.

示例的,由于每个业务日志的形式不同,但是日志处理系统仅能处理预设格式的业务日志,因此在接收到多个业务日志后可以首先对各个业务日志进行预处理,所述预处理包括日志信息格式规范化、空值、异常值检查。具体的,收发节点的处理时间窗口包括条数窗口和时间窗口两种,若收发节点采用条数窗口处理业务日志,假设条数窗口的预设条数为100条,则每次收发节点可以获取100条业务日志进行预处理;若收发节点采用时间窗口处理业务日志,假设时间窗口的预设时间段为10秒(s),则收发节点可以将每10s获取的业务日志进行汇总,统一进行预处理。For example, since each business log has a different form, but the log processing system can only process business logs in a preset format, after receiving multiple business logs, each business log can be preprocessed first, and the preprocessing includes: Log information format normalization, null value, outlier checking. Specifically, the processing time window of the transceiver node includes two types: the number window and the time window. If the transceiver node uses the number window to process business logs, assuming that the preset number of the number window is 100, each time the transceiver node can obtain 100 business logs are preprocessed; if the sending and receiving nodes use a time window to process business logs, assuming that the preset time period of the time window is 10 seconds (s), the sending and receiving nodes can summarize the business logs obtained every 10s and pre-process them uniformly. deal with.

步骤303、收发节点将多个业务日志平均分配给每个处理节点,执行步骤304。Step 303: The sending and receiving nodes evenly distribute the multiple service logs to each processing node, and step 304 is executed.

示例的,为了保证每个处理节点的负载均衡,收发节点可以将多个业务日志平均分配给每个处理节点,或者也可以按照预估的计算量,为每个处理节点分配计算量相同的业务日志,本发明实施例对此不做限定。For example, in order to ensure the load balance of each processing node, the sending and receiving nodes can evenly allocate multiple business logs to each processing node, or can also allocate services with the same amount of calculation to each processing node according to the estimated amount of calculation. log, which is not limited in this embodiment of the present invention.

步骤304、第一处理节点对分配到的第一待处理业务日志进行信息增强处理,获取第一增强待处理业务日志,执行步骤305。Step 304 , the first processing node performs information enhancement processing on the assigned first service log to be processed, obtains the first enhanced service log to be processed, and executes step 305 .

示例的,由于第一待处理业务日志可能仅由简要信息构成,但是在对第一待处理业务日志进行处理时,可能会用到更加具体的信息,因此需要首先对第一待处理业务日志进行信息增强处理。例如,用户办理宽带业务,产生的第一待处理业务日志中仅包括宽带账户,但是在第一待处理业务日志的处理过程中还可能用到用户的身份证信息,家庭地址信息等,这些信息均与宽带账号对应存储,第一处理节点在接收到第一待处理业务日志之后,根据宽带账号,可以将用户的身份证信息,家庭地址信息等补充进第一待处理业务日志,形成第一增强待处理业务日志。For example, since the first business log to be processed may only consist of brief information, more specific information may be used when processing the first business log to be processed. Information augmentation processing. For example, when a user handles a broadband service, the generated first pending service log only includes the broadband account, but the user's ID card information, home address information, etc. may also be used in the processing of the first pending service log. Both are stored corresponding to the broadband account. After receiving the first pending business log, the first processing node can supplement the user's ID card information, home address information, etc. into the first pending business log according to the broadband account to form the first pending business log. Enhanced pending business logs.

步骤305、第一处理节点获取第一增强待处理业务日志的键值,执行步骤306。Step 305 , the first processing node obtains the key value of the first enhanced service log to be processed, and executes step 306 .

示例的,所述第一增强待处理业务日志的键值可以包括第一待处理业务日志对应的业务标识,第一待处理业务日志对应的用户标识等信息。For example, the key value of the first enhanced service log to be processed may include information such as a service identifier corresponding to the first service log to be processed, a user identifier corresponding to the first service log to be processed, and the like.

步骤306、第一处理节点将第一增强待处理业务日志的键值发送给数据缓存节点,执行步骤307。Step 306: The first processing node sends the key value of the first enhanced service log to be processed to the data cache node, and step 307 is executed.

示例的,数据缓存节点可以为日志处理系统中的存储器,用以按照不同的键值存储多个业务最新的日志数据。For example, the data cache node may be a memory in the log processing system, used to store the latest log data of multiple services according to different key values.

步骤307、数据缓存节点将键值对应的日志数据发送给所述第一处理节点,执行步骤308。发送键值对应的日志数据Step 307: The data cache node sends the log data corresponding to the key value to the first processing node, and step 308 is executed. Send the log data corresponding to the key value

示例的,数据缓存节点在本地存储的信息中查询与所述键值对应的日志数据,然后将该日志数据发送给所述第一处理节点。Exemplarily, the data cache node queries locally stored information for log data corresponding to the key value, and then sends the log data to the first processing node.

步骤308、数据缓存节点将所述键值发送给状态缓存节点,执行步骤309。Step 308: The data cache node sends the key value to the state cache node, and step 309 is executed.

示例的,状态缓存节点可以为日志处理系统中的存储器,用以存储每个日志数据的访问数,从访问数即可看出日志数据当前是否同时被多个处理节点访问。在数据缓存节点将第一增强待处理业务日志的键值对应的日志数据发送给所述第一处理节点后,说明当前第一处理节点正在访问第一增强待处理业务日志的键值对应的日志数据,因此数据缓存节点将所述键值发送给状态缓存节点,以便于状态缓存节点更新第一增强待处理业务日志的键值对应的日志数据的访问数。For example, the state cache node may be a memory in the log processing system, which is used to store the access count of each log data. From the access count, it can be seen whether the log data is currently accessed by multiple processing nodes at the same time. After the data cache node sends the log data corresponding to the key value of the first enhanced service log to be processed to the first processing node, it indicates that the first processing node is currently accessing the log corresponding to the key value of the first enhanced service log to be processed Therefore, the data cache node sends the key value to the state cache node, so that the state cache node can update the access number of the log data corresponding to the key value of the first enhanced service log to be processed.

步骤309、状态缓存节点对所述键值对应的日志数据访问状态进行更新,使得所述日志数据的访问数加1,执行步骤310。Step 309: The state cache node updates the log data access state corresponding to the key value, so that the access number of the log data is incremented by 1, and step 310 is executed.

示例的,若当前仅有第一处理节点访问第一增强待处理业务日志的键值对应的日志数据,则更新后该日志数据的访问数为1。For example, if currently only the first processing node accesses the log data corresponding to the key value of the first enhanced service log to be processed, the number of accesses to the log data after the update is 1.

步骤310、第一处理节点对第一增强待处理业务日志和键值对应的日志数据进行上下文关联处理,获取第一处理后日志数据,执行步骤311。Step 310: The first processing node performs context association processing on the first enhanced service log to be processed and the log data corresponding to the key value, obtains the first processed log data, and executes step 311.

示例的,可以计算第一增强待处理业务日志和所述键值对应的日志数据的汇总信息,包括计算日志数、最新记录、最大值、最小值、并集区间等,本发明实施例对此不做限定。For example, the summary information of the first enhanced service log to be processed and the log data corresponding to the key value may be calculated, including the number of calculated logs, the latest record, the maximum value, the minimum value, the union interval, etc. Not limited.

步骤311、第一处理节点将所述键值发送给状态缓存节点,执行步骤312。Step 311: The first processing node sends the key value to the state cache node, and step 312 is executed.

示例的,当第一处理节点处理完成之后,表示第一处理节点已经不需要访问数据缓存中第一增强待处理业务日志对应的日志数据,因此可以将第一增强待处理业务日志的键值发送给状态缓存节点,以便于状态缓存节点更新第一增强待处理业务日志的键值对应的日志数据的访问数。For example, after the first processing node completes the processing, it indicates that the first processing node no longer needs to access the log data corresponding to the first enhanced service log to be processed in the data cache, so the key value of the first enhanced service log to be processed can be sent. To the state cache node, so that the state cache node can update the access number of the log data corresponding to the key value of the first enhanced service log to be processed.

步骤312、状态缓存节点对所述键值对应的日志数据访问状态进行更新,使得所述日志数据的访问数减1,执行步骤313。Step 312 , the state cache node updates the log data access state corresponding to the key value, so that the access number of the log data is decremented by 1, and step 313 is executed.

示例的,若当前仅有第一处理节点访问该日志数据,则更新后该日志数据的访问数为0。若当前还有其他处理节点访问该日志数据,则更新后该日志数据的访问数不为0。For example, if currently only the first processing node accesses the log data, the number of accesses to the log data after the update is 0. If there are currently other processing nodes accessing the log data, the number of accesses to the log data after the update is not 0.

步骤313、状态缓存节点将所述键值对应的日志数据的访问数发送给所述第一处理节点,执行步骤314。Step 313: The state cache node sends the access number of the log data corresponding to the key value to the first processing node, and step 314 is executed.

示例的,状态缓存节点将更新后该日志数据的访问数发送给所述第一处理节点,以便于第一处理节点确定是否有其他处理节点访问该日志数据。For example, the state cache node sends the updated access number of the log data to the first processing node, so that the first processing node can determine whether other processing nodes access the log data.

步骤314、第一处理节点确定键值对应的日志数据的访问数是否为0;若所述键值对应的日志数据的访问数为0,执行步骤315;若所述键值对应的日志数据的访问数不为0,执行步骤316。Step 314: The first processing node determines whether the access number of the log data corresponding to the key value is 0; if the access number of the log data corresponding to the key value is 0, perform step 315; If the access count is not 0, step 316 is executed.

示例的,若所述键值对应的日志数据的访问数为0,说明当前仅有第一处理节点访问该日志数据;若所述键值对应的日志数据的访问数不为0,说明还有其他处理节点访问该日志数据。For example, if the access number of the log data corresponding to the key value is 0, it means that currently only the first processing node accesses the log data; if the access number of the log data corresponding to the key value is not 0, it means that there are Other processing nodes access this log data.

步骤315、第一处理节点将第一处理后日志数据存储在数据缓存节点,执行步骤325。Step 315: The first processing node stores the first processed log data in the data cache node, and step 325 is executed.

示例的,当仅有第一处理节点访问该日志数据时,说明替换第一待处理业务日志对应的日志数据不会影响其他处理节点的处理进程,因此可以直接将所述第一处理后日志数据存储于数据缓存。For example, when only the first processing node accesses the log data, it means that replacing the log data corresponding to the first pending business log will not affect the processing process of other processing nodes, so the first processed log data can be directly Stored in the data cache.

步骤316、第一处理节点将第一处理后日志数据存储在临时缓存节点,执行步骤317。Step 316 , the first processing node stores the first processed log data in the temporary cache node, and executes step 317 .

示例的,当还有其他处理节点访问该日志数据时,说明替换第一待处理业务日志对应的日志数据可能会影响其他处理节点的处理进程,使得其他处理节点无法获取到相关信息,因此可以将第一处理后日志数据存储于临时缓存。For example, when there are other processing nodes accessing the log data, it means that replacing the log data corresponding to the first pending business log may affect the processing process of other processing nodes, so that other processing nodes cannot obtain relevant information. The log data after the first processing is stored in a temporary cache.

步骤317、第二处理节点对分配到的第二待处理业务日志进行信息增强处理,获取第二增强待处理业务日志,执行步骤318。Step 317 , the second processing node performs information enhancement processing on the assigned second service log to be processed, obtains the second enhanced service log to be processed, and executes step 318 .

示例的,由于同一个业务的业务日志可能同时分配给多个处理节点进行处理,因此第二处理节点与第一处理节点可能处理的均为同一个业务的业务日志。假设第二处理节点对分配到的同一业务的另一个业务日志,即第二待处理业务日志,同样的,可以按照上述方法对第二待处理业务日志进行信息增强处理。For example, since the service log of the same service may be simultaneously allocated to multiple processing nodes for processing, the second processing node and the first processing node may both process the service log of the same service. Assuming that the second processing node performs information enhancement processing on another service log of the same service assigned, that is, the second service log to be processed, similarly, the second service log to be processed can be enhanced according to the above method.

步骤318、第二处理节点获取第二增强待处理业务日志的键值,执行步骤319。Step 318 , the second processing node acquires the key value of the second enhanced service log to be processed, and executes step 319 .

示例的,由于第二待处理业务日志和第一待处理业务日志为同一业务产生的业务日志,所以第二待处理业务日志的键值和第一待处理业务日志的键值相同。For example, since the second business log to be processed and the first business log to be processed are business logs generated by the same business, the key value of the second business log to be processed is the same as the key value of the first business log to be processed.

步骤319、第二处理节点将所述键值发送给数据缓存节点和临时缓存节点,执行步骤320。Step 319: The second processing node sends the key value to the data cache node and the temporary cache node, and step 320 is executed.

示例的,为了获取到对应业务的最新日志数据,因此可以将第二待处理业务日志的键值同时发给数据缓存节点和临时缓存节点,以便于获取所需信息。For example, in order to obtain the latest log data of the corresponding service, the key value of the second service log to be processed may be sent to the data cache node and the temporary cache node at the same time, so as to obtain the required information.

步骤320、数据缓存节点将所述键值对应的日志数据发送给所述第二处理节点,执行步骤321。Step 320: The data cache node sends the log data corresponding to the key value to the second processing node, and step 321 is executed.

示例的,数据缓存节点按照第二待处理业务日志的键值查询本地存储的信息,获取与该键值对应的日志数据发送给第二处理节点。For example, the data cache node queries locally stored information according to the key value of the second service log to be processed, obtains log data corresponding to the key value, and sends it to the second processing node.

步骤321、临时缓存节点将所述键值对应的第一处理后日志数据发送给所述第二处理节点,执行步骤322。Step 321: The temporary cache node sends the first processed log data corresponding to the key value to the second processing node, and step 322 is executed.

示例的,临时缓存节点中按照键值存储有多个日志数据,在接收到第二待处理业务日志的键值后,可以按照该键值查询本地存储的信息,获取与该键值对应的日志数据发送给第二处理节点。For example, the temporary cache node stores multiple log data according to the key value. After receiving the key value of the second pending business log, the information stored locally can be queried according to the key value, and the log corresponding to the key value can be obtained. The data is sent to the second processing node.

步骤322、第二处理节点对所述第二增强待处理业务日志、所述键值对应的日志数据和所述第一处理后日志数据进行上下文关联处理,获取第二处理后日志数据,执行步骤323。Step 322: The second processing node performs contextual association processing on the second enhanced service log to be processed, the log data corresponding to the key value, and the first processed log data, obtains the second processed log data, and executes the steps 323.

示例的,可以计算第二增强待处理业务日志、所述键值对应的日志数据和所述第一处理后日志数据的汇总信息,包括计算日志数、最新记录、最大值、最小值、并集区间等,本发明实施例对此不做限定。For example, the second enhanced service log to be processed, the log data corresponding to the key value, and the summary information of the first processed log data can be calculated, including the number of calculated logs, the latest record, the maximum value, the minimum value, and the union. interval, etc., which are not limited in this embodiment of the present invention.

步骤323、第二处理节点将所述第二处理后日志数据发送给数据缓存节点,替换所述数据缓存节点中所述键值对应的日志数据,执行步骤324。Step 323: The second processing node sends the second processed log data to the data cache node, replaces the log data corresponding to the key value in the data cache node, and executes step 324.

示例的,第二处理后日志数据为对应业务当前最新的日志数据,因此第二处理节点可以将所述第二处理后日志数据发送给数据缓存节点,以便于所述数据缓存节点进行存储。Exemplarily, the second processed log data is the current latest log data of the corresponding service, so the second processing node may send the second processed log data to the data cache node, so that the data cache node can store it.

步骤324、数据缓存节点采用所述第二处理后日志数据替换所述数据缓存节点中所述键值对应的日志数据。Step 324: The data cache node replaces the log data corresponding to the key value in the data cache node with the second processed log data.

示例的,在数据缓存节点采用所述第二处理后日志数据替换所述数据缓存节点中所述键值对应的日志数据之后,输出节点还可以将数据缓存节点中的最新的日志处理结果输出,可以输出到日志文件、日志数据库或其他系统,本发明实施例对此不做限定。Exemplarily, after the data cache node replaces the log data corresponding to the key value in the data cache node with the second processed log data, the output node may also output the latest log processing result in the data cache node, It may be output to a log file, a log database, or other systems, which is not limited in this embodiment of the present invention.

需要说明的是,本发明实施例提供的日志处理方法步骤的先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本发明的保护范围之内,因此不再赘述。It should be noted that the order of steps of the log processing method provided by the embodiment of the present invention can be appropriately adjusted, and the steps can also be increased or decreased according to the situation. Variations of methods that can be easily imagined should all be included within the protection scope of the present invention, and thus will not be described again.

本发明实施例提供了一种日志处理方法,相较于现有技术,由于可以根据不同的情况将第一处理后日志数据存储与数据缓存或临时缓存,实现了不同处理节点之间的信息共享,进而使得同一个业务产生的业务日志可以在不同的处理节点进行处理,从而可以为每个处理节点分配数量相同的业务日志,使得每个处理节点的负载均衡,提高了系统稳定性。The embodiment of the present invention provides a log processing method. Compared with the prior art, since the first processed log data can be stored in a data cache or a temporary cache according to different situations, information sharing between different processing nodes is realized. , so that the business logs generated by the same business can be processed on different processing nodes, so that the same number of business logs can be allocated to each processing node, so that the load of each processing node is balanced and the system stability is improved.

实施例三Embodiment 3

本发明实施例提供一种日志处理装置40,如图4所示,包括:An embodiment of the present invention provides a log processing apparatus 40, as shown in FIG. 4, including:

第一获取单元401,用于从数据缓存中获取第一待处理业务日志对应的日志数据。The first obtaining unit 401 is configured to obtain log data corresponding to the first service log to be processed from the data cache.

第二获取单元402,用于根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据。The second obtaining unit 402 is configured to obtain first processed log data according to the first service log to be processed and the log data.

确定单元403,用于确定当前是否还有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据。The determining unit 403 is configured to determine whether there are other processing nodes currently accessing log data corresponding to the first to-be-processed service log in the data cache.

存储单元404,用于若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于数据缓存;若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于临时缓存。The storage unit 404 is configured to store the first processed log data in the data cache if no other processing node currently accesses the log data corresponding to the first pending business log in the data cache; if other processing nodes currently exist The node accesses log data corresponding to the first service log to be processed in the data cache, and stores the first processed log data in the temporary cache.

这样一来,由于可以根据不同的情况将第一处理后日志数据存储与数据缓存或临时缓存,实现了不同处理节点之间的信息共享,进而使得同一个业务产生的业务日志可以在不同的处理节点进行处理,从而可以为每个处理节点分配数量相同的业务日志,使得每个处理节点的负载均衡,提高了系统稳定性。In this way, since the first processed log data can be stored with the data cache or temporary cache according to different situations, information sharing between different processing nodes is realized, so that the business logs generated by the same business can be processed in different The nodes are processed, so that the same number of business logs can be allocated to each processing node, so that the load of each processing node is balanced and the system stability is improved.

可选的,如图5所示,所述装置40还包括:第三获取单元405,用于从所述数据缓存中获取第二待处理业务日志对应的日志数据;第四获取单元406,用于从所述临时缓存中获取所述第一处理后日志数据;第五获取单元407,用于根据所述第二待处理业务日志、所述第二待处理业务日志对应的日志数据和所述第一处理后日志数据,获取第二处理后日志数据。Optionally, as shown in FIG. 5 , the apparatus 40 further includes: a third obtaining unit 405, configured to obtain log data corresponding to the second service log to be processed from the data cache; a fourth obtaining unit 406, using to obtain the log data after the first processing from the temporary cache; the fifth obtaining unit 407 is configured to obtain the log data corresponding to the second business log to be processed, the log data corresponding to the second business log to be processed, and the The first processed log data is obtained, and the second processed log data is obtained.

可选的,所述第四获取单元406具体用于:根据所述第二待处理业务日志的键值,从所述临时缓存中获取与所述键值对应的所述第一处理后日志数据。Optionally, the fourth obtaining unit 406 is specifically configured to: obtain the first processed log data corresponding to the key value from the temporary cache according to the key value of the second to-be-processed business log .

可选的,如图6所示,所述装置40还包括:增强单元408,用于对所述第一待处理业务日志进行信息增强处理,获取第一增强待处理业务日志;所述第二获取单元402具体用于:根据所述第一增强待处理业务日志和所述日志数据,获取第一处理后日志数据。Optionally, as shown in FIG. 6 , the apparatus 40 further includes: an enhancement unit 408, configured to perform information enhancement processing on the first to-be-processed service log to obtain the first enhanced to-be-processed service log; the second The obtaining unit 402 is specifically configured to: obtain the first processed log data according to the first enhanced service log to be processed and the log data.

可选的,如图7所示,所述装置40还包括:预处理单元409,用于对所述第一待处理业务日志进行预处理,所述预处理包括日志信息格式规范化、空值、异常值检查。Optionally, as shown in FIG. 7 , the apparatus 40 further includes: a preprocessing unit 409, configured to preprocess the first to-be-processed business log, and the preprocessing includes log information format normalization, null value, Outlier checking.

需要说明是,第一,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。It should be noted that, first, those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the above-described devices and units may refer to the corresponding processes in the foregoing method embodiments, which are not described here. Repeat.

第二,所述第一获取单元401、第二获取单元402、确定单元403、第三获取单元405、第四获取单元406、第五获取单元407、增强单元408和预处理单元409均可由位于日志处理装置40中的中央处理器(Central Processing Unit,CPU)、微处理器(Micro ProcessorUnit,MPU)、数字信号处理器(Digital Signal Processor,DSP)、或现场可编程门阵列(Field Programmable Gate Array,FPGA)等实现。存储单元404可由位于日志处理装置40中的存储器实现。Second, the first obtaining unit 401 , the second obtaining unit 402 , the determining unit 403 , the third obtaining unit 405 , the fourth obtaining unit 406 , the fifth obtaining unit 407 , the enhancing unit 408 and the preprocessing unit 409 can all be located in A central processing unit (Central Processing Unit, CPU), a microprocessor (Micro Processor Unit, MPU), a digital signal processor (Digital Signal Processor, DSP), or a field programmable gate array (Field Programmable Gate Array) in the log processing device 40 , FPGA) etc. The storage unit 404 may be implemented by a memory located in the log processing device 40 .

本发明实施例提供一种日志处理装置,包括:第一获取单元,用于从数据缓存中获取第一待处理业务日志对应的日志数据。第二获取单元,用于根据所述第一待处理业务日志和所述日志数据,获取第一处理后日志数据。确定单元,用于确定当前是否还有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据。存储单元,用于若当前没有其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于数据缓存;若当前存在其他处理节点访问所述数据缓存中所述第一待处理业务日志对应的日志数据,将所述第一处理后日志数据存储于临时缓存。相较于现有技术,由于可以根据不同的情况将第一处理后日志数据存储与数据缓存或临时缓存,实现了不同处理节点之间的信息共享,进而使得同一个业务产生的业务日志可以在不同的处理节点进行处理,从而可以为每个处理节点分配数量相同的业务日志,使得每个处理节点的负载均衡,提高了系统稳定性。An embodiment of the present invention provides a log processing apparatus, including: a first obtaining unit, configured to obtain log data corresponding to a first service log to be processed from a data cache. A second obtaining unit, configured to obtain first processed log data according to the first to-be-processed service log and the log data. A determination unit, configured to determine whether there are other processing nodes currently accessing log data corresponding to the first service log to be processed in the data cache. A storage unit, configured to store the first processed log data in the data cache if no other processing node currently accesses the log data corresponding to the first to-be-processed business log in the data cache; if other processing nodes currently exist The log data corresponding to the first to-be-processed business log in the data cache is accessed, and the first processed log data is stored in the temporary cache. Compared with the prior art, since the first post-processing log data can be stored in a data cache or a temporary cache according to different situations, information sharing between different processing nodes is realized, so that the business logs generated by the same business can be stored in the data cache. Different processing nodes perform processing, so that the same number of business logs can be allocated to each processing node, so that the load of each processing node is balanced and the system stability is improved.

本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the invention may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied therein, including but not limited to disk storage, optical storage, and the like.

本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flows of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.

Claims (10)

1. A log processing method is applied to a processing node and comprises the following steps:
acquiring log data corresponding to a first service log to be processed from a data cache;
acquiring first processed log data according to the first service log to be processed and the log data;
determining whether other processing nodes access log data corresponding to the first service log to be processed in the data cache or not;
if no other processing node accesses the log data corresponding to the first service log to be processed in the data cache, storing the first processed log data in the data cache; and if other processing nodes access the log data corresponding to the first service log to be processed in the data cache, storing the first processed log data in a temporary cache.
2. The method of claim 1, wherein after storing the first processed log data in a temporary cache, the method further comprises:
acquiring log data corresponding to a second service log to be processed from the data cache;
obtaining the first processed log data from the temporary cache;
and acquiring second processed log data according to the second service log to be processed, the log data corresponding to the second service log to be processed and the first processed log data.
3. The method of claim 2, wherein the retrieving the first processed log data from the temporary cache comprises:
and acquiring the first processed log data corresponding to the key value from the temporary cache according to the key value of the second service log to be processed.
4. The method according to claim 1 or 2, wherein before obtaining first processed log data according to the first service log to be processed and the log data, the method further comprises:
performing information enhancement processing on the first service log to be processed to obtain a first enhanced service log to be processed;
the obtaining of the first processed log data according to the first to-be-processed service log and the log data includes:
and acquiring first processed log data according to the first enhanced service log to be processed and the log data.
5. The method according to claim 4, wherein before the performing information enhancement processing on the first service log to be processed and obtaining the first enhanced service log to be processed, the method further comprises:
and preprocessing the first service log to be processed, wherein the preprocessing comprises log information format standardization, null value and abnormal value detection.
6. A log processing apparatus, comprising:
the first acquisition unit is used for acquiring log data corresponding to a first service log to be processed from the data cache;
a second obtaining unit, configured to obtain first processed log data according to the first to-be-processed service log and the log data;
a determining unit, configured to determine whether there are other processing nodes accessing log data corresponding to the first to-be-processed service log in the data cache currently;
the storage unit is used for storing the first processed log data in the data cache if no other processing node accesses the log data corresponding to the first to-be-processed service log in the data cache currently; and if other processing nodes access the log data corresponding to the first service log to be processed in the data cache, storing the first processed log data in a temporary cache.
7. The apparatus of claim 6, further comprising:
a third obtaining unit, configured to obtain log data corresponding to a second service log to be processed from the data cache;
a fourth obtaining unit, configured to obtain the first processed log data from the temporary cache;
and a fifth obtaining unit, configured to obtain second processed log data according to the second service log to be processed, the log data corresponding to the second service log to be processed, and the first processed log data.
8. The apparatus according to claim 7, wherein the fourth obtaining unit is specifically configured to:
and acquiring the first processed log data corresponding to the key value from the temporary cache according to the key value of the second service log to be processed.
9. The apparatus of claim 6 or 7, further comprising:
the enhancement unit is used for performing information enhancement processing on the first service log to be processed to obtain a first enhanced service log to be processed;
the second obtaining unit is specifically configured to:
and acquiring first processed log data according to the first enhanced service log to be processed and the log data.
10. The apparatus of claim 9, further comprising:
and the preprocessing unit is used for preprocessing the first service log to be processed, and the preprocessing comprises log information format normalization, null value and abnormal value detection.
CN201610273047.4A 2016-04-27 2016-04-27 A log processing method and device Active CN107315756B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610273047.4A CN107315756B (en) 2016-04-27 2016-04-27 A log processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610273047.4A CN107315756B (en) 2016-04-27 2016-04-27 A log processing method and device

Publications (2)

Publication Number Publication Date
CN107315756A CN107315756A (en) 2017-11-03
CN107315756B true CN107315756B (en) 2020-11-27

Family

ID=60185522

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610273047.4A Active CN107315756B (en) 2016-04-27 2016-04-27 A log processing method and device

Country Status (1)

Country Link
CN (1) CN107315756B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111932235B (en) * 2019-05-13 2024-04-19 中国移动通信集团湖北有限公司 Service processing method, data accessor, state manager and computing device
CN111198850A (en) * 2019-12-14 2020-05-26 深圳猛犸电动科技有限公司 Log message processing method and device and Internet of things platform
CN111782610B (en) * 2020-06-03 2024-03-22 中移(杭州)信息技术有限公司 Log processing method, device, server, system network and storage medium
CN113485661B (en) * 2021-07-01 2023-08-22 深圳市同泰怡信息技术有限公司 Four-way server and method for outputting log information thereof
CN113869717A (en) * 2021-09-26 2021-12-31 杭州安恒信息安全技术有限公司 Analysis and study method, device, equipment and storage medium for alarm log
US12362941B2 (en) * 2023-03-06 2025-07-15 Verizon Patent And Licensing Inc. Systems and methods for distributed ledger migration

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361291A (en) * 2014-10-15 2015-02-18 网神信息技术(北京)股份有限公司 Data processing method and device
CN104598459A (en) * 2013-10-30 2015-05-06 阿里巴巴集团控股有限公司 Database processing method and system and data access method and system
CN105138615A (en) * 2015-08-10 2015-12-09 北京思特奇信息技术股份有限公司 Method and system for building big data distributed log

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10817500B2 (en) * 2014-03-13 2020-10-27 Sybase, Inc. Reduce log contention by batching log record transfers to the log

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104598459A (en) * 2013-10-30 2015-05-06 阿里巴巴集团控股有限公司 Database processing method and system and data access method and system
CN104361291A (en) * 2014-10-15 2015-02-18 网神信息技术(北京)股份有限公司 Data processing method and device
CN105138615A (en) * 2015-08-10 2015-12-09 北京思特奇信息技术股份有限公司 Method and system for building big data distributed log

Also Published As

Publication number Publication date
CN107315756A (en) 2017-11-03

Similar Documents

Publication Publication Date Title
CN107315756B (en) A log processing method and device
CN108920272B (en) Data processing method, device, computer equipment and storage medium
CN113487427B (en) Transaction risk identification method, device and system
CN110704231A (en) A fault handling method and device
CN110471821A (en) Abnormal alteration detection method, server and computer readable storage medium
US10680902B2 (en) Virtual agents for facilitation of network based storage reporting
CN105447046A (en) Distributed system data consistency processing method, device and system
CN112905323B (en) Data processing method, device, electronic equipment and storage medium
JP6207451B2 (en) Sensor data collection system
CN114595127B (en) Log exception processing method, device, equipment and storage medium
CN114842568A (en) Intelligent inspection method, device, equipment and storage medium
US20140181174A1 (en) Distributed processing of stream data on an event protocol
CN115049493B (en) Blockchain data tracking method, device and electronic device
CN102571475B (en) The mutual monitoring system of safety information based on data analysis and method
CN118153245B (en) Distributed computing gas pipeline simulation method, equipment and medium
WO2016095716A1 (en) Fault information processing method and related device
CN113127327B (en) Test method and device for performance test
US10409704B1 (en) Systems and methods for resource utilization reporting and analysis
US12015532B2 (en) Component-based risk evaluation techniques using processing flow signatures
CN104253847B (en) A kind of data interactive method and device
CN107818522B (en) User power condition query method and terminal equipment
CN111159009A (en) Pressure testing method and device for log service system
CN116578911A (en) Data processing method, device, electronic device and computer storage medium
CN107135191B (en) Method and device for checking integrity of distributed business processing
CN111506446B (en) Interface fault detection method and server

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