CN116069609A - Log generation method, device, electronic equipment, storage medium and program product - Google Patents

Log generation method, device, electronic equipment, storage medium and program product Download PDF

Info

Publication number
CN116069609A
CN116069609A CN202310107433.6A CN202310107433A CN116069609A CN 116069609 A CN116069609 A CN 116069609A CN 202310107433 A CN202310107433 A CN 202310107433A CN 116069609 A CN116069609 A CN 116069609A
Authority
CN
China
Prior art keywords
log
preset
information
url
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310107433.6A
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.)
Beijing Taoyoutianxia Technology Co ltd
Original Assignee
Beijing Taoyoutianxia Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Taoyoutianxia Technology Co ltd filed Critical Beijing Taoyoutianxia Technology Co ltd
Priority to CN202310107433.6A priority Critical patent/CN116069609A/en
Publication of CN116069609A publication Critical patent/CN116069609A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Quality & Reliability (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a log generation method, a log generation device, electronic equipment, a storage medium and a program product, and relates to the technical field of Internet. The method comprises the following steps: receiving a log query request of a user for an application program; the log query request comprises a Uniform Resource Locator (URL) mode; determining a target interface corresponding to the URL mode through a preset log decorator; the log decorator is used for collecting log information of the application program through different interfaces; the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode has a corresponding interface; and acquiring corresponding log information through the determined target interface, and generating a target log based on the log information. According to the log generation method, the corresponding relation between the interface and the log decorator is used for generating the log and providing the query function, so that the efficiency of user query log and log generation can be effectively improved.

Description

Log generation method, device, electronic equipment, storage medium and program product
Technical Field
The present application relates to the field of internet technologies, and in particular, to a log generating method, a log generating device, an electronic device, a storage medium, and a computer program product.
Background
With the development of internet technology, various types of software and systems are increasing. Various software systems can generate a large amount of logs in the running process to record the running process, equipment state, network condition and other information of the system, so that system development and operation maintenance personnel can track, manage and maintain the functions of the system, and a basis is provided for reproduction of the behavior scene of the user.
At present, in the process of reproducing the user behavior scene, technicians need to search and compare in turn to find out the corresponding log information when reproducing the scene, then the contents of the searched log information are subjected to specific analysis and the user behavior scene is deduced, the process of searching the log information is complex, and the efficiency is low.
Disclosure of Invention
The method and the device aim to solve the problems that in the process of reproducing the user behavior scene, the retrieval of the log is complicated, the log analysis is complicated and the log inquiring efficiency is low. The technical scheme is as follows:
in a first aspect, the present application provides a log generating method, including:
receiving a log query request of a user for an application program; the log query request comprises a Uniform Resource Locator (URL) mode;
determining a target interface corresponding to the URL mode through a preset log decorator; the log decorator is used for collecting log information of the application program through different interfaces; the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode is provided with a corresponding interface;
and acquiring corresponding log information through the determined target interface, and generating a target log based on the log information.
In an optional embodiment of the first aspect, the determining a target interface corresponding to the URL pattern includes:
acquiring a URL white list in the plurality of URLs conforming to a preset mode, and determining a target URL matched with the URL mode in the URL white list;
and determining the target interface corresponding to the target URL.
In an optional embodiment of the first aspect, the obtaining, through the target interface, corresponding log information includes:
acquiring an objective function corresponding to the objective interface, and acquiring execution related information of the objective function; wherein the execution related information comprises at least one of execution parameters and exception information;
and generating the log information according to the execution related information.
In an alternative embodiment of the first aspect, the method further comprises:
determining a page scene corresponding to the target log based on a preset interface corresponding relation; the interface corresponding relation comprises corresponding relations between a plurality of interfaces and a plurality of different page scenes;
and displaying a target page corresponding to the page scene.
In an optional embodiment of the first aspect, the generating the log information according to the execution related information includes:
if the execution related information is detected to contain abnormal information, generating the log information in a first preset format;
and if no abnormal information is detected in the execution related information, generating the log information in a second preset format.
In an optional embodiment of the first aspect, the target log is a log in a preset structured format; the preset structuring format comprises at least two different structuring levels;
the method further comprises the steps of:
and traversing each structure level of the target log in sequence from the first preset level of the preset structural format, and filtering sensitive information in each structure level until traversing to the second preset level of the preset structural format.
In an optional embodiment of the first aspect, the filtering sensitive information in each structure level includes:
determining a field structure of a current structure level;
if the field structure of the current level accords with the preset structure, comparing the first field in the current level with a preset sensitive field;
and if the first field is matched with a preset sensitive field, deleting the first field and the corresponding log information from the current structure level.
In a second aspect, the present application provides a log generating apparatus, including:
the receiving module is used for receiving a log query request of a user for an application program; the log query request comprises a Uniform Resource Locator (URL) mode;
the determining module is used for determining a target interface corresponding to the URL mode through a preset log decorator; the log decorator is used for collecting log information of the application program through different interfaces; the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode is provided with a corresponding interface;
and the generating module is used for acquiring corresponding log information through the determined target interface and generating a target log based on the log information.
In a third aspect, the present application provides an electronic device comprising a memory, a processor and a computer program stored on the memory, the processor executing the computer program to implement the steps of the above log generation method.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the above log generation method.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the above log generation method.
The beneficial effects that technical scheme that this application embodiment provided brought are:
according to the log generation method, through the preset corresponding relation between the URL in the log decorator and the interface and the URL contained in the log query request, the interface and the function corresponding to the log query request are determined, the corresponding function is called to obtain log related information, then the log is generated based on the log information and stored in the database in an encrypted mode, when the scene reproduction requirement exists, the log can be quickly queried, and the corresponding page scene is determined and displayed. Through the collection of interfaces and the generation of the logs, the corresponding interfaces can be quickly found and the logs can be generated according to the corresponding relation of the interfaces in the log decorator during the inquiry, and the efficiency of log generation and user inquiry can be effectively improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is an application scenario schematic diagram of a log generating method provided in an embodiment of the present application;
fig. 2 is a flow chart of a log generating method according to an embodiment of the present application;
fig. 3 is a schematic flow chart of filtering sensitive information in a log generating method according to an embodiment of the present application;
fig. 4 is a flowchart illustrating an example of a log generating method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a log generating device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device to which the log generating method provided in the embodiment of the present application is applicable.
Detailed Description
Embodiments of the present application are described below with reference to the drawings in the present application. It should be understood that the embodiments described below with reference to the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and the technical solutions of the embodiments of the present application are not limited.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and "comprising," when used in this application, specify the presence of stated features, information, data, steps, operations, and components, but do not preclude the presence or addition of other features, information, data, steps, operations, components, and/or groups thereof, that may be included in the present application. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled.
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Several terms which are referred to in this application are first introduced and explained:
URL (Uniform Resource Locator ), which is a compact representation of the location and access method of resources available on the internet, is the address of a standard resource on the internet. Each file on the internet has a unique URL that contains information indicating the location of the file and how the browser should handle it.
A Log (Log) refers to a time ordered collection of certain operations of objects specified by a system and their results of operations. Each log file is made up of log records, each describing a separate system event, including a description of the date, time, user and action, etc. related operations.
At present, when a technician reproduces a user behavior scene, the technician needs to search and compare the corresponding log information in sequence, then the content of the searched log information is specifically analyzed and the user behavior scene is deduced, the process of searching the log information is complex, the log analysis process is complex, the time spent on searching and analyzing is long, the steps are complex, the resource waste is easily caused, and the log query and scene reproduction efficiency is low.
The present application provides a log generating method, apparatus, electronic device, storage medium and program product, and aims to solve the above technical problems in the prior art.
The technical solutions of the embodiments of the present application and technical effects produced by the technical solutions of the present application are described below by describing several exemplary embodiments. It should be noted that the following embodiments may be referred to, or combined with each other, and the description will not be repeated for the same terms, similar features, similar implementation steps, and the like in different embodiments.
Fig. 1 is a schematic diagram of an application environment for implementing log generation according to an embodiment of the present application. The application environment may include a terminal 101, and an application 102 that can implement the log generation method described above is installed in the terminal 101.
Specifically, the log generation method includes: after detecting and receiving a log query request of a user, the application 102 determines a corresponding interface through a log decorator preset in the terminal 101 according to a URL (uniform resource locator) contained in the request and a corresponding relation between a matched white list URL and the interface, acquires a function according to the determined interface, calls the function to acquire execution related information, generates log information according to the execution related information, generates a log with a preset structure according to the log information, and filters sensitive information of the generated log to obtain a filtered target log; the application 102 may also perform reproduction of the page scene according to the preset correspondence between the interface and the page scene.
Those skilled in the art will appreciate that a terminal (which may also be referred to as a user terminal or user device) may be, but is not limited to, a smart phone, tablet, notebook, desktop computer, smart voice interaction device (e.g., a smart speaker), wearable electronic device (e.g., a smart watch), vehicle-mounted terminal, smart home appliance (e.g., a smart television), AR/VR device, aircraft, etc. The embodiment of the invention can be applied to various scenes, including but not limited to cloud technology, artificial intelligence, intelligent transportation, auxiliary driving and the like.
The application scenario described above is only an example, and is not limited to the application scenario of the job offer method of the present application.
In some possible embodiments, taking an execution body as an application program as an example, the embodiment of the present application provides a log generating method, as shown in fig. 1, may include the following steps:
s201, receiving a log query request of a user for an application program.
The log query request may include a uniform resource locator URL pattern. The log query request may be an HTTP (HyperText Transfer Protocol ) request, or an RPC (Remote Procedure Call, remote procedure call) request call), or the like.
The log query request may further include login state information of the user. The login status information may include the current user's login status, and may also include the user's unique identity. For example, when a user logs in a website, the background stores login information such as a user name, a mobile phone number and the like, and returns to the front end to carry the unique mark, so that the background knows who the user accesses currently, the login state can be set to be valid, whether the login of the user is valid or not is judged, and re-login is not needed.
Specifically, the log query request may be obtained by receiving a click, a search, a selection, and the like of a user. When the application detects an operation of the user with respect to the log query, request information about the log query is acquired.
S202, determining a target interface corresponding to the URL mode through a preset log decorator.
The log decorator is used for collecting log information of the application program through different interfaces; the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode is provided with a corresponding interface.
One interface can collect log information of a plurality of URLs conforming to the preset mode.
For example, three interfaces are provided in total: the system comprises an interface A, an interface B and an interface C, wherein the interface A is used for collecting log information corresponding to 100 URLs conforming to a preset mode, the interface A is used for collecting log information corresponding to 1 st to 30 th URLs conforming to the preset mode, the interface B is used for collecting log information corresponding to 31 st to 69 nd URLs conforming to the preset mode, and the interface C is used for collecting log information corresponding to 70 th to 100 th URLs conforming to the preset mode.
The log decorator comprises an interface switch, and is used for accessing an interface corresponding to the appointed URL; the log decorator also comprises a corresponding function used for calling to obtain related log information after the interface is requested.
Specifically, the preset log decorator comprises a plurality of URLs meeting a preset mode and interfaces corresponding to the URLs, after the URL modes in the log query request are acquired, the URL modes are matched with the URLs meeting the preset mode, and the interface corresponding to the matched URL is used as a target interface.
S203, acquiring corresponding log information through the determined target interface, and generating a target log based on the log information.
The target log can be a log conforming to a preset format and can be filtered, encrypted and stored;
for example, the target log may be filtered by hierarchical traversal to perform sensitive information such as user privacy information, and may be encrypted according to an encryption method; the encryption method may include, among other things, the advanced encryption standard (AES, advanced Encryption Standard), which is a symmetric encryption algorithm, i.e. encryption and decryption use the same key.
Specifically, after the target log is retrieved, the user behavior scene may be restored according to the target log.
The user behavior scene may include the operation behavior of the user in each scene, for example, the user searches in the application homepage scene, the user uploads or modifies information in the personal page scene, or the user sends and accepts in the message page, and the scene where the user is located.
Specifically, after the target interface is requested and accessed, a function corresponding to the interface in the log decorator is called and log information is obtained, wherein the log information can comprise execution parameters, returned results, exception information, user information and the URL of the request.
In the above embodiment, the interface and the function corresponding to the log query request are determined according to the preset correspondence between the URL and the interface in the log decorator and the URL included in the log query request, the corresponding function is called to obtain the log related information, then the log is generated based on the log information, and is stored in the database after encryption, when the scene reproduction requirement exists, the log can be quickly queried, and the corresponding page scene is determined and displayed. Through the collection of interfaces and the generation of the logs, the corresponding interfaces can be quickly found and the logs can be generated according to the corresponding relation of the interfaces in the log decorator during the inquiry, and the efficiency of log generation and user inquiry can be effectively improved.
In some possible embodiments, the determining the target interface corresponding to the URL pattern in the step S202 includes:
(1) Acquiring a URL white list in the plurality of URLs conforming to a preset mode, and determining a target URL matched with the URL mode in the URL white list;
(2) And determining the target interface corresponding to the target URL.
The URL whitelists are preset, each URL in each whitelist is provided with a corresponding interface, one interface can correspond to a plurality of URLs, and the plurality of URLs can be matched into one interface.
Specifically, the URL pattern is compared with URLs in the URL whitelist, and if there is a matched URL, a corresponding interface is found through the target URL.
In the implementation process, the identification rule for matching the two URLs can be preset, and the two URLs are identical, namely the two URLs are matched, or the two URLs belong to the same type, namely the two URLs are matched. For example, setting URLs belonging to the same class as matching, wherein the URLs belonging to the same class have the same sign information, and when the URLs are matched, the white list has the same kind of URL, so that whether the current URL mode belongs to the same class as the white list URL can be judged according to the sign information in the URL, and if the URLs belong to the same class, the URL mode can be considered to be matched with the URL.
In some possible embodiments, the obtaining, by the target interface, the corresponding log information in step S203 includes:
(1) Acquiring an objective function corresponding to the objective interface, and acquiring execution related information of the objective function; wherein the execution related information comprises at least one of execution parameters and exception information;
(2) And generating the log information according to the executed related information.
After determining the target interface, the function corresponding to the target interface is called an objective function, and the objective function may be a method decorated by the log decorator.
Specifically, after the objective function is obtained, the objective function is called, and the execution related information of the objective function is obtained; the execution-related information may include at least one of an execution parameter, a return result, and exception information; the execution related information may also include user information, request URL, and the like.
Specifically, after the related information of the execution of the function is obtained, the log information conforming to the preset format can be generated according to the preset format, so that the log information can be conveniently processed, stored and queried.
In a specific implementation process, an interface may correspond to an objective function, and invoking the objective function may generate some execution related information, for example, the objective function corresponding to the interface a is a function, invoking the function a may obtain some execution information, where the execution information includes input parameters when the objective function is invoked, and returns at least one of a result and exception information.
In a specific implementation process, when generating the log information according to the execution related information, it is required to determine whether the abnormal information exists, and determine what format to generate the log information according to the existence of the abnormal information, for example, the currently obtained execution related information contains the abnormal information, and the log information is generated according to a preset abnormal format.
In some possible embodiments, the log generating method further includes:
(1) Determining a page scene corresponding to the target log based on a preset interface corresponding relation; the interface corresponding relation comprises corresponding relations between a plurality of interfaces and a plurality of different page scenes;
(2) And displaying a target page corresponding to the page scene.
The preset interface corresponding relation refers to a constraint relation of the interface and the page scene, page scene information corresponding to the interface can be found according to the constraint relation, and a target page is restored and displayed according to a target log corresponding to the interface and the corresponding page scene information.
For example, the interface corresponding to the log query request is the interface X, and according to the preset interface correspondence, the page scene corresponding to the interface X is the main page scene, and the restored page information is determined according to the obtained log information and the obtained main page scene, restored and displayed.
In the specific implementation process, when a request of a user for log inquiry and page scenes is received, a corresponding interface is found according to the URL to generate log information, then the corresponding page scene is determined by combining the corresponding relation of the interface, a target page is restored according to the target log and the page scene, the target page is visualized and displayed to the user, and reproduction of the page scene is completed.
In some possible embodiments, the generating the log information according to the execution related information in the above steps includes:
(1) If the execution related information is detected to contain abnormal information, generating the log information in a first preset format;
(2) And if no abnormal information is detected in the execution related information, generating the log information in a second preset format.
Wherein, the two preset formats are return formats for different situations of the same acquisition execution related information. According to the format of log information generated by the execution related information containing the abnormal information, the first preset format can be the abnormal format for recording the log information; recording the log information in a normal format according to the format of the log information generated by the execution related information without abnormal information; the first preset format and the second preset format are built in the log decorator and are selected and used when log information is generated.
Specifically, after the execution related information is obtained, a judgment is made to see whether the execution related information contains abnormal information, and then log information is generated according to whether different formats are selected for the abnormal information. The obtained execution related information contains abnormal information, the generated log information is in an abnormal format, and if the obtained execution related information does not contain the abnormal information, the generated log information is in a normal format.
In some possible embodiments, the target log is a log in a preset structured format; the preset structuring format comprises at least two different structuring levels;
the method further comprises the steps of:
(1) And traversing each structure level of the target log in sequence from the first preset level of the preset structural format, and filtering sensitive information in each structure level until traversing to the second preset level of the preset structural format.
At least one layer of logs in a preset structured format is arranged, and traversing and filtering are performed in a layered mode when the logs in the structured format are filtered.
Specifically, a highest traversal level number is preset, when each structure level is traversed, the current level number is increased by one, and when the level number reaches the highest traversal level number, the next level is not traversed and filtered, so that a filtered target log is obtained. For example, the number of the highest traversal level is set to be 5, and the current level is set to be 4, then after the 4 th level is traversed, the number of the current level is increased by one to be 5, the highest traversal level is reached, and then the traversal of the next level is stopped, so that the filtered target log is obtained.
In some possible embodiments, filtering sensitive information in each structural hierarchy in the steps described above includes:
s301, determining a field structure of a current structure level.
Wherein the field structure of the structure hierarchy may be a dictionary structure or a list structure.
Specifically, from a first preset level, judging the field structure of the first preset level, and selecting whether to filter sensitive information on the field content of the current level according to different field structures, for example, if the field structure of the current structure level is a dictionary structure, filtering sensitive information on the current level, and if the field structure of the current structure level is a list structure, judging the field of the next structure level.
S302, if the field structure of the current level accords with the preset structure, comparing the first field in the current level with the preset sensitive field.
The preset structure may be a dictionary structure, the dictionary structure may be a corresponding structure of keys and values, and the first field may be a key in the dictionary structure.
In the implementation process, if the field structure of the current level is a dictionary structure, comparing the first field in the current level with a preset sensitive field to obtain a comparison result, and determining whether to process the sensitive field according to the comparison result.
For example, if the field structure of the current hierarchy is a dictionary structure, the dictionary structure includes keys and corresponding values, the key fields in the current hierarchy are compared with preset sensitive fields, if the comparison result accords with the preset judgment rule, the key fields which accord with the preset judgment rule are considered to be sensitive fields, and the sensitive fields are deleted. The preset judging rule may include: if the two compared fields are identical, the field can be processed, or the number of characters of the key field, which is identical to that of the preset sensitive field, is greater than or equal to a threshold value, and the field can be filtered.
And S303, if the first field is matched with a preset sensitive field, deleting the first field and the corresponding log information from the current structure level.
Specifically, the judging process for considering that the first field is matched with the preset sensitive field may include: the first field is considered to be matched when the first field is identical to the sensitive field, or the ratio of the number of characters of the first field identical to the sensitive field to the total number of characters exceeds a preset threshold value.
Specifically, when the first field is matched with a preset sensitive field, deleting the first field and log information corresponding to the first field, wherein the first field can be a key in a dictionary structure, and if the key is matched with the sensitive field, deleting a value corresponding to the key and the log information from a structure level to obtain a filtered field.
In the above embodiment, the interface and the function corresponding to the log query request are determined according to the preset correspondence between the URL and the interface in the log decorator and the URL included in the log query request, the corresponding function is called to obtain the log related information, then the log is generated based on the log information, and is stored in the database after encryption, when the scene reproduction requirement exists, the log can be quickly queried, and the corresponding page scene is determined and displayed. Through the collection of interfaces and the generation of the logs, the corresponding interfaces can be quickly found and the logs can be generated according to the corresponding relation of the interfaces in the log decorator during the inquiry, and the efficiency of log generation and user inquiry can be effectively improved.
In order to more clearly understand the log generation method described in the embodiments of the present application, the following will be further described in detail with reference to examples.
In one example, as shown in fig. 4, the log generating method of the present application may include:
receiving a log query request (namely an http request or an RPC request shown in the figure) of a user for an application program; the log inquiry request comprises a Uniform Resource Locator (URL) mode; determining a target interface corresponding to the URL mode through a preset log decorator (namely an interface log decorator shown in the figure); the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode is provided with a corresponding interface; acquiring an objective function corresponding to the objective interface, and acquiring execution related information of the objective function; wherein the execution related information comprises at least one of execution parameters and exception information; and generating the log information according to the execution related information, and generating a target log based on the log information.
The generated target log is a log with a preset structured format; the preset structuring format comprises at least two different structuring levels; starting from a first preset level of the preset structured format, traversing each structure level of the target log in turn, and filtering sensitive information in each structure level until traversing to a second preset level of the preset structured format (namely privacy filtering shown in the figure).
When the user behavior scene is required to be reproduced (namely, a scene reproduction technician in the figure performs log inquiry), determining a page scene corresponding to the target log based on a preset interface corresponding relation; the interface corresponding relation comprises corresponding relations between a plurality of interfaces and a plurality of different page scenes; and displaying the target page corresponding to the page scene.
The process collects the corresponding log information through the interfaces, and when a user inquires the log, the corresponding interfaces can be quickly found and the log can be generated according to the corresponding relation of the interfaces in the log decorator, so that the log generation efficiency and the log inquiring efficiency of the user can be effectively improved.
The embodiment of the application provides a log generating device, as shown in fig. 5, the device 50 may include: a receiving module 501, a determining module 502 and a generating module 503, wherein,
a receiving module 501, configured to receive a log query request of a user for an application program; the log query request comprises a Uniform Resource Locator (URL) mode;
a determining module 502, configured to determine, by using a preset log decorator, a target interface corresponding to the URL mode; the log decorator is used for collecting log information of the application program through different interfaces; the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode is provided with a corresponding interface;
a generating module 503, configured to obtain corresponding log information through the determined target interface, and generate a target log based on the log information.
In some possible embodiments, the generating module 403 is further configured to determine and display a page scenario of the target log, where the method includes:
determining a page scene corresponding to the target log based on a preset interface corresponding relation; the interface corresponding relation comprises corresponding relations between a plurality of interfaces and a plurality of different page scenes;
and displaying a target page corresponding to the page scene.
In some possible embodiments, the target log is a log in a preset structured format; the preset structuring format comprises at least two different structuring levels; the generating module 403 is further configured to filter out sensitive information, and the method includes:
and traversing each structure level of the target log in sequence from the first preset level of the preset structural format, and filtering sensitive information in each structure level until traversing to the second preset level of the preset structural format.
According to the log generation device, through the corresponding relation between the URL in the preset log decorator and the interface and the URL contained in the log query request, the interface and the function corresponding to the log query request are determined, the corresponding function is called to obtain log related information, then the log is generated based on the log information and stored in the database in an encrypted mode, when the scene reproduction requirement exists, the log can be quickly queried, and the corresponding page scene is determined and displayed. Through the collection of interfaces and the generation of the logs, the corresponding interfaces can be quickly found and the logs can be generated according to the corresponding relation of the interfaces in the log decorator during the inquiry, and the efficiency of log generation and user inquiry can be effectively improved.
The embodiment of the application provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to realize the steps of a log generation method, and compared with the related art, the method can realize the steps of the log generation method: the log decorator is used for fast matching to the corresponding interface of the log query request to generate the corresponding log, so that the efficiency of log generation and user query log can be effectively improved.
In an alternative embodiment, an electronic device is provided, as shown in fig. 6, and an electronic device 6000 shown in fig. 6 includes: a processor 6001 and a memory 6003. In which a processor 6001 is coupled to a memory 6003, such as via a bus 6002. Optionally, the electronic device 6000 may also include a transceiver 6004, the transceiver 6004 may be used for data interactions between the electronic device and other electronic devices, such as transmission of data and/or reception of data and the like. It should be noted that, in practical applications, the transceiver 6004 is not limited to one, and the structure of the electronic device 6000 is not limited to the embodiment of the present application.
The processor 6001 may be a CPU (Central Processing Unit ), general purpose processor, DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor 6001 may also be a combination that performs computing functions, e.g., including one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
Bus 6002 may include a path to transfer information between the aforementioned components. Bus 6002 may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or EISA (Extended Industry Standard Architecture ) bus, or the like. The bus 6002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 6, but not only one bus or one type of bus.
The Memory 6003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory ) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory ), a CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store a computer program and that can be Read by a computer, without limitation.
The memory 6003 is for storing a computer program that executes an embodiment of the present application, and is controlled to be executed by the processor 6001. The processor 6001 is configured to execute a computer program stored in the memory 6003 to implement the steps shown in the foregoing method embodiments.
Among them, electronic devices include, but are not limited to: a mobile phone, a computer and the like can use the terminal equipment of the related application program.
Embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, where the computer program, when executed by a processor, may implement the steps and corresponding content of the foregoing method embodiments.
The embodiments of the present application also provide a computer program product, which includes a computer program, where the computer program can implement the steps of the foregoing method embodiments and corresponding content when executed by a processor.
The terms "first," "second," "third," "fourth," "1," "2," and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the present application described herein may be implemented in other sequences than those illustrated or otherwise described.
It should be understood that, although the flowcharts of the embodiments of the present application indicate the respective operation steps by arrows, the order of implementation of these steps is not limited to the order indicated by the arrows. In some implementations of embodiments of the present application, the implementation steps in the flowcharts may be performed in other orders as desired, unless explicitly stated herein. Furthermore, some or all of the steps in the flowcharts may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or phases may be performed at the same time, or each of these sub-steps or phases may be performed at different times, respectively. In the case of different execution time, the execution sequence of the sub-steps or stages may be flexibly configured according to the requirement, which is not limited in the embodiment of the present application.
The foregoing is merely an optional implementation manner of the implementation scenario of the application, and it should be noted that, for those skilled in the art, other similar implementation manners based on the technical ideas of the application are adopted without departing from the technical ideas of the application, and also belong to the protection scope of the embodiments of the application.

Claims (11)

1. A log generation method, comprising:
receiving a log query request of a user for an application program; the log query request comprises a Uniform Resource Locator (URL) mode;
determining a target interface corresponding to the URL mode through a preset log decorator; the log decorator is used for collecting log information of the application program through different interfaces; the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode is provided with a corresponding interface;
and acquiring corresponding log information through the determined target interface, and generating a target log based on the log information.
2. The log generation method according to claim 1, wherein the determining a target interface corresponding to the URL pattern includes:
acquiring a URL white list in the plurality of URLs conforming to a preset mode, and determining a target URL matched with the URL mode in the URL white list;
and determining the target interface corresponding to the target URL.
3. The method of generating a log according to claim 1, wherein the obtaining, through the target interface, the corresponding log information includes:
acquiring an objective function corresponding to the objective interface, and acquiring execution related information of the objective function; wherein the execution related information comprises at least one of execution parameters and exception information;
and generating the log information according to the execution related information.
4. The log generating method as defined in claim 1, further comprising:
determining a page scene corresponding to the target log based on a preset interface corresponding relation; the interface corresponding relation comprises corresponding relations between a plurality of interfaces and a plurality of different page scenes;
and displaying a target page corresponding to the page scene.
5. The log generating method as set forth in claim 3, wherein said generating said log information from said execution-related information includes:
if the execution related information is detected to contain abnormal information, generating the log information in a first preset format;
and if no abnormal information is detected in the execution related information, generating the log information in a second preset format.
6. The log generating method according to claim 1, wherein the target log is a log in a preset structured format; the preset structuring format comprises at least two different structuring levels;
the method further comprises the steps of:
and traversing each structure level of the target log in sequence from the first preset level of the preset structural format, and filtering sensitive information in each structure level until traversing to the second preset level of the preset structural format.
7. The method of log generation according to claim 6, wherein said filtering sensitive information in each structure level comprises:
determining a field structure of a current structure level;
if the field structure of the current level accords with the preset structure, comparing the first field in the current level with a preset sensitive field;
and if the first field is matched with a preset sensitive field, deleting the first field and the corresponding log information from the current structure level.
8. A log generating apparatus, comprising:
the receiving module is used for receiving a log query request of a user for an application program; the log query request comprises a Uniform Resource Locator (URL) mode;
the determining module is used for determining a target interface corresponding to the URL mode through a preset log decorator; the log decorator is used for collecting log information of the application program through different interfaces; the log information comprises log information corresponding to a plurality of URLs conforming to a preset mode, and each URL conforming to the preset mode is provided with a corresponding interface;
and the generating module is used for acquiring corresponding log information through the determined target interface and generating a target log based on the log information.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to carry out the steps of the method according to any one of claims 1 to 7.
10. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor realizes the steps of the log generation method of any of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
CN202310107433.6A 2023-01-19 2023-01-19 Log generation method, device, electronic equipment, storage medium and program product Pending CN116069609A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310107433.6A CN116069609A (en) 2023-01-19 2023-01-19 Log generation method, device, electronic equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310107433.6A CN116069609A (en) 2023-01-19 2023-01-19 Log generation method, device, electronic equipment, storage medium and program product

Publications (1)

Publication Number Publication Date
CN116069609A true CN116069609A (en) 2023-05-05

Family

ID=86179884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310107433.6A Pending CN116069609A (en) 2023-01-19 2023-01-19 Log generation method, device, electronic equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN116069609A (en)

Similar Documents

Publication Publication Date Title
US20110153748A1 (en) Remote forensics system based on network
CN103888490A (en) Automatic WEB client man-machine identification method
CN102473227B (en) Information management apparatus, information management method, and information management program
CN110162512B (en) Log retrieval method, device and storage medium
CN111008348A (en) Anti-crawler method, terminal, server and computer readable storage medium
CN111368227B (en) URL processing method and device
CN111209256A (en) File monitoring method and device, electronic equipment and storage medium
CN112632129A (en) Code stream data management method, device and storage medium
CN111723245B (en) Method for establishing association relation of different types of storage objects in data storage system
CN111224923A (en) Detection method, device and system for counterfeit websites
CN116303628B (en) Alarm data query method, system and equipment based on elastic search
CN109284833B (en) Method, apparatus and storage medium for obtaining feature data for machine learning model
CN112035676A (en) User operation behavior knowledge graph construction method and device
CN115374109B (en) Data access method, device, computing equipment and system
CN116069609A (en) Log generation method, device, electronic equipment, storage medium and program product
CN115827589A (en) Authority verification method and device, electronic equipment and storage medium
CN113761443A (en) Website page data acquisition and statistics method, storage medium and equipment
KR20110070767A (en) Remote forensics system based on network
CN114510605A (en) Data storage method and device, electronic equipment and storage medium
CN111639936B (en) Transaction information acquisition method and device, electronic equipment and readable storage medium
CN210804423U (en) Website information acquisition and release platform system
CN116382596B (en) Space-time big data storage method and system based on distributed technology
CN114697322B (en) Data screening method based on cloud service processing
CN113449196B (en) Information generation method and device, electronic equipment and readable storage medium
CN116975118A (en) Data query method and device, electronic equipment and storage 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