WO2017173969A1 - 一种基于日志分析的故障定位方法及装置 - Google Patents

一种基于日志分析的故障定位方法及装置 Download PDF

Info

Publication number
WO2017173969A1
WO2017173969A1 PCT/CN2017/079319 CN2017079319W WO2017173969A1 WO 2017173969 A1 WO2017173969 A1 WO 2017173969A1 CN 2017079319 W CN2017079319 W CN 2017079319W WO 2017173969 A1 WO2017173969 A1 WO 2017173969A1
Authority
WO
WIPO (PCT)
Prior art keywords
log
data
error
field data
fault
Prior art date
Application number
PCT/CN2017/079319
Other languages
English (en)
French (fr)
Inventor
梁建明
熊飞
陈明宇
张雲瑞
罗忠明
Original Assignee
广州广电运通金融电子股份有限公司
广州广电运通信息科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州广电运通金融电子股份有限公司, 广州广电运通信息科技有限公司 filed Critical 广州广电运通金融电子股份有限公司
Publication of WO2017173969A1 publication Critical patent/WO2017173969A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24575Query processing with adaptation to user needs using context

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a fault location method and apparatus based on log analysis.
  • the embodiment of the invention provides a fault location method and device based on log analysis, which can effectively improve the efficiency of fault location.
  • the embodiment of the invention provides a fault location method based on log analysis, including:
  • the log data link table is detected to locate the fault location.
  • the extracting the field data from the tracking log, the communication log, and the scheduling log specifically includes:
  • the detecting the log data link table to locate the fault location includes:
  • the fault location is located according to the error log data.
  • the field data includes a log level
  • Determining, by one by one, whether each field data in the log data link table is error log data specifically includes:
  • the method further includes:
  • the data in the marked data location is saved in the fault report.
  • the embodiment of the present invention further provides a fault location device based on log analysis, including:
  • a reading module configured to read a tracking log, a communication log, and a scheduling log of the device to be detected
  • An extracting module configured to extract field data from the tracking log, the communication log, and the scheduling log, respectively;
  • a merge module configured to merge the extracted field data having the same time into a log data linked list
  • the positioning module is configured to detect the log data link table and locate the fault location.
  • extracting module specifically includes:
  • a matching unit configured to perform keyword matching on the tracking log, the communication log, and the scheduling log
  • An extracting unit configured to extract, from the tracking log, the communication log, and the scheduling log, respectively, when the tracking log, the communication log, and the scheduling log are successfully matched Matching field data.
  • the positioning module specifically includes:
  • a determining unit configured to determine, by one by one, whether each field data in the log data linked list is error log data
  • a positioning unit configured to locate a fault location according to the error log data if it is determined that the field data is error log data.
  • the field data includes a log level
  • the determining unit is specifically configured to determine whether the log level of each field data in the log data link table is an error level one by one; if the log level of the field data is an error level, determine that the field data is error log data. .
  • the fault location device further includes:
  • a marking module configured to mark a data location of the error log data and a data location of field data adjacent to the error log data in the log data linked list;
  • a save module for saving data in the data location of the tag in the fault report.
  • the fault locating method and device based on log analysis can schedule communication of the device to be detected
  • the scheduling log that is, the tracking log, the communication log, and the scheduling log, and the log data link table generated by the combination are automatically detected to quickly locate the fault location of the device to be detected, thereby improving the processing efficiency of the device maintenance, thereby improving user satisfaction;
  • the error log data and its adjacent field data in the log data link table are saved in the fault report for the technician to analyze the fault.
  • FIG. 1 is a schematic diagram of fault location based on log analysis provided by the present invention
  • FIG. 2 is a schematic flowchart diagram of an embodiment of a fault analysis method based on log analysis provided by the present invention
  • FIG. 3 is a schematic diagram of a field data format of a communication log, a trace log, a schedule log, and a log data link table provided by the present invention
  • FIG. 4 is a schematic diagram of a specific process of the fault location method based on log analysis shown in FIG. 2;
  • FIG. 5 is a schematic structural diagram of an embodiment of a fault analysis apparatus based on log analysis provided by the present invention.
  • FIG. 6 is another schematic structural diagram of the log analysis based fault location device shown in FIG. 5.
  • FIG. 1 it is a schematic diagram of fault location based on log analysis provided by the present invention.
  • the application 201 indirectly exchanges data with the communication service process 204 through the communication channel 203 by calling the relevant interface of the communication component interface 202 to achieve the process of controlling the hardware device 205 to be detected. Since the process has more complex call relationship logic, it is necessary to record the trace log 206 when the application 201 calls the communication component interface 202, record the communication log 207 that the application 201 interacts with the hardware device 205, and record the internal scheduling of the communication service process 204. Scheduling log 208 of the logical process.
  • the tracking log 206 is mainly for providing an analysis logic basis for invoking the ingress and calling the egress; the communication log 207 is mainly for providing an analysis process of the interaction process with the hardware device 205 and the device state; the scheduling log 208 is mainly for providing interaction with the hardware device 205. Analysis basis.
  • the log analysis module 209 composes the trace log 206, the communication log 207, and the schedule log 208 into a log data link table, and analyzes the log data link table to generate a fault report 210.
  • FIG. 2 is a schematic flowchart of an embodiment of a fault analysis method based on log analysis provided by the present invention, including:
  • the loading thread (including the child thread A, the child thread B, and the child thread C) is started.
  • the child thread A is used to process the communication log
  • the child thread B is used to process the tracking log
  • the child thread C is used to process the scheduling log.
  • the child thread A loads the communication log, reads the data of the communication log in the form of text into the memory, and extracts the field data from the communication log, and stores it in the data buffer list A
  • the child thread B loads the trace log, and the text is in the form of text.
  • the data of the trace log is read into the memory, and the field data is extracted from the trace log and stored in the data buffer list B; the child thread C loads the schedule log, and reads the data of the schedule log in the form of text into the memory, and Field data is extracted from the schedule log and stored in the data buffer list C. It is judged whether the data buffer list A, the data buffer list B, and the data buffer list C are empty. If it is empty, the detection state is exited. If not, the data buffer list A, the data buffer list B, and the data buffer list C are excluded.
  • the field data is merged with time as a key, that is, the field data of the data buffer list A, the data buffer list B, and the data buffer list C having the same time are combined, and a log data link table of the log time event data format is generated and stored.
  • the data is buffered in list D.
  • the data in the data cache list D is detected, thereby quickly identifying the fault location, improving the processing efficiency of the device maintenance, thereby improving user satisfaction.
  • the extracting the field data from the tracking log, the communication log, and the scheduling log specifically includes:
  • the field data format D1 of the communication log is year year, month month, day day, hour hour, minute minute, second second, millisecond msec, module name module, log level level, data item data (thread) Tid and binary data bin);
  • trace log field data format D2 is year year, month month, day day, hour hour, minute minute, second second, millisecond msec, module name module, log level level, data item data (thread tid And log information info);
  • the field data format D3 of the schedule log is year year, month month, day day, hour hour, minute minute, second second, millisecond msec, module name module, log level level, data item data (thread tid and Log information info).
  • the regular expression is used to match the tracking log, the communication log, and the scheduling log.
  • the tracking log, the communication log, and the scheduling log can match the corresponding keywords, the tracking log, the communication log, and the scheduling log are respectively taken.
  • Field data with its corresponding format is extracted. Further, the detecting the log data link table to locate the fault location includes:
  • the fault location is located according to the error log data.
  • the field data includes a log level
  • Determining, by one by one, whether each field data in the log data link table is error log data specifically includes:
  • the field data format D4 of the merged log data link table is year year, month month, day day, hour hour, minute minute, second second, millisecond msec, module name module, log level.
  • Level data item data (source log format category type, thread tid, and log information info).
  • the log level is divided into information (info), alarm (warning), error (error), and system (system).
  • the source log format category is divided into a communication log format, a trace log format, and a scheduling log format.
  • the method further includes:
  • the data in the marked data location is saved in the fault report.
  • the data location of the error log data is marked, and the field data adjacent to the error log data is searched according to the data location, that is, the context in the instruction process, and the adjacent The data location of the field data.
  • the data in the marked data location is extracted to generate a fault report.
  • the fault list lists the context of the faulty module and the process of sending and receiving data and the context of the faulty module under normal circumstances and the process of sending and receiving data, for the technician to analyze the fault.
  • FIG. 4 it is a specific process diagram of the log analysis-based fault location method shown in FIG. 2, including:
  • Start a loading thread that is, respectively start a sub-thread A for processing a communication log file (ie, the communication log 207) and jump to S302 for processing the sub-thread B of the trace log file (ie, the trace log 206) and jump Go to S304, for processing the scheduling log file (ie, scheduling log 208), the child thread C jumps to S306;
  • the load log data waits, that is, waits for the child thread A, the child thread B, and the child thread C to read the log data into the memory and process the data that can be recognized by the program, and after completing the wait, jump to S309 to continue processing;
  • the fault locating method based on the log analysis provided by the embodiment of the present invention can schedule the communication scheduling log of the device to be detected, that is, the tracking log, the communication log, and the scheduling log, and automatically detect the combined log data linked list to quickly locate the log data. Outgoing the fault location of the equipment to be tested, improving the processing efficiency of equipment maintenance, thereby improving user satisfaction; The error log data and its adjacent field data in the log data link table are saved in the fault report for the technician to analyze the fault.
  • the present invention further provides a fault location device based on log analysis, which can implement all the processes of the log analysis based fault location method in the above embodiments.
  • FIG. 5 is a schematic structural diagram of an embodiment of a log analysis-based fault location apparatus provided by the present invention, including:
  • the reading module 1 is configured to read a tracking log, a communication log, and a scheduling log of the device to be detected;
  • the extracting module 2 is configured to extract field data from the tracking log, the communication log, and the scheduling log, respectively;
  • a merge module 3 configured to merge the extracted field data having the same time into a log data linked list
  • the positioning module 4 is configured to detect the log data link table and locate the fault location.
  • extracting module specifically includes:
  • a matching unit configured to perform keyword matching on the tracking log, the communication log, and the scheduling log
  • An extracting unit configured to extract, from the tracking log, the communication log, and the scheduling log, respectively, when the tracking log, the communication log, and the scheduling log are successfully matched Matching field data.
  • the positioning module specifically includes:
  • a determining unit configured to determine, by one by one, whether each field data in the log data linked list is error log data
  • a positioning unit configured to locate a fault location according to the error log data if it is determined that the field data is error log data.
  • the field data includes a log level
  • the determining unit is specifically configured to determine whether the log level of each field data in the log data link table is an error level one by one; if the log level of the field data is an error level, determine that the field data is error log data. .
  • the fault location device further includes:
  • a marking module configured to mark a data location of the error log data and a data location of field data adjacent to the error log data in the log data linked list;
  • a save module for saving data in the data location of the tag in the fault report.
  • FIG. 6 is another schematic structural diagram of the log analysis-based fault location apparatus shown in FIG. 5, including: a log data loading module 501, a log data conversion module 502, a merge log time event module 503, a fault location module 504, and A fault report module 505 is generated.
  • the main function of the log data loading module 501 is to read data in the log files (ie, the communication log, the trace log, and the scheduling log) from the file to the memory line by line.
  • the main function of the log data conversion module 502 is to extract the field data in the corresponding communication log format D1, the tracking log format D2, and the scheduling log format D3 by using a regular expression.
  • the main function of the merge log time event module 503 is to combine the generated field data of the communication log format D1, the trace log format D2, and the schedule log format D3 to generate a data link table of the log time event data format D4.
  • the main function of the fault location module 504 is to perform error location according to the level field in the data link table of the log time event data format D4, and then locate the context log of the instruction process according to the position generated by the error, and generate an annotated data link table.
  • the main function of the generated fault report module 505 is to organize the labeled data link table to generate a fault report, and the fault report lists the context relationship of the faulty module and the process of sending and receiving data, so as to analyze the problem.
  • the fault locating device based on the log analysis provided by the embodiment of the present invention can schedule the communication scheduling log of the device to be detected, that is, the tracking log, the communication log, and the scheduling log, and automatically detect the combined log data linked list to quickly locate the log data.
  • the fault location of the device to be tested is improved, the processing efficiency of the device maintenance is improved, thereby improving user satisfaction; the error log data and the field data adjacent to the log data link table are saved in the fault report for the technician to analyze the fault. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Computational Linguistics (AREA)
  • Maintenance And Management Of Digital Transmission (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明公开了一种基于日志分析的故障定位方法,包括:读取待检测设备的跟踪日志、通信日志和调度日志;分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据;将提取出的具有相同时间的字段数据合并为日志数据链表;对所述日志数据链表进行检测,定位出故障位置。相应的,本发明还公开了一种基于日志分析的故障定位装置。采用本发明实施例,能够有效提高故障定位的效率。

Description

一种基于日志分析的故障定位方法及装置 技术领域
本发明涉及通信技术领域,尤其涉及一种基于日志分析的故障定位方法及装置。
背景技术
现有的硬件设备,如ATM设备,在产品使用维护过程中的处理方法是外派人员到硬件设备所在地进行人为参与问题排查工作,或者在现场手动地将硬件设备的日志文件发回公司,供开发人员进行分析。但是,由于现场设备所产生的日志数据量较大,在分析日志数据过程中需要消耗不少时间来定位出设备故障的问题所在,从而大大降低产品维护的处理效率,降低客户对故障处理的满意度。
发明内容
本发明实施例提出一种基于日志分析的故障定位方法及装置,能够有效提高故障定位的效率。
本发明实施例提供一种基于日志分析的故障定位方法,包括:
读取待检测设备的跟踪日志、通信日志和调度日志;
分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据;
将提取出的具有相同时间的字段数据合并为日志数据链表;
对所述日志数据链表进行检测,定位出故障位置。
进一步地,所述分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据,具体包括:
对所述跟踪日志、所述通信日志和所述调度日志进行关键字匹配;
在所述跟踪日志、所述通信日志和所述调度日志均匹配成功时,分别从所述跟踪日志、所述通信日志和所述调度日志中提取出与所述关键字相匹配的字段数据。
进一步地,所述对所述日志数据链表进行检测,定位出故障位置,具体包括:
逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据;
若判定所述字段数据为错误日志数据,则根据所述错误日志数据定位出故障位置。
进一步地,所述字段数据包括日志级别;
所述逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据,具体包括:
逐一判断所述日志数据链表中的每个字段数据的日志级别是否为错误级别;若所述字段数据的日志级别为错误级别,则判定所述字段数据为错误日志数据。
进一步地,在所述若判定所述字段数据为错误日志数据,则根据所述错误日志定位出故障位置之后,还包括:
对所述错误日志数据的数据位置以及所述日志数据链表中与所述错误日志数据相邻的字段数据的数据位置进行标记;
将标记的所述数据位置中的数据保存在故障报表中。
相应的,本发明实施例还提供一种基于日志分析的故障定位装置,包括:
读取模块,用于读取待检测设备的跟踪日志、通信日志和调度日志;
提取模块,用于分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据;
合并模块,用于将提取出的具有相同时间的字段数据合并为日志数据链表;以及,
定位模块,用于对所述日志数据链表进行检测,定位出故障位置。
进一步地,所述提取模块具体包括:
匹配单元,用于对所述跟踪日志、所述通信日志和所述调度日志进行关键字匹配;以及,
提取单元,用于在所述跟踪日志、所述通信日志和所述调度日志均匹配成功时,分别从所述跟踪日志、所述通信日志和所述调度日志中提取出与所述关键字相匹配的字段数据。
进一步地,所述定位模块具体包括:
判断单元,用于逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据;以及,
定位单元,用于若判定所述字段数据为错误日志数据,则根据所述错误日志数据定位出故障位置。
进一步地,所述字段数据包括日志级别;
所述判断单元具体用于逐一判断所述日志数据链表中的每个字段数据的日志级别是否为错误级别;若所述字段数据的日志级别为错误级别,则判定所述字段数据为错误日志数据。
进一步地,所述故障定位装置还包括:
标记模块,用于对所述错误日志数据的数据位置以及所述日志数据链表中与所述错误日志数据相邻的字段数据的数据位置进行标记;以及,
保存模块,用于将标记的所述数据位置中的数据保存在故障报表中。
实施本发明实施例,具有如下有益效果:
本发明实施例提供的基于日志分析的故障定位方法及装置,能够调度待检测设备的通信 调度日志,即跟踪日志、通信日志和调度日志,并自动对其合并生成的日志数据链表进行检测,以快速定位出待检测设备的故障位置,提高设备维护的处理效率,从而提高用户满意度;将错误日志数据及其在日志数据链表中相邻的字段数据保存到故障报表中,供技术人员对故障进行分析。
附图说明
图1是本发明提供的基于日志分析的故障定位原理图;
图2是本发明提供的基于日志分析的故障定位方法的一个实施例的流程示意图;
图3是本发明提供的通信日志、跟踪日志、调度日志和日志数据链表的字段数据格式示意图;
图4是图2所示的基于日志分析的故障定位方法的一种具体流程示意图;
图5是本发明提供的基于日志分析的故障定位装置的一个实施例的结构示意图;
图6是图5所示的基于日志分析的故障定位装置的另一种结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
参见图1,是本发明提供的基于日志分析的故障定位原理图。其中,应用程序201通过调用通信组件接口202的相关接口,间接性通过通信通道203与通信服务进程204进行数据交互,以达到控制待检测的硬件设备205的过程。由于该过程具有较复杂的调用关系逻辑,因此需要记录应用程序201调用通信组件接口202时的跟踪日志206,记录应用程序201与硬件设备205交互的通信日志207,以及记录通信服务进程204内部调度的逻辑过程的调度日志208。其中,跟踪日志206主要是提供调用入口和调用出口的分析逻辑依据;通信日志207主要是提供与硬件设备205交互过程以及设备状态的分析依据;调度日志208主要是提供与硬件设备205交互操作的分析依据。日志分析模块209将跟踪日志206、通信日志207和调度日志208组成日志数据链表,并对该日志数据链表进行分析,生成故障报表210。
参见图2,是本发明提供的基于日志分析的故障定位方法的一个实施例的流程示意图,包括:
S1、读取待检测设备的跟踪日志、通信日志和调度日志;
S2、分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据;
S3、将提取出的具有相同时间的字段数据合并为日志数据链表;
S4、对所述日志数据链表进行检测,定位出故障位置。
需要说明的是,在对待检测设备进行检测时,启动加载线程(包括子线程A、子线程B和子线程C)。其中,子线程A用于处理通信日志,子线程B用于处理跟踪日志,子线程C用于处理调度日志。子线程A加载通信日志,将文本形式的通信日志的数据读取到内存中,并从通信日志中提取出字段数据,存放到数据缓冲列表A中;子线程B加载跟踪日志,将文本形式的跟踪日志的数据读取到内存中,并从跟踪日志中提取出字段数据,存放到数据缓冲列表B中;子线程C加载调度日志,将文本形式的调度日志的数据读取到内存中,并从调度日志中提取出字段数据,存放到数据缓冲列表C中。判断数据缓冲列表A、数据缓冲列表B和数据缓冲列表C是否为空,若为空,则退出检测状态,若不为空,则将数据缓冲列表A、数据缓冲列表B和数据缓冲列表C中的字段数据以时间为关键字进行合并,即将数据缓冲列表A、数据缓冲列表B和数据缓冲列表C中具有相同时间的字段数据进行合并,生成日志时间事件数据格式的日志数据链表,并存放到数据缓冲列表D中。对数据缓存列表D中的数据进行检测,从而快速定位出故障位置,提高设备维护的处理效率,从而提高用户满意度。
进一步地,所述分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据,具体包括:
对所述跟踪日志、所述通信日志和所述调度日志进行关键字匹配;
在所述跟踪日志、所述通信日志和所述调度日志均匹配成功时,分别从所述跟踪日志、所述通信日志和所述调度日志中提取出与所述关键字相匹配的字段数据。
其中,如图3所示,通信日志的字段数据格式D1为年year、月month、日day、小时hour、分钟minute、秒second、毫秒msec、模块名称module、日志级别level、数据项data(线程tid和二进制数据bin);跟踪日志的字段数据格式D2为年year、月month、日day、小时hour、分钟minute、秒second、毫秒msec、模块名称module、日志级别level、数据项data(线程tid和日志信息info);调度日志的字段数据格式D3为年year、月month、日day、小时hour、分钟minute、秒second、毫秒msec、模块名称module、日志级别level、数据项data(线程tid和日志信息info)。
分别采用正则表达式对跟踪日志、通信日志和调度日志进行关键字匹配,在跟踪日志、通信日志和调度日志中均能匹配到其对应的关键字时,分别从跟踪日志、通信日志和调度日志中提取出具有其对应格式的字段数据。进一步地,所述对所述日志数据链表进行检测,定位出故障位置,具体包括:
逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据;
若判定所述字段数据为错误日志数据,则根据所述错误日志数据定位出故障位置。
进一步地,所述字段数据包括日志级别;
所述逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据,具体包括:
逐一判断所述日志数据链表中的每个字段数据的日志级别是否为错误级别;若所述字段数据的日志级别为错误级别,则判定所述字段数据为错误日志数据。
需要说明的是,如图3所示,合并后的日志数据链表的字段数据格式D4为年year、月month、日day、小时hour、分钟minute、秒second、毫秒msec、模块名称module、日志级别level、数据项data(源日志格式类别type、线程tid和日志信息info)。其中,日志级别level分为信息(info)、告警(warning)、错误(error)、系统(system)几个级别,源日志格式类别type分为通信日志格式、跟踪日志格式和调度日志格式。在对数据缓存列表D进行检测时,先将数据指针定位到第一个数据位置,检测该数据位置处的字段数据的日志级别level是否为错误级别。若为错误级别,则该字段数据为错误日志,即可根据该错误日志快速定位出故障位置,若不为错误级别,则将数据指针下移到下一个数据位置继续进行检测,直至数据缓存列表D中的所有数据均检测完毕。
进一步地,在所述若判定所述字段数据为错误日志数据,则根据所述错误日志定位出故障位置之后,还包括:
对所述错误日志数据的数据位置以及所述日志数据链表中与所述错误日志数据相邻的字段数据的数据位置进行标记;
将标记的所述数据位置中的数据保存在故障报表中。
需要说明的是,在检测出错误日志数据后,对错误日志数据的数据位置进行标记,并根据该数据位置查找错误日志数据相邻的字段数据,即指令过程中的上下文,并标记出相邻的字段数据的数据位置。在检测完毕后,将标记的数据位置中的数据提取出来生成故障报表。其中,故障列表中列明故障模块的上下文关系及收发数据的过程和故障模块在正常情况下的上下文关系及收发数据的过程,供技术人员对故障进行分析。
参见图4,是图2所示的基于日志分析的故障定位方法的一种具体流程示意图,包括:
S301、启动加载线程,即分别启动用于处理通信日志文件(即通信日志207)的子线程A并跳转到S302,用于处理跟踪日志文件(即跟踪日志206)的子线程B并跳转到S304,用于处理调度日志文件(即调度日志208)子线程C跳转到S306;
S302、加载通信日志文件(即通信日志207),将文本形式的通信日志数据读取到内存中,跳转到S303;
S303、使用正则表达式进行关键字匹配,从通信日志数据中提取通信日志格式D1中的数据,存放到数据缓冲列表A中,跳转到S308;
S304、加载跟踪日志文件(即跟踪日志206),将文本形式的跟踪日志数据读取到内存中,跳转到S305;
S305、使用正则表达式进行关键字匹配,从跟踪日志数据中提取通信跟踪日志格式D2中的数据,存放到数据缓冲列表B中,跳转到S308;
S306、加载调度日志文件(即调度日志208),将文本形式的调度日志数据读取到内存中,跳转到S307;
S307、使用正则表达式进行关键字匹配,从调度日志数据中提取调度日志格式D3中的数据,存放到数据缓冲列表C中,跳转到S308;
S308、加载日志数据等待,即等待子线程A、子线程B和子线程C将日志数据读取到内存并处理成程序可以识别的数据,完成等待后跳转到S309继续处理;
S309、判断数据缓冲列表A、数据缓冲列表B及数据缓冲列表C是否为空,若其中任意一个数据缓冲列表为空,则跳转到S317,否则执行S310;
S310、将数据缓冲列表A、数据缓冲列表B及数据缓冲列表C中的数据以时间作为关键字合并,生成日志时间事件数据格式D4的日志数据链表,并存放到数据缓冲列表D中;
S311、将数据缓冲列表D的数据指针定位到第一条数据位置;
S312、判断数据缓冲列表D的数据字段级别(level)是否为错误日志级别,如果是则跳转到S313,如果不是则跳转到S314;
S313、标记错误日志的数据位置,定位通信数据的数据位置,并根据当前的错误位置查找指令过程的上下文,标记上下文的数据位置;
S314、将数据缓冲列表D的数据指针下移一条数据位置;
S315、判断数据缓冲列表D的数据指针是否是数据结尾,如果是则跳转到S316,如果不是则跳转到S312;
S316:将标记的数据位置中的数据提取出来生成故障报表,其中,故障报表中列明故障模块的上下文关系以及收发数据的过程和列出正常情况下的上下文关系以及收发数据的过程,以便于分析问题;
S317、日志数据分析模块退出,结束日志数据的分析过程。
本发明实施例提供的基于日志分析的故障定位方法,能够调度待检测设备的通信调度日志,即跟踪日志、通信日志和调度日志,并自动对其合并生成的日志数据链表进行检测,以快速定位出待检测设备的故障位置,提高设备维护的处理效率,从而提高用户满意度;将错 误日志数据及其在日志数据链表中相邻的字段数据保存到故障报表中,供技术人员对故障进行分析。
相应的,本发明还提供一种基于日志分析的故障定位装置,能够实现上述实施例中的基于日志分析的故障定位方法的所有流程。
参见图5,是本发明提供的基于日志分析的故障定位装置的一个实施例的结构示意图,包括:
读取模块1,用于读取待检测设备的跟踪日志、通信日志和调度日志;
提取模块2,用于分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据;
合并模块3,用于将提取出的具有相同时间的字段数据合并为日志数据链表;以及,
定位模块4,用于对所述日志数据链表进行检测,定位出故障位置。
进一步地,所述提取模块具体包括:
匹配单元,用于对所述跟踪日志、所述通信日志和所述调度日志进行关键字匹配;以及,
提取单元,用于在所述跟踪日志、所述通信日志和所述调度日志均匹配成功时,分别从所述跟踪日志、所述通信日志和所述调度日志中提取出与所述关键字相匹配的字段数据。
进一步地,所述定位模块具体包括:
判断单元,用于逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据;以及,
定位单元,用于若判定所述字段数据为错误日志数据,则根据所述错误日志数据定位出故障位置。
进一步地,所述字段数据包括日志级别;
所述判断单元具体用于逐一判断所述日志数据链表中的每个字段数据的日志级别是否为错误级别;若所述字段数据的日志级别为错误级别,则判定所述字段数据为错误日志数据。
进一步地,所述故障定位装置还包括:
标记模块,用于对所述错误日志数据的数据位置以及所述日志数据链表中与所述错误日志数据相邻的字段数据的数据位置进行标记;以及,
保存模块,用于将标记的所述数据位置中的数据保存在故障报表中。
参见图6,是图5所示的基于日志分析的故障定位装置的另一种结构示意图,包括:日志数据加载模块501、日志数据转换模块502、合并日志时间事件模块503、故障定位模块504和生成故障报表模块505。
其中,日志数据加载模块501主要的功能是将日志文件(即通信日志、跟踪日志和调度日志)中的数据逐行由文件读取到内存。日志数据转换模块502主要的功能是通过使用正则表达式提取对应的通信日志格式D1、跟踪日志格式D2和调度日志格式D3中的字段数据。合并日志时间事件模块503的主要的功能是将所生成的通信日志格式D1、跟踪日志格式D2和调度日志格式D3的字段数据进行合并,生成日志时间事件数据格式D4的数据链表。故障定位模块504的主要功能是在日志时间事件数据格式D4的数据链表中根据level字段进行错误定位,然后根据错误所产生的位置定位出指令过程的上下文日志,并生成标注数据链表。生成故障报表模块505的主要功能是将标注数据链表进行整理生成故障报表,故障报表中列明故障模块的上下文关系以及收发数据的过程,以便于分析问题。
本发明实施例提供的基于日志分析的故障定位装置,能够调度待检测设备的通信调度日志,即跟踪日志、通信日志和调度日志,并自动对其合并生成的日志数据链表进行检测,以快速定位出待检测设备的故障位置,提高设备维护的处理效率,从而提高用户满意度;将错误日志数据及其在日志数据链表中相邻的字段数据保存到故障报表中,供技术人员对故障进行分析。
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。

Claims (10)

  1. 一种基于日志分析的故障定位方法,其特征在于,包括:
    读取待检测设备的跟踪日志、通信日志和调度日志;
    分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据;
    将提取出的具有相同时间的字段数据合并为日志数据链表;
    对所述日志数据链表进行检测,定位出故障位置。
  2. 如权利要求1所述的基于日志分析的故障定位方法,其特征在于,所述分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据,具体包括:
    对所述跟踪日志、所述通信日志和所述调度日志进行关键字匹配;
    在所述跟踪日志、所述通信日志和所述调度日志均匹配成功时,分别从所述跟踪日志、所述通信日志和所述调度日志中提取出与所述关键字相匹配的字段数据。
  3. 如权利要求1所述的基于日志分析的故障定位方法,其特征在于,所述对所述日志数据链表进行检测,定位出故障位置,具体包括:
    逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据;
    若判定所述字段数据为错误日志数据,则根据所述错误日志数据定位出故障位置。
  4. 如权利要求3所述的基于日志分析的故障定位方法,其特征在于,所述字段数据包括日志级别;
    所述逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据,具体包括:
    逐一判断所述日志数据链表中的每个字段数据的日志级别是否为错误级别;若所述字段数据的日志级别为错误级别,则判定所述字段数据为错误日志数据。
  5. 如权利要求3或4所述的基于日志分析的故障定位方法,其特征在于,在所述若判定所述字段数据为错误日志数据,则根据所述错误日志定位出故障位置之后,还包括:
    对所述错误日志数据的数据位置以及所述日志数据链表中与所述错误日志数据相邻的字段数据的数据位置进行标记;
    将标记的所述数据位置中的数据保存在故障报表中。
  6. 一种基于日志分析的故障定位装置,其特征在于,包括:
    读取模块,用于读取待检测设备的跟踪日志、通信日志和调度日志;
    提取模块,用于分别从所述跟踪日志、所述通信日志和所述调度日志中提取出字段数据;
    合并模块,用于将提取出的具有相同时间的字段数据合并为日志数据链表;以及,
    定位模块,用于对所述日志数据链表进行检测,定位出故障位置。
  7. 如权利要求6所述的基于日志分析的故障定位装置,其特征在于,所述提取模块具体包括:
    匹配单元,用于对所述跟踪日志、所述通信日志和所述调度日志进行关键字匹配;以及,
    提取单元,用于在所述跟踪日志、所述通信日志和所述调度日志均匹配成功时,分别从所述跟踪日志、所述通信日志和所述调度日志中提取出与所述关键字相匹配的字段数据。
  8. 如权利要求6所述的基于日志分析的故障定位装置,其特征在于,所述定位模块具体包括:
    判断单元,用于逐一判断所述日志数据链表中的每个字段数据是否为错误日志数据;以及,
    定位单元,用于若判定所述字段数据为错误日志数据,则根据所述错误日志数据定位出故障位置。
  9. 如权利要求8所述的基于日志分析的故障定位装置,其特征在于,所述字段数据包括日志级别;
    所述判断单元具体用于逐一判断所述日志数据链表中的每个字段数据的日志级别是否为错误级别;若所述字段数据的日志级别为错误级别,则判定所述字段数据为错误日志数据。
  10. 如权利要求8或9所述的基于日志分析的故障定位装置,其特征在于,所述故障定位装置还包括:
    标记模块,用于对所述错误日志数据的数据位置以及所述日志数据链表中与所述错误日志数据相邻的字段数据的数据位置进行标记;以及,
    保存模块,用于将标记的所述数据位置中的数据保存在故障报表中。
PCT/CN2017/079319 2016-04-06 2017-04-01 一种基于日志分析的故障定位方法及装置 WO2017173969A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610211578.0 2016-04-06
CN201610211578.0A CN105930348B (zh) 2016-04-06 2016-04-06 一种基于日志分析的故障定位方法及装置

Publications (1)

Publication Number Publication Date
WO2017173969A1 true WO2017173969A1 (zh) 2017-10-12

Family

ID=56840203

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/079319 WO2017173969A1 (zh) 2016-04-06 2017-04-01 一种基于日志分析的故障定位方法及装置

Country Status (2)

Country Link
CN (1) CN105930348B (zh)
WO (1) WO2017173969A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112395180A (zh) * 2020-12-10 2021-02-23 南威软件股份有限公司 一种业务日志全链路跟踪的实现方法
CN114064718A (zh) * 2021-11-05 2022-02-18 上海新炬网络技术有限公司 一种基于日志分析的业务调用链的网络故障定位方法
US11645138B2 (en) 2020-07-01 2023-05-09 International Business Machines Corporation Diagnosing and resolving technical issues
CN117170984A (zh) * 2023-11-02 2023-12-05 麒麟软件有限公司 一种linux系统待机状态的异常检测方法及系统

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930348B (zh) * 2016-04-06 2019-06-04 广州广电运通金融电子股份有限公司 一种基于日志分析的故障定位方法及装置
WO2018055797A1 (ja) * 2016-09-20 2018-03-29 オリンパス株式会社 集中制御装置
CN107978098A (zh) * 2017-11-21 2018-05-01 浪潮金融信息技术有限公司 自动柜员机的故障检测方法及装置
CN108959199B (zh) * 2018-06-28 2022-08-16 武汉斗鱼网络科技有限公司 一种日志的突出显示方法、装置、存储介质及安卓终端
CN109725199A (zh) * 2018-12-29 2019-05-07 国网青海省电力公司电力科学研究院 一种基于gpib网络的谐波监测装置全自动测试系统
CN110806962B (zh) * 2019-11-06 2021-04-16 星环信息科技(上海)股份有限公司 日志级别的预测方法、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5463768A (en) * 1994-03-17 1995-10-31 General Electric Company Method and system for analyzing error logs for diagnostics
JP2010256997A (ja) * 2009-04-21 2010-11-11 Fujitsu Ltd フィールドトラブルのエラー再現システム、エラー再現調査方法およびシナリオ実行プログラム
CN102163353A (zh) * 2011-02-25 2011-08-24 广州广电运通金融电子股份有限公司 电子流水日志智能分析系统及方法
CN104462606A (zh) * 2014-12-31 2015-03-25 中国科学院深圳先进技术研究院 一种基于日志数据确定诊断处理措施的方法
CN104461786A (zh) * 2014-12-19 2015-03-25 上海斐讯数据通信技术有限公司 Android系统的恢复方法及Android系统的恢复系统
CN105930348A (zh) * 2016-04-06 2016-09-07 广州广电运通金融电子股份有限公司 一种基于日志分析的故障定位方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070083792A1 (en) * 2005-10-11 2007-04-12 Mcdermott Andrew System and method for error detection and reporting
CN101325520B (zh) * 2008-06-17 2010-08-18 南京邮电大学 基于日志的智能自适应网络故障定位和分析方法
CN104391881B (zh) * 2014-10-30 2017-06-27 杭州安恒信息技术有限公司 一种基于分词算法的日志解析方法及系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5463768A (en) * 1994-03-17 1995-10-31 General Electric Company Method and system for analyzing error logs for diagnostics
JP2010256997A (ja) * 2009-04-21 2010-11-11 Fujitsu Ltd フィールドトラブルのエラー再現システム、エラー再現調査方法およびシナリオ実行プログラム
CN102163353A (zh) * 2011-02-25 2011-08-24 广州广电运通金融电子股份有限公司 电子流水日志智能分析系统及方法
CN104461786A (zh) * 2014-12-19 2015-03-25 上海斐讯数据通信技术有限公司 Android系统的恢复方法及Android系统的恢复系统
CN104462606A (zh) * 2014-12-31 2015-03-25 中国科学院深圳先进技术研究院 一种基于日志数据确定诊断处理措施的方法
CN105930348A (zh) * 2016-04-06 2016-09-07 广州广电运通金融电子股份有限公司 一种基于日志分析的故障定位方法及装置

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11645138B2 (en) 2020-07-01 2023-05-09 International Business Machines Corporation Diagnosing and resolving technical issues
CN112395180A (zh) * 2020-12-10 2021-02-23 南威软件股份有限公司 一种业务日志全链路跟踪的实现方法
CN114064718A (zh) * 2021-11-05 2022-02-18 上海新炬网络技术有限公司 一种基于日志分析的业务调用链的网络故障定位方法
CN117170984A (zh) * 2023-11-02 2023-12-05 麒麟软件有限公司 一种linux系统待机状态的异常检测方法及系统
CN117170984B (zh) * 2023-11-02 2024-01-30 麒麟软件有限公司 一种linux系统待机状态的异常检测方法及系统

Also Published As

Publication number Publication date
CN105930348B (zh) 2019-06-04
CN105930348A (zh) 2016-09-07

Similar Documents

Publication Publication Date Title
WO2017173969A1 (zh) 一种基于日志分析的故障定位方法及装置
US10684938B2 (en) Code component debugging in an application program
CN109284269B (zh) 异常日志分析方法、装置、存储介质及服务器
US8370816B2 (en) Device, method and computer program product for evaluating a debugger script
CN102360328B (zh) 程序监控装置和程序监控方法
CN109388537B (zh) 运行信息跟踪方法、装置及计算机可读存储介质
WO2020237877A1 (zh) 日志监控方法、装置、终端与存储介质
CN107688531A (zh) 数据库集成测试方法、装置、计算机设备及存储介质
CN111611100B (zh) 交易故障检测方法、装置、计算设备以及介质
WO2022252860A1 (zh) 一种事件处理方法、装置、计算机设备及存储介质
US20210096940A1 (en) Storage medium, information processing method, and information processing apparatus
EP3230869A1 (en) Separating test verifications from test executions
CN111061639A (zh) 一种高效多系统测试代码覆盖率的管理方法
CN101594627A (zh) 一种模拟移动终端故障的装置和方法
CN103645985A (zh) 一种源代码宏配对检测方法
Maiga et al. An empirical study on the handling of crash reports in a large software company: An experience report
US9183388B2 (en) Injustice detecting system, injustice detecting device and injustice detecting method
CN114064480A (zh) 一种软件质量管理方法和系统
CN111835566A (zh) 一种系统故障管理方法、装置及系统
US20240005254A1 (en) System and method for identifying and utilizing agent working from home impact score
CN102063347B (zh) 一种磁带数据恢复方法及系统
CN114328249A (zh) 一种自动化测试执行结果处理方法及装置
CN106384046B (zh) 兼具动静态检测行动应用程序的方法
CN117850296A (zh) 上位机服务控制方法、装置、设备及存储介质
CN114840177A (zh) 软件产品的验收方法、装置以及电子设备

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 17778633

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17778633

Country of ref document: EP

Kind code of ref document: A1