WO2019134226A1 - Log collection method, device, terminal apparatus, and storage medium - Google Patents

Log collection method, device, terminal apparatus, and storage medium Download PDF

Info

Publication number
WO2019134226A1
WO2019134226A1 PCT/CN2018/077223 CN2018077223W WO2019134226A1 WO 2019134226 A1 WO2019134226 A1 WO 2019134226A1 CN 2018077223 W CN2018077223 W CN 2018077223W WO 2019134226 A1 WO2019134226 A1 WO 2019134226A1
Authority
WO
WIPO (PCT)
Prior art keywords
log
identification code
unique identification
log information
thread
Prior art date
Application number
PCT/CN2018/077223
Other languages
French (fr)
Chinese (zh)
Inventor
戴开云
林博
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019134226A1 publication Critical patent/WO2019134226A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3072Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a log collection method, apparatus, terminal device, and storage medium.
  • the embodiment of the present invention provides a log collection method, device, terminal device, and storage medium, so as to solve the problem that the problem location efficiency is low in the existing multi-system problem location process.
  • an embodiment of the present application provides a log collection method, including:
  • the target log information is output in the order in which the target log information is generated.
  • the embodiment of the present application provides a log collecting apparatus, including:
  • An identifier generating module configured to receive an application request message sent by a user, and generate a unique identifier code corresponding to the application request message;
  • An identifier adding module configured to add the unique identifier to the application request message to form a request instruction
  • An identifier delivery module configured to pass the unique identification code in an application system or database through which the response processing process passes during response processing to the request instruction, such that the unique identification code is written into the In the log information of the application system or in the database;
  • a log collection module configured to output log information including the unique identification code to a log library
  • a log extraction module configured to extract target log information including the unique identification code from the log library according to the unique identification code included in the request instruction, if the execution of the request instruction fails;
  • a log output module configured to output the target log information according to a generation time sequence of the target log information.
  • an embodiment of the present application provides a terminal device, including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, where the processor executes the computer The following steps are implemented when reading the instruction:
  • the target log information is output in the order in which the target log information is generated.
  • an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores computer readable instructions, and when the computer readable instructions are executed by a processor, the following steps are implemented:
  • the target log information is output in the order in which the target log information is generated.
  • a unique identification code corresponding to an application request message sent by a user is generated, and the unique identification code is in a response processing process of the request instruction.
  • FIG. 1 is a flowchart of a log collection method provided in Embodiment 1 of the present application.
  • step S3 is a flowchart of an implementation of step S3 in the log collection method provided in Embodiment 1 of the present application;
  • step S32 is a flowchart of an implementation of step S32 in the log collection method provided in Embodiment 1 of the present application;
  • FIG. 5 is a schematic diagram of a log collection device provided in Embodiment 2 of the present application.
  • FIG. 6 is a schematic diagram of a terminal device provided in Embodiment 4 of the present application.
  • FIG. 1 shows an implementation process of a log collection method provided by an embodiment of the present application.
  • the log collection method is applied to the log collection system of each enterprise, and the log association generated by the request instruction in the process of the application system or the database response process is aggregated to improve the efficiency of problem location.
  • the log collection method includes steps S1 to S6, which are detailed as follows:
  • S1 Receive an application request message sent by the user, and generate a unique identification code corresponding to the application request message.
  • the unique identifier is used to identify the uniqueness of the application request message. Specifically, after the client sends the application request message, the log collection system generates a corresponding unique identifier according to the application request message sent by the user.
  • UUIDs Universally Unique Identifiers
  • UUIDs Universally Unique Identifiers
  • the application request message The receiving time, the machine device number and the like are combined to generate the random sequence, and specifically, the data such as the Ethernet card address, the nanosecond time, the identification code of the host chip, and the random number may be used, or the user may customize according to the need, so that the The unique identifier is globally unique.
  • the unique identification code generated in step S1 is added to the application request message according to a preset format to form a request instruction.
  • the preset format may be a preset field of adding a unique identifier to the header of the request message or adding a unique identifier to the preset field of the message content, which may be set according to the needs of the application. There are no restrictions here.
  • the application function module in multiple different application systems or accessing data in multiple different databases is often invoked according to the needs of the actual application.
  • the unique identification code is first extracted from the input message, and the unique identification code is written into the log information generated by the current application system, or stored in the current database. Then, after the processing of the current application system or the current database is completed, the unique identification code is delivered to the next application system or database.
  • the current application system that receives the application request message records the unique identification code and the content of the application request message in the local log, and the request instruction is sent to the next application service system.
  • the application service system service extracts the unique identification code and the application request message from the request instruction according to a preset format after receiving the incoming request instruction, and is in the process of responding to the application request message. , the unique identification code is recorded into the generated log information.
  • the unique identification code can be added to each of the log information generated by the response processing request instruction process and each of the passed databases by passing the unique identification code in each application system or each database through which the response process passes.
  • S4 Output log information including the unique identification code to the log library.
  • the log information including the unique identification code is output to the specified log library by using the log management tool.
  • the log library is a log output destination that is set according to the needs of a specific application. Specifically, it may be a specified database or a unified log management server to form an effective collection of log information distributed in different application systems or databases.
  • the log management tool can set the log attributes such as the information contained in the log, the output format of the log, and the destination of the log information delivery.
  • log information collection can be performed by using the log framework Log4j, and the log attribute is set by using the Log4j configuration file.
  • the log attribute is set by using the Log4j configuration file.
  • the unique identification code corresponding to the application request message is obtained according to the request instruction, according to the request.
  • the unique identification code extracts the target log information containing the unique identification code from the log library, so that the relevant personnel can diagnose the reason for the failure of the execution of the request instruction by the content recorded in the target log information.
  • the grep command can be used to match the parameter of the condition option and the unique identifier to search for the log information that meets the requirements in the log repository of the stored log, and print and output the matched log information.
  • grep obtaining the command: grep 'uuid2'*.log the *.log file containing the uuid2 is obtained, and the log information corresponding to the uuid2 request command is outputted in response to the response.
  • S6 Output the target log information according to the generation time of the target log information.
  • the target log information acquired in step S5 is arranged according to the generation time sequence of the target log information, a log chain is formed, and the log chain is output to the interaction interface, so that the request instruction is
  • the log information generated by the response process is completely concatenated, so that the relevant operation and maintenance personnel can analyze the reason for the failure of the request instruction according to the context relationship contained in the complete log information, so as to facilitate the rapid and accurate positioning problem.
  • the unique identification code corresponding to the application request message sent by the user is generated, and the unique identification code is transmitted in the application system or database through which the response processing process of the request instruction passes, so that the unique
  • the identification code is recorded in the log information generated by the entire response processing process, and the log information is output to the log library, so as to effectively collect the log information distributed in different application systems or databases, when the request instruction fails to execute,
  • the target log information generated by the request instruction in the response processing process is obtained from the log library according to the unique identification code, and the target log information is outputted in the order of generation time to form a log chain, so that the request instruction is responded
  • the log information generated during the process is completely concatenated, so that the request invocation process between multiple application systems is clear and transparent, thereby facilitating the relevant operation and maintenance personnel to diagnose the reason for the failure of the request instruction according to the context relationship included in the target log information. For quick and accurate positioning problems Effectively improve the efficiency of problem location.
  • step S3 the application of the unique identification code in the response processing process in the response processing process to the request instruction mentioned in step S3 is hereinafter described by a specific embodiment.
  • the specific implementation method of passing in the system or database so that the unique identification code is written into the log information of the application system or in the database is described in detail.
  • FIG. 2 shows a specific implementation process of step S3 provided by the embodiment of the present application, which is described in detail as follows:
  • the unique identification code is added to the HTTP head request, and is transmitted through a network transmission protocol, so that the unique identification code is written into the application system through which the response processing process passes. In the log information.
  • S32 The unique identification code is passed in a single thread or a thread pool when the response process passes inside the application system.
  • the processing of the request instruction in the application system may be a single-thread processing manner or a thread pool processing manner, and the unique identification code is transmitted in a single thread or a thread pool.
  • the unique identification code is written into the log information of the single thread or the thread pool inside the application system through which the response process passes.
  • an idle field is selected as a preset field in each data table of the database. If the data table has no free field, a new field is added to the data table as a preset field, and the preset field is used to record the unique identification code.
  • the response process accesses the data record involved in the data table of the database, the unique identification code is recorded in the preset field of the data record, so that the relevant operation and maintenance personnel can quickly locate the database according to the unique identification code when the problem is located. Get the relevant data table and the data records involved in the data table.
  • the specific setting method for adding the preset field in the corresponding table of the database is as follows:
  • the statement refers to adding the field a to the table employee.
  • the type of the field a is varchar, the size of the field a is 20 bytes, and the field a is not empty, and the default value is 0.
  • attributes such as the type and size of the preset field can be set according to the needs of the actual application, and no limitation is imposed here.
  • step S31 there is no necessary sequential execution order between step S31, step S32 and step S33, which may be a parallel execution relationship.
  • the unique identification code is transmitted between different application systems by adding the unique identification code to the interaction message between different application systems, by using the unique identification code in a single thread or a thread pool. Passing, realizing the transfer of the unique identification code inside the application system, and recording the unique identification code in the preset field of the data table of the database, realizing the transfer of the unique identification code in the database, thereby realizing the unique identification code in the request instruction.
  • the specific identification code is mentioned in step S32, and the specific identification code is transmitted in the single thread or the thread pool when the response processing process passes inside the application system.
  • the implementation method is described in detail.
  • FIG. 3 shows a specific implementation process of step S32 provided by the embodiment of the present application, which is described in detail as follows:
  • the unique identification code is operated by the MDC.put() operation according to the incoming unique identification code when the single thread starts executing. Write to a preset log variable that is pre-set in the log configuration file so that the unique identification code is passed during the execution of the single thread.
  • the unique identification code uuid2 is written into the log variable mdc_trade_id using MDC.put ("mdc_trade_id", uuid2), where the MDC (Mapped Diagnostic Context) can create a log storage space for each thread.
  • MDC Mapped Diagnostic Context
  • response processing process is the thread pool processing mode inside the application system, obtain the content of the log storage space of each thread before creating the thread pool, and perform a push operation during the process of creating the thread pool, so that the unique The identification code is passed in the thread pool, wherein the push operation is used to add the content of the log storage space of each thread, and the content of the log storage space contains a unique identification code.
  • the response processing process is the thread pool processing mode when the application system is internal
  • the content of the log storage space record of each thread is obtained by using the MDC.getContext().clone operation before creating the thread pool.
  • the recorded content includes the value of the unique identifier and other preset log variables, and the MDC.push() operation is performed during the creation of the thread pool, and the value of the log variable of each thread's log storage space record is added to the creation.
  • the execution code of the thread pool is such that the unique identifier is passed during the execution of each thread in the thread pool.
  • the MDC.getContext() operation is used to obtain the content of the storage space of each thread. In the thread pool, if multiple threads access the same resource at the same time, the thread will compete for resources. Therefore, for the MDC. .getContext() does a clone operation to avoid thread resource contention causing execution errors.
  • the unique identification code is written into the preset log variable by the MDC.put() operation, so that the unique identification code is transmitted in a single thread, and the thread pool is processed.
  • the MDC.getContext().clone operation uses the MDC.getContext().clone operation to get the contents of the log storage space of each thread before creating the thread pool, and perform the MDC.push() operation during the process of creating the thread pool, and store the log of each thread.
  • the content of the space is added to the log storage space of the thread pool, and the delivery of the unique identification code in the thread pool is realized, and the delivery of the unique identification code in the single thread and the thread pool provides conditions for obtaining a complete log chain.
  • the log information in the log library may be further managed, as shown in FIG. 4, the log collection is performed.
  • the method also includes:
  • the history log information of the log generation time earlier than the preset time exists, the history log information is deleted.
  • the log files in the log library can be periodically deleted.
  • the log generation time in the log library is determined to be earlier than the preset.
  • the historical log information of the time if it exists, delete the historical log information.
  • the preset time can be dynamically adjusted according to the current log file size. When the log file is large, the preset time can be close to the current time, that is, the deleted history log information is relatively increased. When the log file is small, The preset time can be far away from the current time, that is, the deleted history log information is relatively reduced.
  • the log is periodically cleared by setting a timed task, such as using the Crontab command, which is used to set instructions that are periodically executed.
  • a timed task such as using the Crontab command, which is used to set instructions that are periodically executed.
  • the specific setting method includes the following steps (1) to (3), which are specifically described as follows:
  • the log data of the log library is generated by periodically deleting the log, and the memory of the log library is released to avoid the memory being occupied by the transition, thereby effectively improving the performance of each application system.
  • the target log information may be analyzed.
  • the log collection method further includes:
  • S71 Analyze the target log information according to the preset keyword, and confirm the key log information.
  • the target log information obtained in step S6 is analyzed according to a preset keyword, specifically, the preset keyword is searched in the target log information, and the log containing the preset keyword is included. The information is confirmed as critical log information.
  • the default keyword may be error, warn, not exit, failed, etc., and may be time, IP address, etc., but is not limited thereto, and may be set according to actual application requirements, and is not limited herein.
  • the key log information obtained according to the keyword includes, but is not limited to, important log content, server IP address, and running time.
  • the important log content contains the user's operation information, current running status, and error information.
  • the operation and maintenance personnel can quickly locate the problem based on the important log content, and timely maintain the abnormal server IP address.
  • You can quickly find the corresponding context in the log chain through the running time of key log information to locate the problem.
  • the output mode of the key log information may be directly marking the key log information in the log chain, and the labeling may be performed by changing the font or color of the key log information, so as to distinguish it from the common log information, so as to achieve Eye-catching effect.
  • the output of the key log information may also be that the key log information is separately output to the interactive interface, or the key log information is sent to the information receiving address of the preset operation and maintenance personnel.
  • the specific information receiving address may be a mailbox or an instant messaging tool. Etc., there is no restriction here, so that the relevant operation and maintenance personnel can deal with the problems in time to avoid causing greater losses.
  • the network transmission protocol for transmitting key log information may specifically be HyperText Transfer Protocol (HTTP), File Transfer Protocol (FTP), or Simple Mail Transfer Protocol (SMTP). ) and other methods.
  • HTTP HyperText Transfer Protocol
  • FTP File Transfer Protocol
  • SMTP Simple Mail Transfer Protocol
  • the target log information is analyzed by a preset keyword, the key log information is confirmed, and the key log information is output in time, so that the operation and maintenance personnel can perform timely problems according to the key log information. Positioning, so that the abnormal problems can be quickly solved, avoiding greater losses, improving problem location and system maintenance efficiency.
  • FIG. 5 is a schematic block diagram of the log collecting device corresponding to the log collecting method shown in the first embodiment. For the convenience of description, only the related to the embodiment of the present application is shown. section.
  • the log collection device includes an identifier generation module 50, an identifier addition module 51, an identifier delivery module 52, a log collection module 53, a log extraction module 54, and a log output module 55.
  • Each function module is described in detail as follows:
  • the identifier generating module 50 is configured to receive an application request message sent by the user, and generate a unique identifier code corresponding to the application request message.
  • An identifier adding module 51 configured to add a unique identifier to the application request message to form a request instruction
  • the identifier delivery module 52 is configured to pass the unique identification code in the application system or database through which the response processing process passes during the response processing to the request instruction, so that the unique identification code is written into the log information of the application system. Or in the database;
  • the log collection module 53 is configured to output log information including the unique identification code to the log library.
  • the log extraction module 54 is configured to: if the request instruction fails to be executed, extract the target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
  • the log output module 55 is configured to output target log information according to a generation time sequence of the target log information.
  • the identity delivery module 52 includes:
  • the first delivery unit 520 is configured to add a unique identification code to an interaction message between different application systems when the response processing process passes through different application systems, so that the unique identification code is transmitted through the interaction message;
  • a second delivery unit 521 configured to: when the response processing process passes inside the application system, pass the unique identification code in a single thread or a thread pool;
  • the third transmitting unit 522 is configured to record the unique identification code in a preset field of the data table when the data table in the database is invoked in response to the processing procedure.
  • the second delivery unit 521 includes:
  • the single-threaded delivery sub-unit 5210 is configured to: when the response processing process passes through the application system, is a single-thread processing manner, then pass the unique identification code to the single thread, and deliver the unique identification code in the single-thread execution process;
  • the thread pool delivery sub-unit 5211 is configured to obtain the content of the log storage space of each thread before the thread pool is created, and the thread pool processing process is performed during the process of processing the thread pool.
  • the push operation causes the unique identification code to be passed in the thread pool, wherein the push operation is used to add the contents of the log storage space of each thread, and the content of the log storage space contains the unique identification code.
  • the log collection device further includes:
  • the log deletion module 56 is configured to delete the historical log information if there is historical log information in the log library that is earlier than the preset time.
  • the log collection device further includes:
  • the log analysis module 57 is configured to analyze the target log information according to the preset keyword, and confirm the key log information;
  • the key log output module 58 is configured to output key log information.
  • the embodiment provides a computer readable storage medium, where the computer readable storage medium is stored with the computer readable instructions, and the computer readable instructions are executed by the processor to implement the log collection method in Embodiment 1. Let me repeat. Alternatively, when the computer readable instructions are executed by the processor, the functions of the modules/units in the log collection device in Embodiment 2 are implemented. To avoid repetition, details are not described herein again.
  • the computer readable storage medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard drive, a magnetic disk, an optical disk, a computer memory, a read only memory (ROM, Read-Only Memory), Random Access Memory (RAM), electrical carrier signals, and telecommunications signals.
  • FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present application.
  • the terminal device 6 of this embodiment includes a processor 60, a memory 61, and computer readable instructions 62 stored in the memory 61 and operable on the processor 60.
  • the processor 60 when executing the computer readable instructions 62, implements the steps in the various log collection method embodiments described above, such as steps S1 through S6 shown in FIG.
  • processor 60 when executing computer readable instructions 62, implements the functions of the various modules/units of the various apparatus embodiments described above, such as the functions of modules 50 through 55 of FIG.
  • computer readable instructions 62 may be partitioned into one or more modules/units, one or more modules/units being stored in memory 61 and executed by processor 60 to complete the application.
  • the one or more modules/units may be a series of computer readable instruction segments capable of performing a particular function for describing the execution of computer readable instructions 62 in the terminal device 6.
  • the computer readable instructions 62 may be divided into an identifier generation module, an identifier addition module, an identifier delivery module, a log collection module, a log extraction module, and a log output module.
  • the specific functions of each module are as shown in Embodiment 2, in order to avoid duplication. , no longer repeat them here.
  • the terminal device 6 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal device may include, but is not limited to, the processor 60, the memory 61. It will be understood by those skilled in the art that FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation of the terminal device 6, and may include more or less components than those illustrated, or combine some components or different components.
  • the terminal device may further include an input/output device, a network access device, a bus, and the like.
  • the so-called processor 60 may be a central processing unit (CPU), or may be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6.
  • the memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk provided on the terminal device 6, a smart memory card (SMC), a Secure Digital (SD) card, and a flash memory card (Flash). Card) and so on.
  • the memory 61 may also include both an internal storage unit of the terminal device 6 and an external storage device.
  • the memory 61 is used to store computer readable instructions as well as other readable instructions and data required by the terminal device.
  • the memory 61 can also be used to temporarily store data that has been output or is about to be output.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present application discloses a log collection method, a device, an apparatus, and a storage medium. The log collection method comprises: receiving an application request message sent by a user, and generating a unique identifier corresponding thereto; adding the unique identifier to the application request message, and forming a request instruction; delivering, during a response handling process to the request instruction, the unique identifier between application systems or databases involved in the response handling process, and writing the same into log information of the application systems or databases; outputting the log information to a log database; and, if execution of the request instruction fails, extracting, according to the unique identifier contained therein, target log information containing the unique identifier from the log database, and outputting the same in accordance with the temporal order of generation. The technical solution of the present application effectively collects log information distributed among different application systems or databases and facilitates fast fault localization for maintenance and operations staff by means of associated log information, thereby improving efficiency of issue location.

Description

一种日志收集方法、装置、终端设备及存储介质Log collecting method, device, terminal device and storage medium
本专利申请以2018年01月08日提交的申请号为201810014123.9,名称为“一种日志收集方法、装置、终端设备及存储介质”的中国发明专利申请为基础,并要求其优先权。This patent application is based on the Chinese Patent Application No. 201810014123.9 filed on Jan. 08, 2018, entitled "A Log Collection Method, Apparatus, Terminal Equipment, and Storage Medium", and requires priority.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种日志收集方法、装置、终端设备及存储介质。The present application relates to the field of computer technologies, and in particular, to a log collection method, apparatus, terminal device, and storage medium.
背景技术Background technique
在现有的多系统问题定位过程中,主要依赖运维人员的专业技能和对系统的熟悉程度进行问题定位,导致问题定位的周期较长,问题定位效率低,尤其是对具有上下文依赖关系的问题进行定位时,由于在问题定位过程中各个系统之间相互独立,导致其问题定位需要的时间更长,投入的人力更多。In the existing multi-system problem location process, it mainly relies on the professional skills of the operation and maintenance personnel and the problem of familiarity with the system, resulting in a long period of problem location and low efficiency of problem location, especially for context-dependent relationships. When the problem is located, because the systems are independent of each other during the problem location process, it takes longer to locate the problem and more manpower is invested.
例如,随着Web应用之间的复杂性和相关性的提高,各网站功能的多样化和交互性为用户提供了多种可能的浏览路径,用户在网站上的操作过程日益错综复杂。在应用功能模块或服务器系统等运作时,运行过程会产生日志文件,日志文件中记载了用户、时间以及动作等相关操作的描述。当用户发送一个请求时,该请求经过多个应用功能模块或服务器系统调用,并返回相应的结果。当请求返回调用失败的结果时,运维人员通常需要通过查看处理该请求的日志来定位故障,但由于日志文件分布在不同服务器系统和不同存储路径中,对于海量的日志文件,在没有特殊的关联信息的情况下难以确定有效日志信息,从而影响到问题定位的效率。For example, with the complexity and relevance of web applications, the diversification and interactivity of various website functions provide users with a variety of possible browsing paths, and the operation process of users on the website is increasingly complicated. When an application function module or a server system is operated, a log file is generated in the running process, and a description of related operations such as user, time, and action is described in the log file. When a user sends a request, the request is invoked by multiple application function modules or server systems and returns the corresponding result. When the request returns the result of the call failure, the operation and maintenance personnel usually need to locate the fault by looking at the log that processes the request, but since the log files are distributed in different server systems and different storage paths, there is no special for a large number of log files. In the case of associated information, it is difficult to determine valid log information, thereby affecting the efficiency of problem location.
发明内容Summary of the invention
本申请实施例提供一种日志收集方法、装置、终端设备及存储介质,以解决现有的多系统问题定位过程中问题定位效率较低的问题。The embodiment of the present invention provides a log collection method, device, terminal device, and storage medium, so as to solve the problem that the problem location efficiency is low in the existing multi-system problem location process.
第一方面,本申请实施例提供一种日志收集方法,包括:In a first aspect, an embodiment of the present application provides a log collection method, including:
接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;Receiving an application request message sent by the user, and generating a unique identification code corresponding to the application request message;
将所述唯一标识码添加到所述应用请求消息中,形成请求指令;Adding the unique identification code to the application request message to form a request instruction;
在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;In the process of responding to the request instruction, transmitting the unique identification code in an application system or database through which the response processing process passes, so that the unique identification code is written into the log information of the application system. Or in the database;
将包含所述唯一标识码的日志信息输出到日志库;Outputting log information including the unique identification code to a log library;
若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;If the request instruction fails to be executed, extracting target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
按照所述目标日志信息的生成时间顺序输出所述目标日志信息。The target log information is output in the order in which the target log information is generated.
第二方面,本申请实施例提供一种日志收集装置,包括:In a second aspect, the embodiment of the present application provides a log collecting apparatus, including:
标识生成模块,用于接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;An identifier generating module, configured to receive an application request message sent by a user, and generate a unique identifier code corresponding to the application request message;
标识添加模块,用于将所述唯一标识码添加到所述应用请求消息中,形成请求指令;An identifier adding module, configured to add the unique identifier to the application request message to form a request instruction;
标识传递模块,用于在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;An identifier delivery module, configured to pass the unique identification code in an application system or database through which the response processing process passes during response processing to the request instruction, such that the unique identification code is written into the In the log information of the application system or in the database;
日志收集模块,用于将包含所述唯一标识码的日志信息输出到日志库;a log collection module, configured to output log information including the unique identification code to a log library;
日志提取模块,用于若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;a log extraction module, configured to extract target log information including the unique identification code from the log library according to the unique identification code included in the request instruction, if the execution of the request instruction fails;
日志输出模块,用于按照所述目标日志信息的生成时间顺序输出所述目标日志信息。And a log output module, configured to output the target log information according to a generation time sequence of the target log information.
第三方面,本申请实施例提供一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, where the processor executes the computer The following steps are implemented when reading the instruction:
接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;Receiving an application request message sent by the user, and generating a unique identification code corresponding to the application request message;
将所述唯一标识码添加到所述应用请求消息中,形成请求指令;Adding the unique identification code to the application request message to form a request instruction;
在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;In the process of responding to the request instruction, transmitting the unique identification code in an application system or database through which the response processing process passes, so that the unique identification code is written into the log information of the application system. Or in the database;
将包含所述唯一标识码的日志信息输出到日志库;Outputting log information including the unique identification code to a log library;
若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;If the request instruction fails to be executed, extracting target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
按照所述目标日志信息的生成时间顺序输出所述目标日志信息。The target log information is output in the order in which the target log information is generated.
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如下步骤:In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores computer readable instructions, and when the computer readable instructions are executed by a processor, the following steps are implemented:
接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;Receiving an application request message sent by the user, and generating a unique identification code corresponding to the application request message;
将所述唯一标识码添加到所述应用请求消息中,形成请求指令;Adding the unique identification code to the application request message to form a request instruction;
在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;In the process of responding to the request instruction, transmitting the unique identification code in an application system or database through which the response processing process passes, so that the unique identification code is written into the log information of the application system. Or in the database;
将包含所述唯一标识码的日志信息输出到日志库;Outputting log information including the unique identification code to a log library;
若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;If the request instruction fails to be executed, extracting target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
按照所述目标日志信息的生成时间顺序输出所述目标日志信息。The target log information is output in the order in which the target log information is generated.
本申请实施例提供的一种日志收集方法、装置、终端设备及存储介质中,通过生成与用户发送的应用请求消息相对应的唯一标识码,并将该唯一标识码在请求指令的响应处理过程经过的应用系统或数据库中传递,使得该唯一标识码被记录在整个响应处理过程生成的日志信息中,并将该日志信息输出到日志库,实现对分布在不同应用系统或者数据库中的日志信息形成有效的收集,当请求指令执行失败时,能够根据该唯一标识码从日志库中获取该请求指令在被响应处理过程中生成的目标日志信息,并将目标日志信息按照生成时间的顺序排列输出,形成日志链,从而将请求指令在被响应处理过程中生成的日志信息完整的串联起来,使得多个应用系统之间的请求调用过程清晰透明,从而有利于相关运维人员能够根据目标日志信息中包含的上下文关系诊断请求指令执行失败的原因,便于快速准确的定位问题,有效提高问题定位效率。In the log collection method, device, terminal device and storage medium provided by the embodiment of the present application, a unique identification code corresponding to an application request message sent by a user is generated, and the unique identification code is in a response processing process of the request instruction. The passed in the application system or the database, so that the unique identification code is recorded in the log information generated by the entire response process, and the log information is output to the log library to implement log information distributed in different application systems or databases. Forming a valid collection, when the request instruction fails to execute, the target log information generated by the request instruction in the response processing process can be obtained from the log library according to the unique identification code, and the target log information is arranged and outputted in the order of generation time. Forming a log chain, so that the log information generated by the request instruction in the response process is completely concatenated, so that the request invoking process between multiple application systems is clear and transparent, thereby facilitating the relevant operation and maintenance personnel to be able to according to the target log information. Context diagnosis included in the request Instruction execution cause of the failure, for quick and accurate positioning, and effectively improve the efficiency locate the problem.
附图说明DRAWINGS
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present application. Other drawings may also be obtained from those of ordinary skill in the art based on these drawings without the inventive labor.
图1是本申请实施例1中提供的日志收集方法的流程图;1 is a flowchart of a log collection method provided in Embodiment 1 of the present application;
图2是本申请实施例1中提供的日志收集方法中步骤S3的实现流程图;2 is a flowchart of an implementation of step S3 in the log collection method provided in Embodiment 1 of the present application;
图3是本申请实施例1中提供的日志收集方法中步骤S32的实现流程图;3 is a flowchart of an implementation of step S32 in the log collection method provided in Embodiment 1 of the present application;
图4是本申请实施例1中提供的日志收集方法中输出关键日志信息的实现流程图;4 is a flowchart of implementing output of key log information in the log collection method provided in Embodiment 1 of the present application;
图5是本申请实施例2中提供的日志收集装置的示意图;5 is a schematic diagram of a log collection device provided in Embodiment 2 of the present application;
图6是本申请实施例4中提供的终端设备的示意图。FIG. 6 is a schematic diagram of a terminal device provided in Embodiment 4 of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
实施例1Example 1
请参阅图1,图1示出了本申请实施例提供的日志收集方法的实现流程。该日志收集方法应用在各个企事业单位的日志收集系统中,实现了将请求指令在被应用系统或数据库响应处理过程中生成的日志关联聚合起来,用于提高问题定位的效率。如图1所示,该日志收集方法包括步骤S1至步骤S6,详述如下:Please refer to FIG. 1. FIG. 1 shows an implementation process of a log collection method provided by an embodiment of the present application. The log collection method is applied to the log collection system of each enterprise, and the log association generated by the request instruction in the process of the application system or the database response process is aggregated to improve the efficiency of problem location. As shown in FIG. 1, the log collection method includes steps S1 to S6, which are detailed as follows:
S1:接收用户发送的应用请求消息,并生成与应用请求消息对应的唯一标识码。S1: Receive an application request message sent by the user, and generate a unique identification code corresponding to the application request message.
在本申请实施例中,唯一标识码用于标识应用请求消息的唯一性,具体地,用户在客户端发送出应用请求消息后,日志收集系统根据用户发送的应用请求消息生成对应的唯一标识码(Universally Unique Identifier,UUID),即不同的应用请求消息其对应的唯一标识码互不相同,例如,使用随机序列生成唯一标识码,随机序列具有唯一性,优选地,根据当前日期、应用请求消息的接收时间,以及机器设备号等信息进行组合生成该随机序列,具体可以使用以太网卡地址、纳秒级时间、主机芯片的标识码和随机数等数据,或者由用户根据需要进行定制,使得该唯一标识码具有全局唯一性。In the embodiment of the present application, the unique identifier is used to identify the uniqueness of the application request message. Specifically, after the client sends the application request message, the log collection system generates a corresponding unique identifier according to the application request message sent by the user. (Universally Unique Identifiers, UUIDs), that is, different application identification messages whose corresponding unique identification codes are different from each other, for example, a random sequence is used to generate a unique identification code, and the random sequence is unique. Preferably, according to the current date, the application request message The receiving time, the machine device number and the like are combined to generate the random sequence, and specifically, the data such as the Ethernet card address, the nanosecond time, the identification code of the host chip, and the random number may be used, or the user may customize according to the need, so that the The unique identifier is globally unique.
S2:将唯一标识码添加到应用请求消息中,形成请求指令。S2: Add a unique identification code to the application request message to form a request instruction.
在本申请实施例中,将步骤S1生成的唯一标识码按照预设的格式添加到应用请求消息中,形成请求指令。In the embodiment of the present application, the unique identification code generated in step S1 is added to the application request message according to a preset format to form a request instruction.
需要说明的是,预设的格式具体可以是将唯一标识码添加到请求消息的消息头的预设字段或者将唯一标识码添加到消息内容的预设字段,具体可以根据应用的需要进行设 置,此处不做限制。It should be noted that the preset format may be a preset field of adding a unique identifier to the header of the request message or adding a unique identifier to the preset field of the message content, which may be set according to the needs of the application. There are no restrictions here.
S3:在对请求指令的响应处理过程中,将唯一标识码在响应处理过程经过的应用系统或数据库中传递,使得唯一标识码被写入应用系统的日志信息中或数据库中。S3: In the process of responding to the request instruction, the unique identification code is transmitted in the application system or database through which the response process passes, so that the unique identification code is written into the log information of the application system or in the database.
在本申请实施例中,在对步骤S2形成的请求指令的响应处理过程中,根据实际应用的需要往往会调用多个不同的应用系统中的应用功能模块或者访问多个不同数据库中的数据,在每个应用功能模块的执行过程或者数据库的数据处理过程中,首先从输入消息中提取唯一标识码,并将该唯一标识码写入当前应用系统生成的日志信息中,或者存入当前数据库中,然后在当前应用系统或当前数据库的处理完成后,将该唯一标识码随输出的消息传递到下一个应用系统或者数据库。In the embodiment of the present application, in the response processing process of the request instruction formed in step S2, the application function module in multiple different application systems or accessing data in multiple different databases is often invoked according to the needs of the actual application. In the execution process of each application function module or the data processing process of the database, the unique identification code is first extracted from the input message, and the unique identification code is written into the log information generated by the current application system, or stored in the current database. Then, after the processing of the current application system or the current database is completed, the unique identification code is delivered to the next application system or database.
例如,当通过步骤S2形成请求指令后,接收应用请求消息的当前应用系统会在本地日志中记录该唯一标识码和该应用请求消息的内容,在该请求指令被发送到下一个应用服务系统进行处理时,该应用服务系统服务在接收到传入的请求指令后,按照预设的格式从该请求指令中提取唯一标识码和应用请求消息,并在对该应用请求消息进行响应处理的过程中,将该唯一标识码记录到生成的日志信息中。For example, after the request instruction is formed through step S2, the current application system that receives the application request message records the unique identification code and the content of the application request message in the local log, and the request instruction is sent to the next application service system. When processing, the application service system service extracts the unique identification code and the application request message from the request instruction according to a preset format after receiving the incoming request instruction, and is in the process of responding to the application request message. , the unique identification code is recorded into the generated log information.
通过将唯一标识码在该响应处理过程经过的每个应用系统或每个数据库中传递,使得该唯一标识码能够添加到响应处理请求指令过程生成的每一条日志信息和经过的每一个数据库中。The unique identification code can be added to each of the log information generated by the response processing request instruction process and each of the passed databases by passing the unique identification code in each application system or each database through which the response process passes.
S4:将包含唯一标识码的日志信息输出到日志库。S4: Output log information including the unique identification code to the log library.
在本申请实施例,根据日志信息中的唯一标识码,通过日志管理工具将包含唯一标识码的日志信息输出到指定的日志库中。In the embodiment of the present application, according to the unique identification code in the log information, the log information including the unique identification code is output to the specified log library by using the log management tool.
日志库是根据具体应用的需要进行设置的日志输出目的地,具体可以是一个指定的数据库或者统一的日志管理服务器,对分布在不同应用系统或者数据库中的日志信息形成有效的收集。The log library is a log output destination that is set according to the needs of a specific application. Specifically, it may be a specified database or a unified log management server to form an effective collection of log information distributed in different application systems or databases.
具体地,日志管理工具可以对日志包含的信息、日志的输出格式、日志信息输送的目的地等日志属性进行设置。Specifically, the log management tool can set the log attributes such as the information contained in the log, the output format of the log, and the destination of the log information delivery.
优选地,可以通过使用日志框架Log4j进行日志信息收集,通过Log4j的配置文件实现对日志属性的设置。例如,在配置文件中使用[%X{uuid1}]定义日志变量uuid1,并配置日志变量uuid1的输出格式为%X,将日志变量uuid1的值按照%X的输出格式输出。Preferably, log information collection can be performed by using the log framework Log4j, and the log attribute is set by using the Log4j configuration file. For example, use [%X{uuid1}] in the configuration file to define the log variable uuid1, and configure the output format of the log variable uuid1 to be %X, and output the value of the log variable uuid1 in the output format of %X.
S5:若请求指令执行失败,则根据请求指令中包含的唯一标识码,从日志库中提取包含唯一标识码的目标日志信息。S5: If the execution of the request instruction fails, the target log information including the unique identification code is extracted from the log library according to the unique identification code included in the request instruction.
在本申请实施例中,当用户发送的应用请求消息返回调用失败的异常情况时,即表明该请求指令执行失败,则根据该请求指令获取与该应用请求消息对应的唯一标识码,根据请该唯一标识码,从日志库中提取包含该唯一标识码的目标日志信息,以便相关人员可以通过目标日志信息中记录的内容诊断请求指令执行失败的原因。In the embodiment of the present application, when the application request message sent by the user returns an abnormal situation in which the call fails, that is, the execution of the request instruction fails, the unique identification code corresponding to the application request message is obtained according to the request instruction, according to the request The unique identification code extracts the target log information containing the unique identification code from the log library, so that the relevant personnel can diagnose the reason for the failure of the execution of the request instruction by the content recorded in the target log information.
具体地,可以使用grep命令配合条件选项的参数和唯一标识码实现在存储日志的日志库中搜索符合要求的日志信息,并把匹配的日志信息打印输出。例如,通过grep获取命令:grep‘uuid2’*.log,获取含有该uuid2的*.log文件,将包含uuid2的请求指令在被响应处理过程中对应生成的日志信息全部输出。Specifically, the grep command can be used to match the parameter of the condition option and the unique identifier to search for the log information that meets the requirements in the log repository of the stored log, and print and output the matched log information. For example, by grep obtaining the command: grep 'uuid2'*.log, the *.log file containing the uuid2 is obtained, and the log information corresponding to the uuid2 request command is outputted in response to the response.
S6:按照目标日志信息的生成时间顺序输出该目标日志信息。S6: Output the target log information according to the generation time of the target log information.
在本申请实施例中,针对步骤S5获取到的目标日志信息,按照目标日志信息的生成时间顺序对目标日志信息进行排列,形成日志链,并将日志链输出到交互界面,从而将请求指令在被响应处理过程中生成的日志信息完整的串联起来,使得相关运维人员能够根据完整日志信息中包含的上下文关系对请求指令执行失败的原因进行分析,便于快速准确的定位问题。In the embodiment of the present application, for the target log information acquired in step S5, the target log information is arranged according to the generation time sequence of the target log information, a log chain is formed, and the log chain is output to the interaction interface, so that the request instruction is The log information generated by the response process is completely concatenated, so that the relevant operation and maintenance personnel can analyze the reason for the failure of the request instruction according to the context relationship contained in the complete log information, so as to facilitate the rapid and accurate positioning problem.
在图1对应的实施例中,通过生成与用户发送的应用请求消息相对应的唯一标识码,并将该唯一标识码在请求指令的响应处理过程经过的应用系统或数据库中传递,使得该唯一标识码被记录在整个响应处理过程生成的日志信息中,并将该日志信息输出到日志库,实现对分布在不同应用系统或者数据库中的日志信息形成有效的收集,当请求指令执行失败时,能够根据该唯一标识码从日志库中获取该请求指令在被响应处理过程中生成的目标日志信息,并将目标日志信息按照生成时间的顺序排列输出,形成日志链,从而将请求指令在被响应处理过程中生成的日志信息完整的串联起来,使得多个应用系统之间的请求调用过程清晰透明,从而有利于相关运维人员能够根据目标日志信息中包含的上下文关系诊断请求指令执行失败的原因,便于快速准确的定位问题,有效提高问题定位效率。In the embodiment corresponding to FIG. 1, the unique identification code corresponding to the application request message sent by the user is generated, and the unique identification code is transmitted in the application system or database through which the response processing process of the request instruction passes, so that the unique The identification code is recorded in the log information generated by the entire response processing process, and the log information is output to the log library, so as to effectively collect the log information distributed in different application systems or databases, when the request instruction fails to execute, The target log information generated by the request instruction in the response processing process is obtained from the log library according to the unique identification code, and the target log information is outputted in the order of generation time to form a log chain, so that the request instruction is responded The log information generated during the process is completely concatenated, so that the request invocation process between multiple application systems is clear and transparent, thereby facilitating the relevant operation and maintenance personnel to diagnose the reason for the failure of the request instruction according to the context relationship included in the target log information. For quick and accurate positioning problems Effectively improve the efficiency of problem location.
接下来,在图1对应的实施例的基础之上,下面通过一个具体的实施例对步骤S3中提及的在对请求指令的响应处理过程中,将唯一标识码在响应处理过程经过的应用系统或数据库中传递,使得唯一标识码被写入应用系统的日志信息中或数据库中的具体实现方法进行详细说明。Next, on the basis of the embodiment corresponding to FIG. 1, the application of the unique identification code in the response processing process in the response processing process to the request instruction mentioned in step S3 is hereinafter described by a specific embodiment. The specific implementation method of passing in the system or database so that the unique identification code is written into the log information of the application system or in the database is described in detail.
请参阅图2,图2示出了本申请实施例提供的步骤S3的具体实现流程,详述如下:Referring to FIG. 2, FIG. 2 shows a specific implementation process of step S3 provided by the embodiment of the present application, which is described in detail as follows:
S31:当响应处理过程经过不同的应用系统时,将唯一标识码添加到不同的应用系统 之间的交互消息中,以使该唯一标识码通过交互消息进行传递。S31: When the response processing process passes through different application systems, the unique identification code is added to the interaction message between different application systems, so that the unique identification code is delivered through the interaction message.
具体地,当响应处理过程经过不同的应用系统时,将该唯一标识码添加到HTTP head请求中,并通过网络传输协议进行传递,使得该唯一标识码被写入响应处理过程经过的应用系统的日志信息中。Specifically, when the response processing process passes through different application systems, the unique identification code is added to the HTTP head request, and is transmitted through a network transmission protocol, so that the unique identification code is written into the application system through which the response processing process passes. In the log information.
S32:当响应处理过程经过应用系统内部时,将唯一标识码在单线程或线程池中传递。S32: The unique identification code is passed in a single thread or a thread pool when the response process passes inside the application system.
在本申请实施例中,当响应处理过程经过应用系统内部时,在应用系统内部处理该请求指令可能为单线程处理方式或线程池处理方式,将唯一标识码在单线程或线程池中传递,使得该唯一标识码写入响应处理过程经过的应用系统内部的单线程或线程池的日志信息中。In the embodiment of the present application, when the response processing process passes inside the application system, the processing of the request instruction in the application system may be a single-thread processing manner or a thread pool processing manner, and the unique identification code is transmitted in a single thread or a thread pool. The unique identification code is written into the log information of the single thread or the thread pool inside the application system through which the response process passes.
S33:当响应处理过程调用数据库中的数据表时,将唯一标识码记录在数据表的预设字段。S33: When the response process calls the data table in the database, the unique identification code is recorded in a preset field of the data table.
具体地,在数据库的每个数据表中选择一个空闲字段作为预设字段,若数据表没有空闲字段则对该数据表新增一个字段作为预设字段,预设字段用于记录唯一标识码,当响应处理过程访问数据库的数据表中涉及的数据记录时,将唯一标识码记录在该数据记录的预设字段,以便相关运维人员在问题定位时,根据该唯一标识码能够在数据库中快速获取到相关的数据表和该数据表中涉及到的数据记录。Specifically, an idle field is selected as a preset field in each data table of the database. If the data table has no free field, a new field is added to the data table as a preset field, and the preset field is used to record the unique identification code. When the response process accesses the data record involved in the data table of the database, the unique identification code is recorded in the preset field of the data record, so that the relevant operation and maintenance personnel can quickly locate the database according to the unique identification code when the problem is located. Get the relevant data table and the data records involved in the data table.
例如,在数据库相应的表中添加该预设字段的具体设置方法如下:For example, the specific setting method for adding the preset field in the corresponding table of the database is as follows:
ALTER TABLE employee ADD a varchar(20)NOT NULL Default 0;ALTER TABLE employee ADD a varchar(20)NOT NULL Default 0;
该语句是指在表employee中加入字段a,字段a的类型是varchar,字段a的大小为20字节,并且字段a不为空,其默认值是0。The statement refers to adding the field a to the table employee. The type of the field a is varchar, the size of the field a is 20 bytes, and the field a is not empty, and the default value is 0.
需要说明的是,预设字段的类型和大小等属性可以根据实际应用的需要进行设置,此处不做限制。It should be noted that attributes such as the type and size of the preset field can be set according to the needs of the actual application, and no limitation is imposed here.
在本申请实施例中,步骤S31、步骤S32和步骤S33之间没有必然的先后执行顺序,其可以是并列执行的关系。In the embodiment of the present application, there is no necessary sequential execution order between step S31, step S32 and step S33, which may be a parallel execution relationship.
在图2对应的实施例中,通过将唯一标识码添加到不同应用系统之间的交互消息中,实现唯一标识码在不同应用系统之间的传递,通过将唯一标识码在单线程或者线程池中传递,实现唯一标识码在应用系统内部的传递,以及将唯一标识码记录在数据库的数据表的预设字段,实现唯一标识码在数据库中的传递,从而实现了唯一标识码在请求指令的响应处理过程经过的应用系统或数据库中进行全面完整的传递,使得在请求指令执行失败时,能够根据该唯一标识码从日志库中获取该请求指令在被响应处理过程中生成的完整日志 链,以便相关运维人员能够根据该完整日志链进行快速准确的问题定位,有效提高问题定位效率。In the corresponding embodiment of FIG. 2, the unique identification code is transmitted between different application systems by adding the unique identification code to the interaction message between different application systems, by using the unique identification code in a single thread or a thread pool. Passing, realizing the transfer of the unique identification code inside the application system, and recording the unique identification code in the preset field of the data table of the database, realizing the transfer of the unique identification code in the database, thereby realizing the unique identification code in the request instruction Fully and complete delivery in the application system or database through which the processing process passes, so that when the execution of the request instruction fails, the complete log chain generated by the response instruction in the response process can be obtained from the log library according to the unique identification code. Therefore, the relevant operation and maintenance personnel can perform fast and accurate problem location according to the complete log chain, thereby effectively improving the problem location efficiency.
在图2对应的实施例的基础之上,下面通过一个具体的实施例对步骤S32中提及的当响应处理过程经过应用系统内部时,将唯一标识码在单线程或线程池中传递的具体实现方法进行详细说明。On the basis of the corresponding embodiment of FIG. 2, the specific identification code is mentioned in step S32, and the specific identification code is transmitted in the single thread or the thread pool when the response processing process passes inside the application system. The implementation method is described in detail.
请参阅图3,图3示出了本申请实施例提供的步骤S32的具体实现流程,详述如下:Referring to FIG. 3, FIG. 3 shows a specific implementation process of step S32 provided by the embodiment of the present application, which is described in detail as follows:
S321:若响应处理过程经过应用系统内部时为单线程处理方式,则将唯一标识码传入该单线程,并在单线程的执行过程中传递该唯一标识码。S321: If the response processing process is a single-thread processing manner when passing through the application system, the unique identification code is transmitted to the single thread, and the unique identification code is delivered during the execution of the single thread.
在本申请实施例中,若响应处理过程经过应用系统内部时为单线程处理方式,则在该单线程开始执行时根据传入的唯一标识码,通过MDC.put()操作将该唯一标识码写入预设的日志变量中,该日志变量在日志配置文件中被预先设置,使得该唯一标识码在该单线程的执行过程中传递。In the embodiment of the present application, if the response processing process is a single-thread processing manner when passing through the application system, the unique identification code is operated by the MDC.put() operation according to the incoming unique identification code when the single thread starts executing. Write to a preset log variable that is pre-set in the log configuration file so that the unique identification code is passed during the execution of the single thread.
例如,使用MDC.put(“mdc_trade_id”,uuid2)将唯一标识码uuid2写入日志变量mdc_trade_id中,其中,MDC(Mapped Diagnostic Context,映射诊断上下文)能够为每个线程建立一个日志存储空间。For example, the unique identification code uuid2 is written into the log variable mdc_trade_id using MDC.put ("mdc_trade_id", uuid2), where the MDC (Mapped Diagnostic Context) can create a log storage space for each thread.
S322:若响应处理过程经过应用系统内部时为线程池处理方式,则在创建线程池之前获取每个线程的日志存储空间的内容,并在创建线程池的过程中进行push操作,以使该唯一标识码在线程池中传递,其中,push操作用于添加每个线程的日志存储空间的内容,该日志存储空间的内容包含唯一标识码。S322: If the response processing process is the thread pool processing mode inside the application system, obtain the content of the log storage space of each thread before creating the thread pool, and perform a push operation during the process of creating the thread pool, so that the unique The identification code is passed in the thread pool, wherein the push operation is used to add the content of the log storage space of each thread, and the content of the log storage space contains a unique identification code.
在本申请实施例中,若响应处理过程经过应用系统内部时为线程池处理方式,则在创建线程池之前使用MDC.getContext().clone操作获取每个线程的日志存储空间记录的内容,该记录的内容包括唯一标识码和其他预设的日志变量的值,并在创建线程池的过程中进行MDC.push()操作,将每个线程的日志存储空间记录的日志变量的值添加到创建线程池的执行代码中,以使唯一标识码在线程池中每个线程的执行过程中传递。In the embodiment of the present application, if the response processing process is the thread pool processing mode when the application system is internal, the content of the log storage space record of each thread is obtained by using the MDC.getContext().clone operation before creating the thread pool. The recorded content includes the value of the unique identifier and other preset log variables, and the MDC.push() operation is performed during the creation of the thread pool, and the value of the log variable of each thread's log storage space record is added to the creation. The execution code of the thread pool is such that the unique identifier is passed during the execution of each thread in the thread pool.
需要说明的是,MDC.getContext()操作用于获取每个线程的存储空间的内容,在线程池中,若多个线程同时访问同一个资源,会出现线程竞争资源的情况,因此,对MDC.getContext()做clone操作,避免线程资源竞争引发执行错误。It should be noted that the MDC.getContext() operation is used to obtain the content of the storage space of each thread. In the thread pool, if multiple threads access the same resource at the same time, the thread will compete for resources. Therefore, for the MDC. .getContext() does a clone operation to avoid thread resource contention causing execution errors.
在图3对应的实施例中,针对单线程处理方式,通过MDC.put()操作将唯一标识码写入预设的日志变量中,实现唯一标识码在单线程中的传递,针对线程池处理方式,在创建线程池之前使用MDC.getContext().clone操作获取每个线程的日志存储空间的内容,并在 创建线程池的过程中进行MDC.push()操作,将每个线程的日志存储空间的内容添加到线程池的日志存储空间中,实现唯一标识码在线程池中的传递,通过唯一标识码在单线程和线程池中的传递,为得到完整的日志链提供条件。In the embodiment corresponding to FIG. 3, for the single-thread processing mode, the unique identification code is written into the preset log variable by the MDC.put() operation, so that the unique identification code is transmitted in a single thread, and the thread pool is processed. In this way, use the MDC.getContext().clone operation to get the contents of the log storage space of each thread before creating the thread pool, and perform the MDC.push() operation during the process of creating the thread pool, and store the log of each thread. The content of the space is added to the log storage space of the thread pool, and the delivery of the unique identification code in the thread pool is realized, and the delivery of the unique identification code in the single thread and the thread pool provides conditions for obtaining a complete log chain.
在图1对应的实施例的基础上,在步骤S4将包含唯一标识码的日志信息输出到日志库之后,还可以进一步对日志库中的日志信息进行管理,如图4所示,该日志收集方法还包括:On the basis of the embodiment corresponding to FIG. 1, after the log information including the unique identification code is output to the log library in step S4, the log information in the log library may be further managed, as shown in FIG. 4, the log collection is performed. The method also includes:
若日志库中存在日志生成时间早于预设时间的历史日志信息,则删除该历史日志信息。If the history log information of the log generation time earlier than the preset time exists, the history log information is deleted.
具体地,由于日志库中日志收集量大,占用内存空间较大,可以对日志库中的日志文件进行定期删除处理,每隔预定的时间间隔判断日志库中是否存在日志生成时间早于预设时间的历史日志信息,若存在,则删除该历史日志信息。Specifically, because the log collection in the log library is large and the memory space is large, the log files in the log library can be periodically deleted. The log generation time in the log library is determined to be earlier than the preset. The historical log information of the time, if it exists, delete the historical log information.
需要说明的是,预设时间可以根据当前日志文件的大小进行动态调节,当日志文件较大时,该预设时间可以接近当前时间,即删除的历史日志信息相对增加,当日志文件较小时,该预设时间可以远离当前时间,即删除的历史日志信息相对减少。It should be noted that the preset time can be dynamically adjusted according to the current log file size. When the log file is large, the preset time can be close to the current time, that is, the deleted history log information is relatively increased. When the log file is small, The preset time can be far away from the current time, that is, the deleted history log information is relatively reduced.
优选地,通过设置定时任务定时清理日志,例如使用Crontab命令,该命令用于设置周期性被执行的指令。具体设置方法包括如下步骤(1)至步骤(3),具体说明如下:Preferably, the log is periodically cleared by setting a timed task, such as using the Crontab command, which is used to set instructions that are periodically executed. The specific setting method includes the following steps (1) to (3), which are specifically described as follows:
(1)执行“crontab-e”命令;(1) Execute the "crontab-e" command;
(2)将***/1**/usr/bin/rm/openFalcon/apache-tomcat-7.0.57/bin/*.log-f>/dev/null2>&1写入对应的配置文件中;(2) Write ***/1**/usr/bin/rm/openFalcon/apache-tomcat-7.0.57/bin/*.log-f>/dev/null2>&1 into the corresponding configuration file;
其中,“***/1**/usr/bin/rm/openFalcon/apache-tomcat-7.0.57/bin/*.log-f>/dev/null2>&1”是指每天清理一次/usr/bin/rm/openFalcon/apache-tomcatAmong them, "***/1**/usr/bin/rm/openFalcon/apache-tomcat-7.0.57/bin/*.log-f>/dev/null2>&1" means to clean up /usr/ every day. Bin/rm/openFalcon/apache-tomcat
-7.0.57/bin/目录下以.log结尾的文件;a file ending in .log in the -7.0.57/bin/ directory;
(3)保存配置文件。(3) Save the configuration file.
在本申请实施中,通过定时删除日志生成时间早于预设时间的历史日志信息,释放日志库的内存,避免内存被过渡占用,有效提高各个应用系统的性能。In the implementation of the present application, the log data of the log library is generated by periodically deleting the log, and the memory of the log library is released to avoid the memory being occupied by the transition, thereby effectively improving the performance of each application system.
在以上实施例的基础之上,在步骤S6按照目标日志信息的生成时间顺序输出目标日志信息之后,还可以对目标日志信息进行分析,如图4所示,该日志收集方法还包括:On the basis of the above embodiment, after the target log information is output in the order of the generation of the target log information in step S6, the target log information may be analyzed. As shown in FIG. 4, the log collection method further includes:
S71:根据预设的关键字对目标日志信息进行分析,确认关键日志信息。S71: Analyze the target log information according to the preset keyword, and confirm the key log information.
在本申请实施例中,根据预设的关键字对步骤S6得到的目标日志信息进行分析,具体地,在目标日志信息中搜索预设的关键字,并将包含该预设的关键字的日志信息确认为 关键日志信息。In the embodiment of the present application, the target log information obtained in step S6 is analyzed according to a preset keyword, specifically, the preset keyword is searched in the target log information, and the log containing the preset keyword is included. The information is confirmed as critical log information.
预设的关键字具体可以是error、warn、not exit、failed等,还可以是时间、IP地址等,但并不限于此,其具体可以根据实际应用的需要进行设置,此处不做限制。The default keyword may be error, warn, not exit, failed, etc., and may be time, IP address, etc., but is not limited thereto, and may be set according to actual application requirements, and is not limited herein.
进一步地,根据关键字得到的关键日志信息包括但不限于重要日志内容、服务器IP地址,以及运行时间等。重要日志内容包含了用户的操作信息、当前运行状态以及报错信息等,运维人员可以根据重要日志内容快速定位问题,对出现异常的服务器IP地址进行及时维护,同时,在面对复杂的问题时,可以通过关键日志信息的运行时间在日志链中快速找到其对应的上下文进行问题定位。Further, the key log information obtained according to the keyword includes, but is not limited to, important log content, server IP address, and running time. The important log content contains the user's operation information, current running status, and error information. The operation and maintenance personnel can quickly locate the problem based on the important log content, and timely maintain the abnormal server IP address. At the same time, in the face of complex problems. You can quickly find the corresponding context in the log chain through the running time of key log information to locate the problem.
S72:输出关键日志信息。S72: Output key log information.
具体地,关键日志信息的输出方式可以是直接将关键日志信息在日志链中进行标注,标注的方式可以是通过改变关键日志信息的字体或者颜色,以等使其区别于普通日志信息,以达到醒目的效果。关键日志信息的输出方式还可以是将关键日志信息单独输出到交互界面,或者将关键日志信息发送到预设的运维人员的信息接收地址中,具体的信息接收地址可以是邮箱或者即时通讯工具等,此处不做限制,使得相关运维人员能够及时对出现的问题进行处理,避免造成更大的损失。Specifically, the output mode of the key log information may be directly marking the key log information in the log chain, and the labeling may be performed by changing the font or color of the key log information, so as to distinguish it from the common log information, so as to achieve Eye-catching effect. The output of the key log information may also be that the key log information is separately output to the interactive interface, or the key log information is sent to the information receiving address of the preset operation and maintenance personnel. The specific information receiving address may be a mailbox or an instant messaging tool. Etc., there is no restriction here, so that the relevant operation and maintenance personnel can deal with the problems in time to avoid causing greater losses.
需要说明的是,发送关键日志信息的网络传输协议具体可以是超文本传输协议(HyperText Transfer Protocol,HTTP)、文件传输协议(File Transfer Protocol,FTP)或简单邮件传输协议(Simple Mail Transfer Protocol,SMTP)等方式。It should be noted that the network transmission protocol for transmitting key log information may specifically be HyperText Transfer Protocol (HTTP), File Transfer Protocol (FTP), or Simple Mail Transfer Protocol (SMTP). ) and other methods.
在图4对应的实施例中,通过预设的关键字对目标日志信息进行分析,确认关键日志信息,并对关键日志信息进行及时的输出,使得运维人员可以根据关键日志信息进行及时的问题定位,从而使得出现的异常问题能够快速得到解决,避免造成更大的损失,提高问题定位和系统维护效率。In the embodiment corresponding to FIG. 4, the target log information is analyzed by a preset keyword, the key log information is confirmed, and the key log information is output in time, so that the operation and maintenance personnel can perform timely problems according to the key log information. Positioning, so that the abnormal problems can be quickly solved, avoiding greater losses, improving problem location and system maintenance efficiency.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence of the steps in the above embodiments does not mean that the order of execution is performed. The order of execution of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
实施例2Example 2
对应于实施例1中的数据方法,图5示出与实施例1所示的日志收集方法一一对应的日志收集装置的原理框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the data method in the first embodiment, FIG. 5 is a schematic block diagram of the log collecting device corresponding to the log collecting method shown in the first embodiment. For the convenience of description, only the related to the embodiment of the present application is shown. section.
如图5所示,该日志收集装置包括标识生成模块50、标识添加模块51、标识传递模块52、日志收集模块53、日志提取模块54和日志输出模块55。各功能模块详细说明如下:As shown in FIG. 5, the log collection device includes an identifier generation module 50, an identifier addition module 51, an identifier delivery module 52, a log collection module 53, a log extraction module 54, and a log output module 55. Each function module is described in detail as follows:
标识生成模块50,用于接收用户发送的应用请求消息,并生成与应用请求消息对应 的唯一标识码;The identifier generating module 50 is configured to receive an application request message sent by the user, and generate a unique identifier code corresponding to the application request message.
标识添加模块51,用于将唯一标识码添加到应用请求消息中,形成请求指令;An identifier adding module 51, configured to add a unique identifier to the application request message to form a request instruction;
标识传递模块52,用于在对请求指令的响应处理过程中,将唯一标识码在该响应处理过程经过的应用系统或数据库中传递,使得该唯一标识码被写入该应用系统的日志信息中或该数据库中;The identifier delivery module 52 is configured to pass the unique identification code in the application system or database through which the response processing process passes during the response processing to the request instruction, so that the unique identification code is written into the log information of the application system. Or in the database;
日志收集模块53,用于将包含唯一标识码的日志信息输出到日志库;The log collection module 53 is configured to output log information including the unique identification code to the log library.
日志提取模块54,用于若请求指令执行失败,则根据请求指令中包含的唯一标识码,从日志库中提取包含该唯一标识码的目标日志信息;The log extraction module 54 is configured to: if the request instruction fails to be executed, extract the target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
日志输出模块55,用于按照目标日志信息的生成时间顺序输出目标日志信息。The log output module 55 is configured to output target log information according to a generation time sequence of the target log information.
进一步地,标识传递模块52包括:Further, the identity delivery module 52 includes:
第一传递单元520,用于当响应处理过程经过不同的应用系统时,将唯一标识码添加到不同的应用系统之间的交互消息中,以使唯一标识码通过交互消息进行传递;The first delivery unit 520 is configured to add a unique identification code to an interaction message between different application systems when the response processing process passes through different application systems, so that the unique identification code is transmitted through the interaction message;
第二传递单元521,用于当响应处理过程经过应用系统内部时,将唯一标识码在单线程或线程池中传递;a second delivery unit 521, configured to: when the response processing process passes inside the application system, pass the unique identification code in a single thread or a thread pool;
第三传递单元522,用于当响应处理过程调用数据库中的数据表时,将唯一标识码记录在数据表的预设字段。The third transmitting unit 522 is configured to record the unique identification code in a preset field of the data table when the data table in the database is invoked in response to the processing procedure.
进一步地,第二传递单元521包括:Further, the second delivery unit 521 includes:
单线程传递子单元5210,用于若响应处理过程经过应用系统内部时为单线程处理方式,则将唯一标识码传入单线程,并在单线程的执行过程中传递唯一标识码;The single-threaded delivery sub-unit 5210 is configured to: when the response processing process passes through the application system, is a single-thread processing manner, then pass the unique identification code to the single thread, and deliver the unique identification code in the single-thread execution process;
线程池传递子单元5211,用于若响应处理过程经过应用系统内部时为线程池处理方式,则在创建线程池之前获取每个线程的日志存储空间的内容,并在线程池的处理过程中进行push操作,以使唯一标识码在线程池中传递,其中,push操作用于添加每个线程的日志存储空间的内容,日志存储空间的内容包含唯一标识码。The thread pool delivery sub-unit 5211 is configured to obtain the content of the log storage space of each thread before the thread pool is created, and the thread pool processing process is performed during the process of processing the thread pool. The push operation causes the unique identification code to be passed in the thread pool, wherein the push operation is used to add the contents of the log storage space of each thread, and the content of the log storage space contains the unique identification code.
进一步地,该日志收集装置还包括:Further, the log collection device further includes:
日志删除模块56,用于若日志库中存在日志生成时间早于预设时间的历史日志信息,则删除历史日志信息。The log deletion module 56 is configured to delete the historical log information if there is historical log information in the log library that is earlier than the preset time.
进一步地,该日志收集装置还包括:Further, the log collection device further includes:
日志分析模块57,用于根据预设的关键字对目标日志信息进行分析,确认关键日志信息;The log analysis module 57 is configured to analyze the target log information according to the preset keyword, and confirm the key log information;
关键日志输出模块58,用于输出关键日志信息。The key log output module 58 is configured to output key log information.
本实施例提供的一种日志收集装置中各模块实现各自功能的过程,具体可参考前述方法实施例1的描述,此处不再赘述。The process of implementing the respective functions of each module in the log collection device provided in this embodiment is specifically described in the foregoing method, and is not described here.
实施例3Example 3
本实施例提供一计算机可读存储介质,该计算机可读存储介质上存储有计算机可读指令,该计算机可读指令被处理器执行时实现实施例1中日志收集方法,为避免重复,这里不再赘述。或者,该计算机可读指令被处理器执行时实现实施例2中日志收集装置中各模块/单元的功能,为避免重复,这里不再赘述。The embodiment provides a computer readable storage medium, where the computer readable storage medium is stored with the computer readable instructions, and the computer readable instructions are executed by the processor to implement the log collection method in Embodiment 1. Let me repeat. Alternatively, when the computer readable instructions are executed by the processor, the functions of the modules/units in the log collection device in Embodiment 2 are implemented. To avoid repetition, details are not described herein again.
可以理解地,所述计算机可读存储介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号和电信信号等。It will be understood that the computer readable storage medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard drive, a magnetic disk, an optical disk, a computer memory, a read only memory ( ROM, Read-Only Memory), Random Access Memory (RAM), electrical carrier signals, and telecommunications signals.
实施例4Example 4
图6是本申请一实施例提供的终端设备的示意图。如图6所示,该实施例的终端设备6包括:处理器60、存储器61以及存储在存储器61中并可在处理器60上运行的计算机可读指令62。处理器60执行计算机可读指令62时实现上述各个日志收集方法实施例中的步骤,例如图1所示的步骤S1至步骤S6。或者,处理器60执行计算机可读指令62时实现上述各装置实施例中各模块/单元的功能,例如图5所示模块50至模块55的功能。FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present application. As shown in FIG. 6, the terminal device 6 of this embodiment includes a processor 60, a memory 61, and computer readable instructions 62 stored in the memory 61 and operable on the processor 60. The processor 60, when executing the computer readable instructions 62, implements the steps in the various log collection method embodiments described above, such as steps S1 through S6 shown in FIG. Alternatively, processor 60, when executing computer readable instructions 62, implements the functions of the various modules/units of the various apparatus embodiments described above, such as the functions of modules 50 through 55 of FIG.
示例性的,计算机可读指令62可以被分割成一个或多个模块/单元,一个或者多个模块/单元被存储在存储器61中,并由处理器60执行,以完成本申请。一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述计算机可读指令62在终端设备6中的执行过程。例如,计算机可读指令62可以被分割成标识生成模块、标识添加模块、标识传递模块、日志收集模块、日志提取模块和日志输出模块,各模块的具体功能如实施例2所示,为避免重复,这里不再赘述。Illustratively, computer readable instructions 62 may be partitioned into one or more modules/units, one or more modules/units being stored in memory 61 and executed by processor 60 to complete the application. The one or more modules/units may be a series of computer readable instruction segments capable of performing a particular function for describing the execution of computer readable instructions 62 in the terminal device 6. For example, the computer readable instructions 62 may be divided into an identifier generation module, an identifier addition module, an identifier delivery module, a log collection module, a log extraction module, and a log output module. The specific functions of each module are as shown in Embodiment 2, in order to avoid duplication. , no longer repeat them here.
终端设备6可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。终端设备可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是终端设备6的示例,并不构成对终端设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如终端设备还可以包括输入输出设备、网络接入设备、总线等。The terminal device 6 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The terminal device may include, but is not limited to, the processor 60, the memory 61. It will be understood by those skilled in the art that FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation of the terminal device 6, and may include more or less components than those illustrated, or combine some components or different components. For example, the terminal device may further include an input/output device, a network access device, a bus, and the like.
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application  Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 60 may be a central processing unit (CPU), or may be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
存储器61可以是终端设备6的内部存储单元,例如终端设备6的硬盘或内存。存储器61也可以是终端设备6的外部存储设备,例如终端设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器61还可以既包括终端设备6的内部存储单元也包括外部存储设备。存储器61用于存储计算机可读指令以及终端设备所需的其他可读指令和数据。存储器61还可以用于暂时地存储已经输出或者将要输出的数据。The memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk provided on the terminal device 6, a smart memory card (SMC), a Secure Digital (SD) card, and a flash memory card (Flash). Card) and so on. Further, the memory 61 may also include both an internal storage unit of the terminal device 6 and an external storage device. The memory 61 is used to store computer readable instructions as well as other readable instructions and data required by the terminal device. The memory 61 can also be used to temporarily store data that has been output or is about to be output.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。It will be apparent to those skilled in the art that, for convenience and brevity of description, only the division of each functional unit and module described above is exemplified. In practical applications, the above functions may be assigned to different functional units as needed. The module is completed by dividing the internal structure of the device into different functional units or modules to perform all or part of the functions described above.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing embodiments. The technical solutions described in the examples are modified or equivalently replaced with some of the technical features; and the modifications or substitutions do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in Within the scope of protection of this application.

Claims (20)

  1. 一种日志收集方法,其特征在于,所述日志收集方法包括:A log collection method, the log collection method includes:
    接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;Receiving an application request message sent by the user, and generating a unique identification code corresponding to the application request message;
    将所述唯一标识码添加到所述应用请求消息中,形成请求指令;Adding the unique identification code to the application request message to form a request instruction;
    在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;In the process of responding to the request instruction, transmitting the unique identification code in an application system or database through which the response processing process passes, so that the unique identification code is written into the log information of the application system. Or in the database;
    将包含所述唯一标识码的日志信息输出到日志库;Outputting log information including the unique identification code to a log library;
    若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;If the request instruction fails to be executed, extracting target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
    按照所述目标日志信息的生成时间顺序输出所述目标日志信息。The target log information is output in the order in which the target log information is generated.
  2. 如权利要求1所述的日志收集方法,其特征在于,所述在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中包括:The log collection method according to claim 1, wherein in the response processing to the request instruction, the unique identification code is transmitted in an application system or a database through which the response processing process passes, Having the unique identification code written in the log information of the application system or the database includes:
    当所述响应处理过程经过不同的应用系统时,将所述唯一标识码添加到所述不同的应用系统之间的交互消息中,以使所述唯一标识码通过所述交互消息进行传递;When the response processing process passes through different application systems, adding the unique identification code to the interaction message between the different application systems, so that the unique identification code is delivered by the interaction message;
    当所述响应处理过程经过所述应用系统内部时,将所述唯一标识码在单线程或线程池中传递;Transmitting the unique identification code in a single thread or a thread pool when the response processing process passes inside the application system;
    当所述响应处理过程调用所述数据库中的数据表时,将所述唯一标识码记录在所述数据表的预设字段。When the response processing procedure calls the data table in the database, the unique identification code is recorded in a preset field of the data table.
  3. 如权利要求2所述的日志收集方法,其特征在于,所述当所述响应处理过程经过所述应用系统内部时,将所述唯一标识码在单线程或线程池中传递包括:The method of claim 2, wherein the transmitting the unique identification code in a single thread or a thread pool when the response processing process passes inside the application system comprises:
    若所述响应处理过程经过所述应用系统内部时为单线程处理方式,则将所述唯一标识码传入所述单线程,并在所述单线程的执行过程中传递所述唯一标识码;And if the response processing process is a single-thread processing manner when the application system is internal, the unique identifier code is transmitted to the single thread, and the unique identifier code is delivered during execution of the single thread;
    若所述响应处理过程经过所述应用系统内部时为线程池处理方式,则在创建线程池之前获取每个线程的日志存储空间的内容,并在线程池的处理过程中进行push操作,以使所述唯一标识码在所述线程池中传递,其中,所述push操作用于添加所述每个线程的日志存储空间的内容,所述日志存储空间的内容包含所述唯一标识码。If the response processing process is internal to the application system, the thread pool processing mode is obtained, and the content of the log storage space of each thread is obtained before the thread pool is created, and a push operation is performed during the processing of the thread pool, so that The unique identification code is passed in the thread pool, wherein the push operation is used to add content of a log storage space of each thread, and the content of the log storage space includes the unique identification code.
  4. 如权利要求1所述的日志收集方法,其特征在于,在所述将包含所述唯一标识码的 目标日志信息输出到日志库之后,所述日志收集方法还包括:The method for collecting logs according to claim 1, wherein after the outputting the target log information including the unique identification code to the log repository, the log collecting method further includes:
    若所述日志库中存在日志生成时间早于预设时间的历史日志信息,则删除所述历史日志信息。If the log log has historical log information whose log generation time is earlier than the preset time, the historical log information is deleted.
  5. 如权利要求1至4任一项所述的日志收集方法,其特征在于,在所述按照所述目标日志信息的生成时间顺序输出所述目标日志信息之后,所述日志收集方法还包括:The log collection method according to any one of claims 1 to 4, wherein after the outputting the target log information in the order of the generation of the target log information, the log collection method further includes:
    根据预设的关键字对所述目标日志信息进行分析,确认关键日志信息;The target log information is analyzed according to a preset keyword to confirm key log information;
    输出所述关键日志信息。The key log information is output.
  6. 一种日志收集装置,其特征在于,所述日志收集装置包括:A log collecting device, wherein the log collecting device comprises:
    标识生成模块,用于接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;An identifier generating module, configured to receive an application request message sent by a user, and generate a unique identifier code corresponding to the application request message;
    标识添加模块,用于将所述唯一标识码添加到所述应用请求消息中,形成请求指令;An identifier adding module, configured to add the unique identifier to the application request message to form a request instruction;
    标识传递模块,用于在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;An identifier delivery module, configured to pass the unique identification code in an application system or database through which the response processing process passes during response processing to the request instruction, such that the unique identification code is written into the In the log information of the application system or in the database;
    日志收集模块,用于将包含所述唯一标识码的日志信息输出到日志库;a log collection module, configured to output log information including the unique identification code to a log library;
    日志提取模块,用于若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;a log extraction module, configured to extract target log information including the unique identification code from the log library according to the unique identification code included in the request instruction, if the execution of the request instruction fails;
    日志输出模块,用于按照所述目标日志信息的生成时间顺序输出所述目标日志信息。And a log output module, configured to output the target log information according to a generation time sequence of the target log information.
  7. 如权利要求6所述的日志收集装置,其特征在于,所述标识传递模块包括:The log collection device of claim 6, wherein the identification delivery module comprises:
    第一传递单元,用于当所述响应处理过程经过不同的应用系统时,将所述唯一标识码添加到所述不同的应用系统之间的交互消息中,以使所述唯一标识码通过所述交互消息进行传递;a first delivery unit, configured to add the unique identification code to an interaction message between the different application systems when the response processing process passes through different application systems, so that the unique identification code passes through the Transmitting an interactive message;
    第二传递单元,用于当所述响应处理过程经过所述应用系统内部时,将所述唯一标识码在单线程或线程池中传递;a second delivery unit, configured to: when the response processing process passes inside the application system, pass the unique identification code in a single thread or a thread pool;
    第三传递单元,用于当所述响应处理过程调用所述数据库中的数据表时,将所述唯一标识码记录在所述数据表的预设字段;a third delivery unit, configured to record the unique identification code in a preset field of the data table when the response processing procedure invokes a data table in the database;
    所述第二传递单元包括:The second delivery unit includes:
    单线程传递子单元,用于若所述响应处理过程经过所述应用系统内部时为单线程处理 方式,则将所述唯一标识码传入所述单线程,并在所述单线程的执行过程中传递所述唯一标识码;a single thread transfer subunit, configured to pass the unique identification code to the single thread and execute the single thread in the single thread processing mode if the response processing process passes through the internal application system Passing the unique identification code;
    线程池传递子单元,用于若所述响应处理过程经过所述应用系统内部时为线程池处理方式,则在创建线程池之前获取每个线程的日志存储空间的内容,并在线程池的处理过程中进行push操作,以使所述唯一标识码在所述线程池中传递,其中,所述push操作用于添加所述每个线程的日志存储空间的内容,所述日志存储空间的内容包含所述唯一标识码。The thread pool transfer subunit is configured to: if the response processing process passes through the application system, the thread pool processing mode, obtain the content of the log storage space of each thread before creating the thread pool, and process the thread pool Pushing in the process, so that the unique identification code is passed in the thread pool, wherein the push operation is used to add content of the log storage space of each thread, and the content of the log storage space includes The unique identification code.
  8. 如权利要求7所述的日志收集装置,其特征在于,所述第二传递单元包括:The log collection device of claim 7, wherein the second delivery unit comprises:
    单线程传递子单元,用于若所述响应处理过程经过所述应用系统内部时为单线程处理方式,则将所述唯一标识码传入所述单线程,并在所述单线程的执行过程中传递所述唯一标识码;a single thread transfer subunit, configured to pass the unique identification code to the single thread and execute the single thread in the single thread processing mode if the response processing process passes through the internal application system Passing the unique identification code;
    线程池传递子单元,用于若所述响应处理过程经过所述应用系统内部时为线程池处理方式,则在创建线程池之前获取每个线程的日志存储空间的内容,并在线程池的处理过程中进行push操作,以使所述唯一标识码在所述线程池中传递,其中,所述push操作用于添加所述每个线程的日志存储空间的内容,所述日志存储空间的内容包含所述唯一标识码。The thread pool transfer subunit is configured to: if the response processing process passes through the application system, the thread pool processing mode, obtain the content of the log storage space of each thread before creating the thread pool, and process the thread pool Pushing in the process, so that the unique identification code is passed in the thread pool, wherein the push operation is used to add content of the log storage space of each thread, and the content of the log storage space includes The unique identification code.
  9. 如权利要求6所述的日志收集装置,其特征在于,所述的日志收集装置还包括:The log collection device of claim 6, wherein the log collection device further comprises:
    日志删除模块,用于若日志库中存在日志生成时间早于预设时间的历史日志信息,则删除历史日志信息。The log deletion module is configured to delete historical log information if there is historical log information in the log library that is generated earlier than the preset time.
  10. 如权利要求6至9任一项所述的日志收集装置,其特征在于,所述的日志收集装置还包括:The log collecting device according to any one of claims 6 to 9, wherein the log collecting device further comprises:
    日志删除模块,用于若所述日志库中存在日志生成时间早于预设时间的历史日志信息,则删除所述历史日志信息;a log deletion module, configured to delete the historical log information if a history log information of a log generation time earlier than a preset time exists in the log repository;
    日志分析模块,用于根据预设的关键字对所述目标日志信息进行分析,确认关键日志信息;a log analysis module, configured to analyze the target log information according to a preset keyword, and confirm the key log information;
    关键日志输出模块,用于输出所述关键日志信息。A key log output module for outputting the key log information.
  11. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:A terminal device comprising a memory, a processor, and computer readable instructions stored in the memory and operable on the processor, wherein the processor executes the computer readable instructions as follows step:
    接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;Receiving an application request message sent by the user, and generating a unique identification code corresponding to the application request message;
    将所述唯一标识码添加到所述应用请求消息中,形成请求指令;Adding the unique identification code to the application request message to form a request instruction;
    在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;In the process of responding to the request instruction, transmitting the unique identification code in an application system or database through which the response processing process passes, so that the unique identification code is written into the log information of the application system. Or in the database;
    将包含所述唯一标识码的日志信息输出到日志库;Outputting log information including the unique identification code to a log library;
    若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;If the request instruction fails to be executed, extracting target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
    按照所述目标日志信息的生成时间顺序输出所述目标日志信息。The target log information is output in the order in which the target log information is generated.
  12. 如权利要求11所述的终端设备,其特征在于,所述在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中包括:The terminal device according to claim 11, wherein in the response processing to the request instruction, the unique identification code is transferred in an application system or a database through which the response processing process passes, so that The unique identification code is written into the log information of the application system or the database includes:
    当所述响应处理过程经过不同的应用系统时,将所述唯一标识码添加到所述不同的应用系统之间的交互消息中,以使所述唯一标识码通过所述交互消息进行传递;When the response processing process passes through different application systems, adding the unique identification code to the interaction message between the different application systems, so that the unique identification code is delivered by the interaction message;
    当所述响应处理过程经过所述应用系统内部时,将所述唯一标识码在单线程或线程池中传递;Transmitting the unique identification code in a single thread or a thread pool when the response processing process passes inside the application system;
    当所述响应处理过程调用所述数据库中的数据表时,将所述唯一标识码记录在所述数据表的预设字段。When the response processing procedure calls the data table in the database, the unique identification code is recorded in a preset field of the data table.
  13. 如权利要求12所述的终端设备,其特征在于,所述当所述响应处理过程经过所述应用系统内部时,将所述唯一标识码在单线程或线程池中传递包括:The terminal device according to claim 12, wherein the transmitting the unique identification code in a single thread or a thread pool when the response processing process passes inside the application system comprises:
    若所述响应处理过程经过所述应用系统内部时为单线程处理方式,则将所述唯一标识码传入所述单线程,并在所述单线程的执行过程中传递所述唯一标识码;And if the response processing process is a single-thread processing manner when the application system is internal, the unique identifier code is transmitted to the single thread, and the unique identifier code is delivered during execution of the single thread;
    若所述响应处理过程经过所述应用系统内部时为线程池处理方式,则在创建线程池之前获取每个线程的日志存储空间的内容,并在线程池的处理过程中进行push操作,以使所述唯一标识码在所述线程池中传递,其中,所述push操作用于添加所述每个线程的日志存储空间的内容,所述日志存储空间的内容包含所述唯一标识码。If the response processing process is internal to the application system, the thread pool processing mode is obtained, and the content of the log storage space of each thread is obtained before the thread pool is created, and a push operation is performed during the processing of the thread pool, so that The unique identification code is passed in the thread pool, wherein the push operation is used to add content of a log storage space of each thread, and the content of the log storage space includes the unique identification code.
  14. 如权利要求11所述的终端设备,其特征在于,在所述将包含所述唯一标识码的目标日志信息输出到日志库之后,所述处理器执行所述计算机可读指令时还实现如下步骤:The terminal device according to claim 11, wherein after the outputting the target log information including the unique identification code to the log library, the processor further implements the following steps when the computer readable instructions are executed :
    若所述日志库中存在日志生成时间早于预设时间的历史日志信息,则删除所述历史日志信息。If the log log has historical log information whose log generation time is earlier than the preset time, the historical log information is deleted.
  15. 如权利要求11至14任一项所述的终端设备,其特征在于,在所述按照所述目标 日志信息的生成时间顺序输出所述目标日志信息之后,所述处理器执行所述计算机可读指令时还实现如下步骤:The terminal device according to any one of claims 11 to 14, wherein after the outputting the target log information in the order of generation of the target log information, the processor executes the computer readable The instructions also implement the following steps:
    根据预设的关键字对所述目标日志信息进行分析,确认关键日志信息;The target log information is analyzed according to a preset keyword to confirm key log information;
    输出所述关键日志信息。The key log information is output.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:A computer readable storage medium storing computer readable instructions, wherein the computer readable instructions, when executed by a processor, implement the following steps:
    接收用户发送的应用请求消息,并生成与所述应用请求消息对应的唯一标识码;Receiving an application request message sent by the user, and generating a unique identification code corresponding to the application request message;
    将所述唯一标识码添加到所述应用请求消息中,形成请求指令;Adding the unique identification code to the application request message to form a request instruction;
    在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中;In the process of responding to the request instruction, transmitting the unique identification code in an application system or database through which the response processing process passes, so that the unique identification code is written into the log information of the application system. Or in the database;
    将包含所述唯一标识码的日志信息输出到日志库;Outputting log information including the unique identification code to a log library;
    若所述请求指令执行失败,则根据所述请求指令中包含的所述唯一标识码,从所述日志库中提取包含所述唯一标识码的目标日志信息;If the request instruction fails to be executed, extracting target log information including the unique identification code from the log library according to the unique identification code included in the request instruction;
    按照所述目标日志信息的生成时间顺序输出所述目标日志信息。The target log information is output in the order in which the target log information is generated.
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述在对所述请求指令的响应处理过程中,将所述唯一标识码在所述响应处理过程经过的应用系统或数据库中传递,使得所述唯一标识码被写入所述应用系统的日志信息中或所述数据库中包括:The computer readable storage medium according to claim 16, wherein said unique identification code is in an application system or database through which said response processing process passes in response processing to said request instruction Passing, such that the unique identification code is written into the log information of the application system or the database includes:
    当所述响应处理过程经过不同的应用系统时,将所述唯一标识码添加到所述不同的应用系统之间的交互消息中,以使所述唯一标识码通过所述交互消息进行传递;When the response processing process passes through different application systems, adding the unique identification code to the interaction message between the different application systems, so that the unique identification code is delivered by the interaction message;
    当所述响应处理过程经过所述应用系统内部时,将所述唯一标识码在单线程或线程池中传递;Transmitting the unique identification code in a single thread or a thread pool when the response processing process passes inside the application system;
    当所述响应处理过程调用所述数据库中的数据表时,将所述唯一标识码记录在所述数据表的预设字段。When the response processing procedure calls the data table in the database, the unique identification code is recorded in a preset field of the data table.
  18. 如权利要求17所述的计算机可读存储介质,其特征在于,所述当所述响应处理过程经过所述应用系统内部时,将所述唯一标识码在单线程或线程池中传递包括:The computer readable storage medium of claim 17, wherein the transferring the unique identification code in a single thread or a thread pool when the response processing process passes inside the application system comprises:
    若所述响应处理过程经过所述应用系统内部时为单线程处理方式,则将所述唯一标识码传入所述单线程,并在所述单线程的执行过程中传递所述唯一标识码;And if the response processing process is a single-thread processing manner when the application system is internal, the unique identifier code is transmitted to the single thread, and the unique identifier code is delivered during execution of the single thread;
    若所述响应处理过程经过所述应用系统内部时为线程池处理方式,则在创建线程池之前获取每个线程的日志存储空间的内容,并在线程池的处理过程中进行push操作,以使所 述唯一标识码在所述线程池中传递,其中,所述push操作用于添加所述每个线程的日志存储空间的内容,所述日志存储空间的内容包含所述唯一标识码。If the response processing process is internal to the application system, the thread pool processing mode is obtained, and the content of the log storage space of each thread is obtained before the thread pool is created, and a push operation is performed during the processing of the thread pool, so that The unique identification code is passed in the thread pool, wherein the push operation is used to add content of a log storage space of each thread, and the content of the log storage space includes the unique identification code.
  19. 如权利要求16所述的计算机可读存储介质,其特征在于,在所述将包含所述唯一标识码的目标日志信息输出到日志库之后,所述计算机可读指令被处理器执行时还实现如下步骤:A computer readable storage medium according to claim 16, wherein said computer readable instructions are further executed by said processor after said target log information including said unique identification code is output to a log library The following steps:
    若所述日志库中存在日志生成时间早于预设时间的历史日志信息,则删除所述历史日志信息。If the log log has historical log information whose log generation time is earlier than the preset time, the historical log information is deleted.
  20. 如权利要求16至19任一项所述的计算机可读存储介质,其特征在于,在所述按照所述目标日志信息的生成时间顺序输出所述目标日志信息之后,所述计算机可读指令被处理器执行时还实现如下步骤:The computer readable storage medium according to any one of claims 16 to 19, wherein said computer readable instruction is after said outputting said target log information in order of generation of said target log information The processor also implements the following steps when executed:
    根据预设的关键字对所述目标日志信息进行分析,确认关键日志信息;The target log information is analyzed according to a preset keyword to confirm key log information;
    输出所述关键日志信息。The key log information is output.
PCT/CN2018/077223 2018-01-08 2018-02-26 Log collection method, device, terminal apparatus, and storage medium WO2019134226A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810014123.9A CN108459939B (en) 2018-01-08 2018-01-08 Log collection method and device, terminal equipment and storage medium
CN201810014123.9 2018-01-08

Publications (1)

Publication Number Publication Date
WO2019134226A1 true WO2019134226A1 (en) 2019-07-11

Family

ID=63220492

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/077223 WO2019134226A1 (en) 2018-01-08 2018-02-26 Log collection method, device, terminal apparatus, and storage medium

Country Status (2)

Country Link
CN (1) CN108459939B (en)
WO (1) WO2019134226A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11716396B1 (en) 2021-08-27 2023-08-01 Oracle International Corporation System and method for providing unique identifiers for use with enterprise application environments

Families Citing this family (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109039782A (en) * 2018-09-25 2018-12-18 郑州云海信息技术有限公司 A kind of cluster log recording method and relevant apparatus
CN110969457A (en) * 2018-09-29 2020-04-07 中国移动通信集团浙江有限公司 Mobile application log collection method and system
CN109271388A (en) * 2018-09-29 2019-01-25 北京奇虎科技有限公司 A kind of generation method and terminal device of Identity Code
CN111143154A (en) * 2018-11-06 2020-05-12 招商局国际信息技术有限公司 Wharf operating system operation monitoring method and device, server and storage medium
CN109688198B (en) * 2018-11-23 2022-05-13 四川九洲电器集团有限责任公司 Distributed system and fault detection method
CN109474698A (en) * 2018-12-14 2019-03-15 平安城市建设科技(深圳)有限公司 Access request labeling method, device, equipment and storage medium
CN109726085A (en) * 2018-12-29 2019-05-07 云智慧(北京)科技有限公司 Method and system for tracking performance problem
CN110083581B (en) * 2019-03-12 2024-04-05 平安科技(深圳)有限公司 Log tracing method and device, storage medium and computer equipment
CN110083509B (en) * 2019-04-30 2022-09-20 新华三信息安全技术有限公司 Method and device for arranging log data
CN110245074B (en) * 2019-05-21 2024-05-17 中国平安财产保险股份有限公司 Log record generation method and device, storage medium and server
CN110321271B (en) * 2019-06-03 2022-05-31 平安科技(深圳)有限公司 Method, device, equipment and storage medium for acquiring abnormal information based on Monkey
CN112035311B (en) * 2019-06-04 2024-07-12 腾讯科技(深圳)有限公司 Program logic monitoring method and device
CN110474809A (en) * 2019-08-20 2019-11-19 北京百度网讯科技有限公司 Method and apparatus for output information
CN110505238B (en) * 2019-09-06 2022-01-21 杭州安恒信息技术股份有限公司 EDR-based message queue processing device and method
CN112579552A (en) * 2019-09-30 2021-03-30 杭州海康威视数字技术股份有限公司 Log storage and calling method, device and system
CN111143311B (en) * 2019-12-13 2023-10-13 东软集团股份有限公司 Inter-application association determination and log association search methods, devices, media and equipment
CN111190792B (en) * 2019-12-20 2023-10-27 中移(杭州)信息技术有限公司 Log storage method and device, electronic equipment and readable storage medium
CN111199423B (en) * 2019-12-25 2024-09-20 平安证券股份有限公司 User behavior track generation method, device, equipment and storage medium
CN111367867B (en) * 2020-03-05 2023-03-21 腾讯云计算(北京)有限责任公司 Log information processing method and device, electronic equipment and storage medium
CN111459756A (en) * 2020-03-30 2020-07-28 深圳市金蝶天燕云计算股份有限公司 Log processing method and related equipment
CN111625424A (en) * 2020-05-28 2020-09-04 广东浪潮大数据研究有限公司 Positioning method, device, equipment and readable storage medium
CN112118286B (en) * 2020-08-04 2021-08-17 紫光云(南京)数字技术有限公司 Multi-thread link tracking method and device based on MDC and computer readable storage medium
CN112422337A (en) * 2020-11-11 2021-02-26 网宿科技股份有限公司 Method, system and device for generating log identification
CN112559476B (en) * 2020-12-16 2023-07-21 中国平安人寿保险股份有限公司 Log storage method for improving performance of target system and related equipment thereof
CN113010377B (en) * 2021-03-03 2024-06-14 中国工商银行股份有限公司 Method and device for collecting operation log of job
CN112925662B (en) * 2021-03-25 2024-02-27 支付宝(杭州)信息技术有限公司 Identification generation method and device
CN113608952B (en) * 2021-06-18 2024-02-27 云南昆钢电子信息科技有限公司 System fault processing method and system based on log construction supporting environment
CN114546697A (en) * 2022-02-21 2022-05-27 联想(北京)有限公司 Information processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103684898A (en) * 2012-09-14 2014-03-26 阿里巴巴集团控股有限公司 Method and device for monitoring operation of user request in distributed system
CN105138615A (en) * 2015-08-10 2015-12-09 北京思特奇信息技术股份有限公司 Method and system for building big data distributed log
CN106502874A (en) * 2016-10-26 2017-03-15 南京途牛科技有限公司 A kind of call chain tracking
CN107229555A (en) * 2017-05-04 2017-10-03 北京小度信息科技有限公司 Mark generating method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6609198B1 (en) * 1999-08-05 2003-08-19 Sun Microsystems, Inc. Log-on service providing credential level change without loss of session continuity
CN103970843B (en) * 2014-04-28 2017-09-19 东华大学 Conversation combining method based on UUID in a kind of Web log integrities
CN106202219A (en) * 2016-06-27 2016-12-07 安徽科成信息科技有限公司 A kind of update method of network monitoring daily record
CN106354765B (en) * 2016-08-19 2020-06-26 广东亿迅科技有限公司 Log analysis system and method based on distributed acquisition
CN107018042B (en) * 2017-04-13 2020-03-20 广东神马搜索科技有限公司 Tracking method and tracking system for online service system
CN107391762B (en) * 2017-08-28 2021-02-05 京信通信系统(中国)有限公司 Log data processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103684898A (en) * 2012-09-14 2014-03-26 阿里巴巴集团控股有限公司 Method and device for monitoring operation of user request in distributed system
CN105138615A (en) * 2015-08-10 2015-12-09 北京思特奇信息技术股份有限公司 Method and system for building big data distributed log
CN106502874A (en) * 2016-10-26 2017-03-15 南京途牛科技有限公司 A kind of call chain tracking
CN107229555A (en) * 2017-05-04 2017-10-03 北京小度信息科技有限公司 Mark generating method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11716396B1 (en) 2021-08-27 2023-08-01 Oracle International Corporation System and method for providing unique identifiers for use with enterprise application environments

Also Published As

Publication number Publication date
CN108459939A (en) 2018-08-28
CN108459939B (en) 2020-06-23

Similar Documents

Publication Publication Date Title
WO2019134226A1 (en) Log collection method, device, terminal apparatus, and storage medium
US11366686B1 (en) Managing user data in a multitenant deployment
US11716260B2 (en) Hybrid execution of playbooks including custom code
US11922232B2 (en) Responding to incidents identified by an information technology and security operations application using a mobile application
CN108536761B (en) Report data query method and server
US11238036B2 (en) System performance logging of complex remote query processor query operations
US11880558B1 (en) Interface layout profiles including interface actions in an information technology and security operations application
US11615082B1 (en) Using a data store and message queue to ingest data for a data intake and query system
US11238012B1 (en) Log data extraction from data chunks of an isolated execution environment
US20220156267A1 (en) Revising catalog metadata based on parsing queries
US12050597B2 (en) Search-time field extraction in a data intake and query system
US12079175B2 (en) Streaming synthesis of distributed traces from machine logs
US10891284B2 (en) Computing and replicating event deltas for mutable events in a distributed system
US11966797B2 (en) Indexing data at a data intake and query system based on a node capacity threshold
US20150081701A1 (en) Systems and methods for data flow exploration
US20190098068A1 (en) Customizable load balancing in a user behavior analytics deployment
US12019634B1 (en) Reassigning a processing node from downloading to searching a data group
WO2021042849A1 (en) Cloud platform, service processing method, command interface and computer device
US11902306B1 (en) Advanced persistent threat detection by an information technology and security operations application
US11687487B1 (en) Text files updates to an active processing pipeline
US11593477B1 (en) Expediting processing of selected events on a time-limited basis
US11886844B1 (en) Updating reusable custom functions across playbooks
US11892976B2 (en) Enhanced search performance using data model summaries stored in a remote data store
US11789950B1 (en) Dynamic storage and deferred analysis of data stream events
CN113704790A (en) Abnormal log information summarizing method and computer equipment

Legal Events

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

Ref document number: 18898635

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13.10.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18898635

Country of ref document: EP

Kind code of ref document: A1