CN113254399A - Log query method and device, electronic equipment and medium - Google Patents

Log query method and device, electronic equipment and medium Download PDF

Info

Publication number
CN113254399A
CN113254399A CN202110587771.5A CN202110587771A CN113254399A CN 113254399 A CN113254399 A CN 113254399A CN 202110587771 A CN202110587771 A CN 202110587771A CN 113254399 A CN113254399 A CN 113254399A
Authority
CN
China
Prior art keywords
interface
log
field name
calling
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110587771.5A
Other languages
Chinese (zh)
Inventor
武超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202110587771.5A priority Critical patent/CN113254399A/en
Publication of CN113254399A publication Critical patent/CN113254399A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Abstract

The embodiment of the application discloses a log query method, a log query device, electronic equipment and a log query medium, which are applied to the technical field of data processing. The method comprises the following steps: intercepting the interface calling request by using a tangent plane technology when the interface calling request is detected, analyzing the interface calling request to obtain a field value corresponding to a first field name, updating the field value corresponding to the first field name into a log table, intercepting response information by using the tangent plane technology when response information fed back aiming at the interface calling request is detected, analyzing the response information to obtain a field value corresponding to a second field name, updating the field value corresponding to the second field name into the log table, receiving a log query request which carries query conditions, and querying a target log record meeting the query conditions from the updated log table. By adopting the embodiment of the application, the log query efficiency can be improved. The application relates to blockchain techniques, such as log records in a log table can be written to a blockchain.

Description

Log query method and device, electronic equipment and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for log query, an electronic device, and a medium.
Background
In the development and application process of a system, a log for recording the operation condition of the system is particularly important, and related technicians can analyze the log and solve problems occurring in the operation process. For systems that interact more frequently, such as highly concurrent microservice systems, a large amount of logging may occur during interaction (e.g., when an interface provided by the system is invoked). However, after the log is recorded based on the existing log recording scheme, when the log is searched to analyze a system problem, a slow search speed generally occurs due to a large number of logs, so that the problem occurring during system operation cannot be found in time, and even a subsequent system upgrade iteration may be affected. Therefore, how to improve the log query efficiency becomes a problem to be solved urgently.
Disclosure of Invention
The embodiment of the application provides a log query method, a log query device, electronic equipment and a medium, which can effectively improve log query efficiency.
In one aspect, an embodiment of the present application provides a log query method, where the method includes:
when an interface calling request is detected, intercepting the interface calling request by using a tangent plane technology;
analyzing the interface calling request to obtain a field value corresponding to a first field name, and updating the field value corresponding to the first field name into a log table; the log table is used for storing log records of the calling interface, and the first field name is a field name used for constructing the log records of the calling target interface; the target interface is an interface which is called by the interface calling request indication;
intercepting response information fed back by aiming at the interface calling request by using a tangent plane technology when the response information is detected;
analyzing the response information to obtain a field value corresponding to a second field name, and updating the field value corresponding to the second field name into the log table; the second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface;
receiving a log query request, wherein the log query request carries query conditions;
and inquiring the target log record meeting the inquiry condition from the updated log table.
In a possible implementation manner, when the interface call request is detected, before the interface call request is intercepted by using a tangent plane technology, an annotation for indicating logging can be further created; adding the annotation for indicating the log recording into the configuration file of each interface to be subjected to the log recording; the configuration file is configured with an execution method of a corresponding interface.
In a possible implementation manner, when an interface call request is detected, after the interface call request is intercepted by using a tangent plane technology, whether the annotation for indicating logging is added in a configuration file of a target interface can be further queried; if the annotation for indicating log recording is added, analyzing the interface call request to obtain a field value corresponding to the first field name; if not, the target interface is called to process the interface calling request.
In a possible implementation manner, before the query whether the annotation for indicating logging is added to the configuration file of the target interface, an interface address of the target interface may also be obtained; and searching the configuration file of the target interface according to the interface address of the target interface.
In a possible implementation manner, when response information fed back for an interface call request is detected, after intercepting the response information by using a tangent plane technology, whether the annotation for instructing logging is added to a configuration file of the target interface may be further queried; if the comment for indicating log recording is added, analyzing the response information to obtain a field value corresponding to a second field; and if the annotation for indicating the log recording is not added, performing data processing, storage processing or forwarding processing according to the response information.
In a possible implementation manner, after the field value corresponding to the second field name is updated to the log table, a survival time length may be further set for the log record calling the target interface; counting the storage time of the log record for calling the target interface at regular time; and deleting the log record for calling the target interface from the updated log table when the storage duration is determined to be greater than or equal to the survival duration.
In a possible implementation manner, the interface call request carries a first time, and the response information carries a second time and a time interval between the first time and the second time; the first field name comprises a log record identifier and an interface entry parameter; the log record identification is used for representing the only identification of the log record for calling the target interface, and the interface input parameter is a request parameter carried in the interface calling request; the second field name comprises interface participation and time consumption; the interface output parameter is a return parameter carried in the response message, and the consumed time is a time interval between the first time and the second time.
In one aspect, an embodiment of the present application provides a log query apparatus, where the apparatus includes:
the intercepting module is used for intercepting the interface calling request by using a tangent plane technology when the interface calling request is detected;
the processing module is used for analyzing the interface calling request to obtain a field value corresponding to a first field name and updating the field value corresponding to the first field name into a log table; the log table is used for storing log records of the calling interface, and the first field name is a field name used for constructing the log records of the calling target interface; the target interface is an interface which is called by the interface calling request indication;
the intercepting module is further used for intercepting the response information fed back by aiming at the interface calling request by using a tangent plane technology when the response information is detected;
the processing module is further configured to analyze the response information to obtain a field value corresponding to a second field name, and update the field value corresponding to the second field name into the log table; the second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface;
the receiving module is used for receiving a log query request, and the log query request carries query conditions;
and the query module is used for querying the target log record meeting the query condition from the updated log table.
In one aspect, an embodiment of the present application provides an electronic device, where the electronic device includes a processor and a memory, where the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions, and perform the following steps: when an interface calling request is detected, intercepting the interface calling request by using a tangent plane technology; analyzing the interface calling request to obtain a field value corresponding to a first field name, and updating the field value corresponding to the first field name into a log table; the log table is used for storing log records of the calling interface, and the first field name is a field name used for constructing the log records of the calling target interface; the target interface is an interface which is called by the interface calling request indication; intercepting response information fed back by aiming at the interface calling request by using a tangent plane technology when the response information is detected; analyzing the response information to obtain a field value corresponding to a second field name, and updating the field value corresponding to the second field name into the log table; the second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface; receiving a log query request; the log query request carries query conditions; and inquiring the target log record meeting the inquiry condition from the updated log table.
In one aspect, the present application provides a computer-readable storage medium, which stores a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, are used to perform some or all of the steps of the above method.
In the embodiment of the application, when an interface calling request is detected, the interface calling request is intercepted by using a tangent plane technology, the interface calling request is analyzed to obtain a field value corresponding to a first field name, the field value corresponding to the first field name is updated to a log table, when response information fed back aiming at the interface calling request is detected, the response information is intercepted by using the tangent plane technology, the response information is analyzed to obtain a field value corresponding to a second field name, the field value corresponding to the second field name is updated to the log table, a log query request is received, the log query request carries query conditions, and target log records meeting the query conditions are queried from the updated log table. By implementing the scheme, the log data of the calling interface can be stored in the log table, and the log record can be quickly searched from the log table, so that the log query and acquisition efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a is a schematic diagram of an application architecture according to an embodiment of the present application;
fig. 1b is a schematic diagram of an application architecture according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a log query method according to an embodiment of the present application;
fig. 3 is a schematic view of an application scenario for generating a log query condition according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a log query method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a log query apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
The log query method provided by the embodiment of the application is implemented in electronic equipment, and the electronic equipment can be terminal equipment or a server. The terminal device can be a smart phone, a tablet computer, a notebook computer, a desktop computer and the like. The server may be an independent physical server, a server cluster or a distributed system configured by a plurality of physical servers, a cloud server, or the like, but is not limited thereto. The application relates to a block chain technology, and an electronic device can write related data such as log records in a log table into a block chain, so that the electronic device can obtain required information such as target log records in the log table on the block chain.
Referring to fig. 1a, fig. 1a is a schematic view of an application architecture provided in an embodiment of the present application, through which the log query method provided in the present application can be executed. Specifically, fig. 1a includes an electronic device, and a system a that sends an interface call request and receives response information. The electronic device can intercept the interface calling request received by the system B and the corresponding response information by executing the technical scheme of the application, so that the log data of the calling interface can be recorded and searched, and the log query efficiency can be improved. It is understood that the system B may be a service system providing a service, and the service system may provide a plurality of service interfaces, the system a may call the service interface indicated by the interface call request by sending the interface call request, the system B performs service processing (such as querying user data, etc.) and obtaining response information based on the indication of the interface call request, and fig. 1a shows only one system requesting a service from the system B, and there may be a plurality of systems requesting a service from the system B.
In an embodiment, please refer to fig. 1B, based on fig. 1a, a system B in the electronic device may include a control layer (controller layer) and a service layer, and the electronic device may execute the technical solution of the present application to intercept the interface call request or the response information when the control layer detects the interface call request or the response information, so as to record and search log data of the call interface, and uniformly obtain the log data at the control layer and record the log data in a log table, and further improve storage and query efficiency of the log data. When the system A sends an interface calling request to the system B, the interface calling request firstly reaches a control layer of the system B, the electronic equipment can uniformly receive the interface calling request through the control layer and forwards the interface calling request to a service layer, the service layer is configured with a service interface and an execution method corresponding to the service interface, the electronic equipment can call the service interface through the service layer to execute service processing indicated by the interface calling request to obtain response information, and after the response information is returned to the control layer from the service layer, the electronic equipment can return the response information to the system A through the control layer.
It should be understood that fig. 1a and fig. 1b are merely exemplary to represent the application architecture proposed in the present application, and do not limit the specific architecture of the present application, that is, the present application may also provide other forms of application architectures. For convenience of illustration, the log query method mentioned later is described by taking the application architecture shown in fig. 1a as an example, unless otherwise specified.
Optionally, in some embodiments, the electronic device may execute the log query method according to an actual service requirement, so as to improve log query and acquisition efficiency. For example, the technical scheme of the application can be applied to a scene of analyzing the operation condition of the system based on the log records called by the system interface, that is, the electronic device can quickly acquire the designated log records through the technical scheme of the application, so that a subsequent developer can analyze the acquired log records. It should be understood that the foregoing scenarios are only examples, and do not constitute a limitation on application scenarios of the technical solutions provided in the embodiments of the present application, and the technical solutions of the present application may also be applied to other scenarios. For example, as can be known by those skilled in the art, with the evolution of system architecture and the emergence of new service scenarios, the technical solution provided in the embodiments of the present application is also applicable to similar technical problems.
Based on the above description, the present application embodiment provides a log query method, which may be performed by the above-mentioned electronic device. As shown in fig. 2, a flow of the log query method according to the embodiment of the present application may include the following steps:
s201, when the interface calling request is detected, intercepting the interface calling request by using a tangent plane technology.
The interface calling request indicates a target interface to be called and a service process called to be executed by the target interface, wherein the service process may include data writing, data query, data update and the like. For example, the interface calling request indicates that a target interface to be called is a client information query interface, and a service process called the interface to be executed is information of a client with a query user ID xxx.
In a possible implementation manner, when the interface call request is detected, the electronic device intercepts the interface call request by using a tangent plane technology, specifically, when the interface call request is detected, the electronic device intercepts the interface call request through a predefined tangent plane (including tangent plane logic). The section can be used for transversely intercepting the interface calling request when any interface calling request is detected; the section comprises section logic defining a unified logging method executed for the arbitrary interface call request, wherein the logging method comprises a method for acquiring and recording log data from the interface call request and a method for acquiring and recording the log data from the response information. It is understood that a section (including section logic) represents a method performed by the electronic device on a specified object before performing a corresponding operation according to the indication of the specified object. The interception is realized by a defined tangent plane, that is, before corresponding business processing is executed according to the indication of a specified object (such as an interface call request and response information), the specified object is subjected to the tangent plane, and further, a method defined in a unified tangent plane logic can be executed on the specified object in the tangent plane. Therefore, the interception of the interface call request through the defined section is to enable the interface call request to enter the section before calling the target interface to execute service processing according to the indication of the interface call request, and then the interface call request can be executed with a logging method by using section logic in the section subsequently. And in the section, the interface call request is not changed at will after the method for defining the interface call request is executed, namely, the data related to the interface call request is not changed. The interface call request is intercepted through the section technology and the log acquisition method is uniformly carried out in the section, so that the interface call request can be correspondingly processed under the condition that the interface call request is not changed, and the low coupling of the system can be further facilitated.
S202, analyzing the interface calling request to obtain a field value corresponding to the first field name, and updating the field value corresponding to the first field name into a log table.
The log table is used for storing log records of the calling interface, the first field name is a field name used for constructing the log record of the calling target interface, and the target interface is an interface which is called by the interface calling request indication.
In a possible embodiment, the electronic device may perform the log recording method defined in the interface call request, that is, the electronic device may parse the interface call request, obtain a field value corresponding to the first field name from data related to the interface call request, and update the field value corresponding to the first field name into the log table.
In a possible implementation manner, before intercepting an interface call request, a log table needs to be constructed in advance, the log table is constructed based on log data generated during interface call, and a plurality of field names forming the log table can include log record identification, interface entry and exit, and time consumption. The log record identifier is used for representing a unique identifier of the log record of the calling interface, namely a unique identifier carried in a calling request aiming at the interface, such as a serial number, or a character string containing letters, numerical values and symbols; (2) the interface access parameter is a request parameter carried in a calling request aiming at the interface, and the request parameter is used for requesting to call an execution method corresponding to the interface so as to execute the calling request; (3) the interface output parameter is a return parameter carried in the response message, and the return parameter is used for representing a return result obtained after the call request is executed; (4) the calling request aiming at the interface carries a first time, and the response information carries a second time and a time interval between the first time and the second time, so that the consumed time is the time interval between the first time and the second time, wherein the first time is the generation time of the calling request aiming at the interface, and the second time is the generation time of the response information.
Optionally, the first field name may include a log record identifier and an interface entry. Therefore, the log record identifier in the first field name can be used to represent a unique identifier of the log record for calling the target interface, and the interface entry parameter can be a request parameter carried in the interface calling request.
Further, the plurality of field names constituting the log table may further include a primary key column, an interface type, a start time, an end time, and a completion time. The primary key column (1) is automatically created based on the position of the log record in the log table, and specifically may be based on the number of rows of the log record in the log table, such as 0001, 0002, 0003, and the like; (2) the interface type may be a type of the called interface, for example, the type of the called interface is a client information query interface, that is, the client information query is used as the interface type of the interface; (3) the start time may be a first time carried by a call request for the interface; (4) the end time may be a second time carried by the response information; (5) the completion time may refer to the time at which an update of a log record to the log table is completed.
Further optionally, the first field name may further include an interface type and a start time. Thus, the interface type in the first field name may be the interface class of the target interface indicated by the interface call request, and the start time may be the first time carried by the interface call request, that is, the generation time of the interface call request. It is to be understood that, when the interface indicated by the call request for the interface is the target interface, the call request for the interface is the interface call request.
In a possible implementation manner, if the log table includes the primary key column, that is, when the field value corresponding to the first field name is updated into the log table, the value corresponding to the primary key column is automatically generated at the update position in the log table based on the field value corresponding to the first field name, and is filled into the log table. For example, a value corresponding to the primary key column is generated based on the row number of the update position in the log table of the field value corresponding to the first field name, and assuming that the row number of the update position is 10, the generated value of the primary key column is 0010, and the corresponding position of the log table is filled, and then a specific log record can be found by inputting the value of the primary key column.
And S203, intercepting the response information by using a tangent plane technology when the response information fed back by aiming at the interface calling request is detected.
In a possible implementation manner, when response information fed back for the interface call request is detected, the electronic device intercepts the response information using the cut-plane technology specifically may be that when the electronic device detects the returned response information, the electronic device enters the cut-plane first, that is, the interception of the response information is implemented. And, no change is made to the response information after the defined method is performed on the response information in the section, i.e. the data to which the response information relates is not changed.
S204, analyzing the response information to obtain a field value corresponding to the second field name, and updating the field value corresponding to the second field name into a log table.
The second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface.
In a possible implementation, the electronic device may perform the defined logging method in the section on the response information, that is, the electronic device may parse the response information, obtain a field value corresponding to the second field name in the data related to the response information, and update the field value corresponding to the second field name into the log table. It can be understood that after the field value corresponding to the second field name is updated to the log table, the log record update is indicated to be completed in the log table, that is, the log record of the call target interface is performed in the log table based on the response information of the interface call request and the feedback. Subsequently, the log record can be queried in the log table by obtaining the log query request.
Optionally, the second field name may include interface out-participation, time consuming. Thus, the interface participation in the second field name may be a return parameter carried in response information fed back by the interface call request, and the time consumption may be a time interval between a first time carried in the interface call request and a second time carried in the response information.
Further optionally, the second field name may also include an end time. Thus, the end time may be the second time carried in the response message.
In a possible implementation manner, if the log table includes the completion time, that is, after the field value corresponding to the second field name is updated into the log table, the completion time of the log record is automatically generated, and the corresponding position in the log table is updated. Specific log records can be subsequently found by entering a specified completion time.
S205, receiving a log query request, wherein the log query request carries query conditions.
In a possible implementation manner, the log query request may be generated through a query page, and specifically, the log query request may be generated by selecting a query condition (for example, obtaining a log record with a completion time between xx.xx.xx-xx.xx.xx.xx) through the query page, and by clicking a submit button of the query page to submit the log record. For example, as shown in fig. 3, fig. 3 is a schematic diagram of an application scenario for generating a log query condition, a developer may select a specified field name and a condition range of a value corresponding to the specified field name through the query page, and if the specified field name is a completion time and the condition range is from aa/bb to bb/aa/bb, the specified field name and the corresponding condition range are used as query conditions, and a submit button is clicked, a log query request may be generated based on the query conditions.
Optionally, the log query request may be generated by a background script, for example, a log query script is written, the log query script includes a query condition, and the log query request is generated by running the log query script.
In a possible implementation, an index specifying field names may also be established before the log table is queried, such as establishing an index in the field names of the log unique identifier or the completion time, so as to find log records through the index fast query.
S206, inquiring the target log record meeting the inquiry condition from the updated log table.
In a possible implementation manner, after receiving the log query request, the electronic device queries a target log record meeting the query condition from the updated log table and returns, for example, returns to the query page. Therefore, in the follow-up process, developers can analyze the target log records displayed on the query page to check system problems.
In the embodiment of the application, when an interface calling request is detected, the electronic equipment intercepts the interface calling request by using a tangent plane technology, analyzes the interface calling request to obtain a field value corresponding to a first field name, updates the field value corresponding to the first field name into a log table, when response information fed back aiming at the interface calling request is detected, intercepts the response information by using the tangent plane technology, analyzes the response information to obtain a field value corresponding to a second field name, updates the field value corresponding to the second field name into the log table, receives a log query request, carries query conditions, and queries a target log record meeting the query conditions from the updated log table. By implementing the scheme, the log data acquisition efficiency can be improved, the log data of the calling interface can be stored in the log table, and the log record can be quickly searched from the log table, so that the log searching efficiency is improved.
Referring to fig. 4, fig. 4 is a schematic flowchart illustrating a log query method according to an embodiment of the present application, where the method may be executed by the above-mentioned electronic device. As shown in fig. 4, the flow of the log query method in the embodiment of the present application may include the following steps:
s401, creating an annotation used for indicating log recording, and adding the annotation used for indicating log recording in the configuration file of each interface to be logged.
The configuration file is configured with an execution method of a corresponding interface, and the execution method is used for calling the corresponding interface and performing service processing according to an instruction of a calling request aiming at the interface.
In a possible embodiment, the annotation indicating logging is pre-added to the configuration file of each interface to be logged. The service system in the electronic equipment can provide a plurality of service interfaces, so the annotation can be added in the configuration file corresponding to the interface needing to be logged, the electronic equipment only calls the logged record of the interface for the interface added with the annotation, and the storage space of the log data is reduced.
S402, when the interface calling request is detected, intercepting the interface calling request by using a tangent plane technology.
For a specific implementation of step S402, reference may be made to the related description of step S201 in the foregoing embodiment, and details are not described here again.
Optionally, in a possible implementation, after the electronic device intercepts the interface call request by using the tangent plane technology, it may first determine whether the interface call request needs to be logged, if so, execute the logging method on the interface call request, and if not, not execute the logging method on the interface call request. The specific way of determining whether the interface call request needs to be logged may be: the electronic equipment acquires an interface address of a target interface indicated by the interface calling request, searches a configuration file of the target interface according to the interface address of the target interface, inquires whether a note for indicating log recording is added in the configuration file of the target interface, and if the note is added, indicates that the interface calling request needs to perform log recording, namely executes step S403, namely executes and analyzes the interface calling request to obtain a field value corresponding to the first field name; if the annotation is not added, the interface calling request is indicated to be not required to be logged, namely, the target interface is called to process the interface calling request, namely, the target interface is called according to a set link of the interface calling request.
S403, analyzing the interface calling request to obtain a field value corresponding to the first field name, and updating the field value corresponding to the first field name into a log table. For a specific implementation of step S403, reference may be made to the related description of step S202 in the foregoing embodiment, and details are not described here again.
S404, when response information fed back by aiming at the interface calling request is detected, intercepting the response information by using a tangent plane technology.
The specific implementation of step S404 may refer to the related description of step S203 in the foregoing embodiments, and is not described herein again.
Optionally, in a possible implementation, after the electronic device intercepts the response information by using the tangent plane technology, it may be determined whether the response information needs to be logged, if so, the logging method is executed for the response information, and if not, the logging method is not executed for the response information. The specific way of determining whether the response information needs to be logged may be: the electronic equipment inquires an interface address of a target interface from which the response information comes, finds a configuration file of the target interface according to the interface address of the target interface, inquires whether a note for indicating log recording is added in the configuration file, and if the note is added, indicates that the response information needs to be subjected to log recording, namely, executes step S404, namely, executes a step of analyzing the response information to obtain a field value corresponding to the second field; if the annotation is not added, the interface calling request is indicated to be free from log recording, namely data processing, storage processing or forwarding processing is carried out according to the response information.
For example, the interface call request is used to call a target interface to query user data, and the response information may be corresponding queried user data, and thus, the forwarding processing according to the response information may be forwarding the queried user data, that is, forwarding the queried user data to an initiator of the interface call request.
For another example, the interface call request is used to scan a data table storing user data to obtain user data, and the response information may be corresponding user data scanned from the data table, so that performing data processing according to the response information may perform encryption processing on the scanned user data to obtain encrypted user data, and performing forwarding processing according to the response data may perform forwarding on the encrypted user data, that is, forwarding the encrypted user data to an initiator of the interface call request to ensure data security.
For another example, the interface call request is used to call a target interface to update user data, the response information may be updated user data, the storing process performed according to the response information may be to store the updated user data, that is, to store the updated user data in a database, and the forwarding process performed according to the response data may be to forward the updated user data, that is, to forward the updated user data to an initiator of the interface call request for viewing.
S405, analyzing the response information to obtain a field value corresponding to the second field name, and updating the field value corresponding to the second field name into a log table.
For a specific implementation of step S405, reference may be made to the related description of step S204 in the foregoing embodiment, which is not described herein again.
Optionally, in a possible implementation, after the field value corresponding to the second field name is updated to the log table, a survival time length may be set for the log record of the call target interface, a storage time length of the log record of the call target interface in the log table is counted at regular time, and when it is determined that the storage time length is greater than or equal to the survival time length, the log record of the call target interface is deleted from the updated log table, so as to save a storage space of the log table.
S406, receiving a log query request, wherein the log query request carries query conditions.
And S407, inquiring the target log record meeting the inquiry condition from the updated log table. The specific implementation of steps S406 to S407 may refer to the related description of steps S205 to S206 in the above embodiment, and is not described herein again.
In the embodiment of the application, the electronic equipment creates annotation for indicating the log recording, adds the annotation for indicating the log recording in the configuration file of each interface to be logged, when the interface calling request is detected, intercepting the interface calling request by using a tangent plane technology, analyzing the interface calling request to obtain a field value corresponding to the first field name, updating the field value corresponding to the first field name into a log table, and intercepting the response information by using a tangent plane technology when the response information fed back aiming at the interface calling request is detected, analyzing the response information to obtain a field value corresponding to the second field name, updating the field value corresponding to the second field name into the log table, receiving the log query request, the log query request carries query conditions, and target log records meeting the query conditions are queried from the updated log table. By implementing the scheme, the interface needing log recording can be subjected to log recording through the definition annotation, the log data acquisition efficiency can be improved, the log data called by the interface can be stored in the log table, the log record can be quickly searched from the log table, and the log query efficiency can be improved.
Please refer to fig. 5, fig. 5 is a schematic structural diagram of a log query device according to the present application. It should be noted that the log query apparatus shown in fig. 5 is used for executing the method of the embodiment shown in fig. 2 and fig. 4 of the present application, and for convenience of description, only the portion related to the embodiment of the present application is shown, and details of the specific technology are not disclosed, and reference is made to the embodiment shown in fig. 2 and fig. 4 of the present application. The log query device 500 may include: an interception module 501, a processing module 502, a receiving module 503 and a query module 504. Wherein:
an interception module 501, configured to intercept, when an interface call request is detected, the interface call request by using a tangent plane technology;
a processing module 502, configured to parse the interface call request to obtain a field value corresponding to a first field name, and update the field value corresponding to the first field name into a log table; the log table is used for storing log records of the calling interface, and the first field name is a field name used for constructing the log records of the calling target interface; the target interface is an interface which is called by the interface calling request indication;
the intercepting module 501 is further configured to intercept response information fed back by the interface call request by using a tangent plane technology;
the processing module 502 is further configured to analyze the response information to obtain a field value corresponding to a second field name, and update the field value corresponding to the second field name into the log table; the second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface;
a receiving module 503, configured to receive a log query request, where the log query request carries query conditions;
a query module 504, configured to query the updated log table for the target log record meeting the query condition.
In a possible implementation, the intercepting module 501, before being configured to intercept the interface call request using a tangent plane technique when the interface call request is detected, is further configured to:
creating an annotation indicating that a log record was made;
adding the annotation for indicating the log recording into the configuration file of each interface to be subjected to the log recording; the configuration file is configured with an execution method of a corresponding interface.
In a possible implementation, the intercepting module 501, after being configured to intercept the interface call request using a tangent plane technique when the interface call request is detected, is further configured to:
inquiring whether the annotation for indicating logging is added in the configuration file of the target interface;
if the annotation for indicating log recording is added, analyzing the interface call request to obtain a field value corresponding to the first field name;
if not, the target interface is called to process the interface calling request.
In a possible implementation manner, before querying whether the annotation indicating logging is added to the configuration file of the target interface, the interception module 501 is further configured to:
acquiring an interface address of the target interface;
and searching the configuration file of the target interface according to the interface address of the target interface.
In a possible implementation, the intercepting module 501, after being configured to intercept response information fed back for an interface call request by using a tangent plane technology, is further configured to:
inquiring whether the annotation for indicating logging is added in the configuration file of the target interface;
if the comment for indicating log recording is added, analyzing the response information to obtain a field value corresponding to a second field;
and if the annotation for indicating log recording is not added, performing data processing, such as data processing, storage processing or forwarding processing, according to the response information.
In a possible implementation, the processing module 502, after being configured to update the field value corresponding to the second field name into the log table, is further configured to:
setting survival time for the log record of calling the target interface;
counting the storage time of the log record for calling the target interface at regular time;
and deleting the log record for calling the target interface from the updated log table when the storage duration is determined to be greater than or equal to the survival duration.
In a possible implementation manner, the interface call request carries a first time, and the response information carries a second time and a time interval between the first time and the second time; the first field name comprises a log record identifier and an interface entry parameter; the log record identification is used for representing the only identification of the log record for calling the target interface, and the interface input parameter is a request parameter carried in the interface calling request; the second field name comprises interface participation and time consumption; the interface output parameter is a return parameter carried in the response message, and the consumed time is a time interval between the first time and the second time.
In the embodiment of the application, when an interface call request is detected by an interception module, the interface call request is intercepted by using a tangent plane technology, a processing module analyzes the interface call request to obtain a field value corresponding to a first field name, the field value corresponding to the first field name is updated to a log table, when response information fed back by aiming at the interface call request is detected by the interception module, the response information is intercepted by using the tangent plane technology, the processing module analyzes the response information to obtain a field value corresponding to a second field name, the field value corresponding to the second field name is updated to the log table, a receiving module receives a log query request, the log query request carries query conditions, and a query module queries target log records meeting the query conditions from the updated log table. By implementing the scheme, the log query and acquisition efficiency can be effectively improved.
The functional modules in the embodiments of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules are integrated into one module. The integrated module may be implemented in a form of hardware, or may be implemented in a form of software functional module, which is not limited in this application.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 6, the electronic device 600 includes: at least one processor 601, a memory 602. Optionally, the electronic device may further comprise a network interface 603. Wherein data can be exchanged between the processor 601, the memory 602 and the network interface 603, the network interface 603 is controlled by the processor for transceiving messages, the memory 602 is used for storing a computer program, the computer program comprises program instructions, and the processor 601 is used for executing the program instructions stored in the memory 602. Wherein the processor 601 is configured to call the program instructions to perform the above method.
The memory 602 may include volatile memory (volatile memory), such as random-access memory (RAM); the memory 602 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a solid-state drive (SSD), etc.; the memory 602 may also comprise a combination of memories of the kind described above.
The processor 601 may be a Central Processing Unit (CPU) 601. In one embodiment, the processor 601 may also be a Graphics Processing Unit (GPU) 601. The processor 601 may also be a combination of a CPU and a GPU.
In one possible implementation, the memory 602 is used to store program instructions. The processor 601 may call the program instructions to perform the following steps:
when an interface calling request is detected, intercepting the interface calling request by using a tangent plane technology;
analyzing the interface calling request to obtain a field value corresponding to a first field name, and updating the field value corresponding to the first field name into a log table; the log table is used for storing log records of the calling interface, and the first field name is a field name used for constructing the log records of the calling target interface; the target interface is an interface which is called by the interface calling request indication;
intercepting response information fed back by aiming at the interface calling request by using a tangent plane technology when the response information is detected;
analyzing the response information to obtain a field value corresponding to a second field name, and updating the field value corresponding to the second field name into the log table; the second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface;
receiving a log query request; the log query request carries query conditions;
and inquiring the target log record meeting the inquiry condition from the updated log table.
In one possible implementation, the processor 601, before being configured to intercept the interface call request using a tangent plane technique when the interface call request is detected, is further configured to:
creating an annotation indicating that a log record was made;
adding the annotation for indicating the log recording into the configuration file of each interface to be subjected to the log recording; the configuration file is configured with an execution method of a corresponding interface.
In a possible implementation, the processor 601, after being configured to intercept the interface call request using a tangent plane technique when the interface call request is detected, is further configured to:
inquiring whether the annotation for indicating logging is added in the configuration file of the target interface;
if the annotation for indicating log recording is added, analyzing the interface call request to obtain a field value corresponding to the first field name;
if not, the target interface is called to process the interface calling request.
In a possible implementation manner, before querying whether the annotation indicating logging is added to the configuration file of the target interface, the processor 601 is further configured to:
acquiring an interface address of the target interface;
and searching the configuration file of the target interface according to the interface address of the target interface.
In a possible implementation, the processor 601, after being configured to intercept response information fed back for an interface call request using a tangent plane technique when the response information is detected, is further configured to:
inquiring whether the annotation for indicating logging is added in the configuration file of the target interface;
if the comment for indicating log recording is added, analyzing the response information to obtain a field value corresponding to a second field;
and if the annotation for indicating log recording is not added, performing data processing, such as data processing, storage processing or forwarding processing, according to the response information.
In a possible implementation, the processor 601, after being configured to update the field value corresponding to the second field name into the log table, is further configured to:
setting survival time for the log record of calling the target interface;
counting the storage time of the log record for calling the target interface at regular time;
and deleting the log record for calling the target interface from the updated log table when the storage duration is determined to be greater than or equal to the survival duration.
In a possible implementation manner, the interface call request carries a first time, and the response information carries a second time and a time interval between the first time and the second time; the first field name comprises a log record identifier and an interface entry parameter; the log record identification is used for representing the only identification of the log record for calling the target interface, and the interface input parameter is a request parameter carried in the interface calling request; the second field name comprises interface participation and time consumption; the interface output parameter is a return parameter carried in the response message, and the consumed time is a time interval between the first time and the second time.
In a specific implementation, the apparatus, the processor 601, the memory 602, and the like described in the embodiments of the present application may perform the implementation described in the above method embodiments, and may also perform the implementation described in the embodiments of the present application, which is not described herein again.
Also provided in embodiments of the present application is a computer (readable) storage medium storing a computer program comprising program instructions that, when executed by a processor, cause the processor to perform some or all of the steps performed in the above-described method embodiments. Alternatively, the computer storage media may be volatile or nonvolatile. The computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which may be stored in a computer storage medium, and the computer storage medium may be a computer readable storage medium, and when executed, the programs may include the processes of the above embodiments of the methods. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the present disclosure has been described with reference to particular embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present disclosure.

Claims (10)

1. A log query method, comprising:
when an interface calling request is detected, intercepting the interface calling request by using a tangent plane technology;
analyzing the interface calling request to obtain a field value corresponding to a first field name, and updating the field value corresponding to the first field name into a log table; the log table is used for storing log records of the calling interface, and the first field name is a field name used for constructing the log records of the calling target interface; the target interface is an interface which is called by the interface calling request indication;
intercepting response information fed back by aiming at the interface calling request by using a tangent plane technology when the response information is detected;
analyzing the response information to obtain a field value corresponding to a second field name, and updating the field value corresponding to the second field name into the log table; the second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface;
receiving a log query request; the log query request carries query conditions;
and inquiring the target log record meeting the inquiry condition from the updated log table.
2. The method of claim 1, wherein before intercepting the interface call request using a cut plane technique when the interface call request is detected, further comprising:
creating an annotation indicating that a log record was made;
adding the annotation for indicating the log recording into the configuration file of each interface to be subjected to the log recording; the configuration file is configured with an execution method of a corresponding interface.
3. The method of claim 2, wherein after intercepting the interface call request using a cut plane technique when the interface call request is detected, further comprising:
inquiring whether the annotation for indicating logging is added in the configuration file of the target interface;
if the annotation for indicating log recording is added, analyzing the interface call request to obtain a field value corresponding to the first field name;
if not, the target interface is called to process the interface calling request.
4. The method of claim 3, wherein before querying whether the annotation indicating logging is added to the configuration file of the target interface, the method further comprises:
acquiring an interface address of the target interface;
and searching the configuration file of the target interface according to the interface address of the target interface.
5. The method of claim 2, wherein after intercepting response information for interface call request feedback using a tangent plane technique when the response information is detected, further comprising:
inquiring whether the annotation for indicating logging is added in the configuration file of the target interface;
if the comment for indicating log recording is added, analyzing the response information to obtain a field value corresponding to a second field;
and if the annotation for indicating the log recording is not added, performing data processing, storage processing or forwarding processing according to the response information.
6. The method according to claim 1, wherein after updating the field value corresponding to the second field name into the log table, further comprising:
setting survival time for the log record of calling the target interface;
counting the storage time of the log record for calling the target interface at regular time;
and deleting the log record for calling the target interface from the updated log table when the storage duration is determined to be greater than or equal to the survival duration.
7. The method according to any of claims 1-6, wherein the interface call request carries a first time, and the response information carries a second time and a time interval between the first time and the second time;
the first field name comprises a log record identifier and an interface entry parameter; the log record identification is used for representing the only identification of the log record for calling the target interface, and the interface input parameter is a request parameter carried in the interface calling request;
the second field name comprises interface participation and time consumption; the interface output parameter is a return parameter carried in the response message, and the consumed time is a time interval between the first time and the second time.
8. A log querying device, comprising:
the intercepting module is used for intercepting the interface calling request by using a tangent plane technology when the interface calling request is detected;
the processing module is used for analyzing the interface calling request to obtain a field value corresponding to a first field name and updating the field value corresponding to the first field name into a log table; the log table is used for storing log records of the calling interface, and the first field name is a field name used for constructing the log records of the calling target interface; the target interface is an interface which is called by the interface calling request indication;
the intercepting module is further used for intercepting the response information fed back by aiming at the interface calling request by using a tangent plane technology when the response information is detected;
the processing module is further configured to analyze the response information to obtain a field value corresponding to a second field name, and update the field value corresponding to the second field name into the log table; the second field name is a field name used for constructing a log record for calling the target interface, the first field name is different from the second field name, and the updated log table stores the log record for calling the target interface;
the receiving module is used for receiving a log query request, and the log query request carries query conditions;
and the query module is used for querying the target log record meeting the query condition from the updated log table.
9. An electronic device comprising a processor and a memory, wherein the memory is configured to store a computer program comprising program instructions, and wherein the processor is configured to invoke the program instructions to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN202110587771.5A 2021-05-27 2021-05-27 Log query method and device, electronic equipment and medium Pending CN113254399A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110587771.5A CN113254399A (en) 2021-05-27 2021-05-27 Log query method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110587771.5A CN113254399A (en) 2021-05-27 2021-05-27 Log query method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN113254399A true CN113254399A (en) 2021-08-13

Family

ID=77184864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110587771.5A Pending CN113254399A (en) 2021-05-27 2021-05-27 Log query method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN113254399A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407369A (en) * 2023-12-14 2024-01-16 宁德时代新能源科技股份有限公司 Operation log recording method and device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104881284A (en) * 2015-05-22 2015-09-02 国云科技股份有限公司 Efficient log operating method
CN111708749A (en) * 2020-07-24 2020-09-25 深圳市富之富信息科技有限公司 Operation log recording method and device, computer equipment and storage medium
CN112650753A (en) * 2020-12-23 2021-04-13 平安普惠企业管理有限公司 Log management method, device, system, equipment and readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104881284A (en) * 2015-05-22 2015-09-02 国云科技股份有限公司 Efficient log operating method
CN111708749A (en) * 2020-07-24 2020-09-25 深圳市富之富信息科技有限公司 Operation log recording method and device, computer equipment and storage medium
CN112650753A (en) * 2020-12-23 2021-04-13 平安普惠企业管理有限公司 Log management method, device, system, equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407369A (en) * 2023-12-14 2024-01-16 宁德时代新能源科技股份有限公司 Operation log recording method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN110908997B (en) Data blood relationship construction method and device, server and readable storage medium
US11775501B2 (en) Trace and span sampling and analysis for instrumented software
WO2022126983A1 (en) Electronic report file export method, apparatus and device, and storage medium
CN110688598B (en) Service parameter acquisition method and device, computer equipment and storage medium
CN112306881A (en) Simulation data generation method, device, equipment and storage medium
CN111475376A (en) Method and device for processing test data, computer equipment and storage medium
CN108255967B (en) Method and device for calling storage process, storage medium and terminal
CN111240772A (en) Data processing method and device based on block chain and storage medium
CN111522881B (en) Service data processing method, device, server and storage medium
CN113254399A (en) Log query method and device, electronic equipment and medium
CN113360210A (en) Data reconciliation method and device, computer equipment and storage medium
CN113377789A (en) Processing method and device for database change data, computer equipment and medium
CN116644250B (en) Page detection method, page detection device, computer equipment and storage medium
CN112862449A (en) Structural chemical industry bill generation method and device, computer equipment and storage medium
CN111752838A (en) Question checking method and device, server and storage medium
CN116303320A (en) Real-time task management method, device, equipment and medium based on log file
US20090228903A1 (en) Data event sending method and apparatus and event processing system
CN112199092A (en) Application development method and device and electronic equipment
CN117251384B (en) Interface automation test case generation method and system
CN110866036B (en) Data processing method, system, device, terminal and readable storage medium
CN113031960B (en) Code compiling method, device, server and storage medium
CN109933573B (en) Database service updating method, device and system
US20240053981A1 (en) Methods for automated configuration management in platform-as-a-service environments and devices thereof
CN117951155A (en) Data processing method, device, electronic equipment and storage medium
CN117873446A (en) Worker link tracking method, device, equipment and medium

Legal Events

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