Log display method, device, equipment and storage medium

By receiving user configuration tables, parsing and intercepting log files, the problem of difficult positioning caused by excessive amount of data in log file fields is solved, and concise and clear log display and rapid positioning are achieved.

CN111767262BActive Publication Date: 2025-09-23SAI ANDY TECHNOLOGY (HONG KONG) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010610560.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2025-09-23
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

In the prior art, the amount of data in the log file fields is too large, making it difficult to quickly locate the log information that needs to be viewed.

Method used

By receiving the user configuration table, parsing and intercepting the log file, replacing and feeding back the log data based on the parameters of the configuration file, the log display is simplified.

Benefits of technology

Improved the display efficiency of log files on the display interface, making log information concise and clear, and convenient for quickly locating required data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111767262B_ABST
    Figure CN111767262B_ABST
Patent Text Reader

Abstract

The present invention relates to data processing technology and provides a log display method, apparatus, device, and storage medium. The method receives a log file display request from a user, obtains a configuration table corresponding to the request type, and sends it to the user, allowing the user to perform configuration operations on the configuration table based on the log file to be displayed. When a confirmation message indicating that the configuration is complete is detected from the user, the completed configuration table is stored in a preset configuration file, and a determination is made as to whether the parameters of the configuration file meet preset conditions. If the preset conditions are met, the log file is obtained and parsed based on the parameters of the configuration file, an interception operation is performed on log data of a preset type in the parsed log file, and a replacement operation is performed on the intercepted log data in the log file based on preset replacement rules. The log file after the replacement operation is fed back to the user. The present invention can improve the display efficiency of log files on a display interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a log display method, device, equipment and storage medium. Background Art

[0002] Logs are a very important part of the system, whether in the business development process, business testing process, or log location in the production environment. Currently, most log viewing relies on tools provided by the Linux operating system, such as tail, less, and more. When log files contain too much field data, using these tools to view logs can easily cause certain attribute fields to occupy a large amount of display space on the display page, making it difficult for developers to quickly locate the logs they need to view. Summary of the Invention

[0003] In view of the above, the present invention provides a log display method, device, equipment and storage medium, which aims to solve the technical problem in the prior art that it is difficult to quickly locate the logs to be viewed.

[0004] To achieve the above object, the present invention provides a log display method, which includes:

[0005] Receiving step: receiving a log file display request from a user, obtaining a first configuration table corresponding to the request type and sending the first configuration table to the user, so that the user can perform a configuration operation on the first configuration table based on the first log file to be displayed carried in the request;

[0006] Determination step: monitoring in real time whether the user sends a confirmation message of configuration completion, when monitoring the user sends a confirmation message of configuration completion, storing the configured first configuration table into a preset configuration file, and determining whether the parameters of the configuration file meet the preset conditions;

[0007] Intercepting step: when the parameters of the configuration file meet the preset conditions, using the configuration file as the configuration file corresponding to the request, acquiring and parsing the first log file based on the parameters of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file; and

[0008] Feedback step: performing a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file after the replacement operation to the user.

[0009] Preferably, the judging step further includes:

[0010] When the parameters of the configuration file do not meet the preset conditions, or when the configuration file does not exist in the preset storage path, a default configuration file is used as the configuration file corresponding to the request.

[0011] Preferably, the intercepting step further comprises:

[0012] The intercepted log data of a preset type is stored in a preset storage space in a preset format. After the feedback step, the method also includes: when a user's request to obtain the intercepted log data is received, the intercepted log data is obtained from the index file of the preset storage space according to the index identifier carried in the request and fed back to the user.

[0013] Preferably, the determining whether the parameters of the configuration file meet the preset conditions includes:

[0014] Determining whether a path parameter, a display length parameter, and an embedded depth parameter exist in the configuration file; and when the path parameter, the display length parameter, and the embedded depth parameter all exist, determining that the parameters of the configuration file meet a preset condition;

[0015] When any one of the path parameter, the display length parameter, and the embedded depth parameter does not exist, it is determined that the parameters of the configuration file do not meet the preset conditions.

[0016] Preferably, the acquiring and parsing the first log file based on the parameters of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file includes:

[0017] The first log file is obtained based on the path parameter of the configuration file, the obtained first log file is parsed based on the embedded depth parameter of the configuration file, and the log data of the preset type of the parsed first log file is intercepted based on the display length parameter of the configuration file.

[0018] Preferably, parsing the acquired first log file based on the embedded depth parameter of the configuration file includes:

[0019] When the embedded depth parameter is a preset value, log data of a preset type is read from the obtained first log file based on preset characters and the preset value, wherein the log data of the preset type includes an attribute field of a JSON string.

[0020] Preferably, the method also includes: when it is detected that the user has modified the configuration table, obtaining the modified second configuration table, obtaining the second log file to be displayed corresponding to the second configuration table based on the path parameter of the second configuration table, and performing an interception operation on the log data of a preset type of the second log file based on the display length parameter of the second configuration table.

[0021] To achieve the above object, the present invention further provides a diary display device, which includes:

[0022] A receiving module is configured to receive a log file display request from a user, obtain a first configuration table corresponding to the request type, and send the first configuration table to the user, so that the user can perform a configuration operation on the first configuration table based on the first log file to be displayed carried in the request;

[0023] A judgment module is used to monitor in real time whether the user sends a confirmation message that the configuration is completed. When the user sends a confirmation message that the configuration is completed, the judgment module stores the first configuration table that has been configured into a preset configuration file and judges whether the parameters of the configuration file meet the preset conditions.

[0024] An interception module is configured to, when the parameters of the configuration file meet preset conditions, use the configuration file as the configuration file corresponding to the request, obtain and parse the first log file based on the parameters of the configuration file, and perform an interception operation on log data of a preset type in the parsed first log file;

[0025] Feedback module: used for performing a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file after the replacement operation to the user.

[0026] To achieve the above object, the present invention further provides an electronic device, comprising:

[0027] at least one processor; and,

[0028] a memory communicatively connected to the at least one processor; wherein,

[0029] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the log display method according to any one of claims 1 to 5.

[0030] To achieve the above-mentioned objectives, the present invention also provides a computer-readable storage medium, which includes a data storage area and a program storage area. The data storage area stores data created according to the use of the blockchain node, and the program storage area stores a log display program. When the log display program is executed by a processor, any step of the log display method described above is implemented.

[0031] The log display method, device, equipment and storage medium proposed in the present invention parse and replace log files through configuration information, so that the displayed log information is concise and clear, avoiding the difficulty of quickly locating the location of the log to be viewed when viewing a certain field information of the log file due to the field attributes being too long, thereby improving the display efficiency of the log file on the display interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of a preferred embodiment of an electronic device of the present invention;

[0033] Figure 2 for Figure 1 Schematic diagram of the modules of the preferred embodiment of the log display device;

[0034] Figure 3 This is a flow chart of a preferred embodiment of the log display method of the present invention;

[0035] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0037] Reference Figure 1 FIG. 1 is a schematic diagram of a preferred embodiment of an electronic device 1 of the present invention.

[0038] The electronic device 1 includes, but is not limited to, a memory 11, a processor 12, a display 13, and a network interface 14. The electronic device 1 is connected to a network via the network interface 14 to obtain raw data. The network may be a wireless or wired network such as an intranet, the Internet, a Global System of Mobile Communications (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, Wi-Fi, or a call network.

[0039] The memory 11 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1, such as the hard disk or internal memory of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash memory card, etc. equipped with the electronic device 1. Of course, the memory 11 may also include both the internal storage unit of the electronic device 1 and its external storage device. In this embodiment, the memory 11 is generally used to store the operating system and various application software installed on the electronic device 1, such as the program code of the log display program 10. In addition, the memory 11 may also be used to temporarily store various types of data that have been output or are about to be output.

[0040] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication. In this embodiment, the processor 12 is used to execute program code stored in the memory 11 or process data, such as executing the program code of the log display program 10.

[0041] The display 13 can be referred to as a display screen or a display unit. In some embodiments, the display 13 can be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an organic light-emitting diode (OLED) touch screen. The display 13 is used to display information processed by the electronic device 1 and to display a visual working interface, such as displaying statistical data results.

[0042] The network interface 14 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface). The network interface 14 is generally used to establish a communication connection between the electronic device 1 and other electronic devices.

[0043] Figure 1Only the electronic device 1 having the components 11 - 14 and the log display program 10 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0044] Optionally, the electronic device 1 may further include a user interface, which may include a display and an input unit such as a keyboard. The optional user interface may also include a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an organic light-emitting diode (OLED) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.

[0045] The electronic device 1 may further include a radio frequency (RF) circuit, a sensor, an audio circuit, etc., which will not be described in detail here.

[0046] In the above embodiment, when the processor 12 executes the log display program 10 stored in the memory 11, the following steps may be implemented:

[0047] Receiving step: receiving a log file display request from a user, obtaining a first configuration table corresponding to the request type and sending the first configuration table to the user, so that the user can perform a configuration operation on the first configuration table based on the first log file to be displayed carried in the request;

[0048] Determination step: monitoring in real time whether the user sends a confirmation message of configuration completion, when monitoring the user sends a confirmation message of configuration completion, storing the configured first configuration table into a preset configuration file, and determining whether the parameters of the configuration file meet the preset conditions;

[0049] Intercepting step: when the parameters of the configuration file meet the preset conditions, using the configuration file as the configuration file corresponding to the request, acquiring and parsing the first log file based on the parameters of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file; and

[0050] Feedback step: performing a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file after the replacement operation to the user.

[0051] The storage device may be the memory 11 of the electronic device 1 , or may be another storage device that is communicatively connected to the electronic device 1 .

[0052] For a detailed description of the above steps, please refer to the following Figure 2 Program module diagram of the embodiment of the log display device 100 and Figure 3 Description of a flowchart of an embodiment of a log display method.

[0053] Reference Figure 2 , which is a functional module diagram of the log display device 100 of the present invention.

[0054] The log display device 100 described in the present invention can be installed in an electronic device. Depending on the functionality to be implemented, the log display device 100 may include a receiving module 110, a judgment module 120, an interception module 130, and a feedback module 140. A module, also referred to as a unit, is a series of computer program segments that can be executed by an electronic device processor and perform a fixed function, and is stored in the electronic device's memory.

[0055] In this embodiment, the functions of each module / unit are as follows:

[0056] The receiving module 110 is used to receive a log file display request issued by a user, obtain a first configuration table corresponding to the request type and send it to the user, so that the user can perform configuration operations on the first configuration table based on the first log file to be displayed carried in the request.

[0057] In this embodiment, when a log file display request is received from a user, a first configuration table corresponding to the request type is obtained and sent to the user, so that the user can perform configuration operations on the first configuration table based on the first log file to be displayed carried in the request, wherein the configuration table may include input items for the path parameter of the log file to be displayed, the display length parameter of the log file to be displayed, and the embedded depth parameter. In actual application, the user can configure the various parameters of the configuration table according to the actual display requirements. A log file is a record file or a collection of files used to record application operation events, which can be used to understand the activities of the application, track diagnostic problems, process historical data, etc. Since log printing is printed line by line, if a JSON string is printed in a line log, some attribute fields of the JSON string are very long, which easily occupies the space of the entire display page when displayed, making it difficult for users (for example, operation and maintenance personnel) to find the data they want to see. Therefore, the configuration table can be sent to the user for the user to configure the configuration table according to the actual display requirements.

[0058] The judgment module 120 is used to monitor in real time whether the user sends a confirmation message that the configuration is completed. When the user sends a confirmation message that the configuration is completed, the first configuration table of the configuration is stored in a preset configuration file, and it is judged whether the parameters of the configuration file meet the preset conditions.

[0059] In this embodiment, the user can send a confirmation message of configuration completion when the configuration is completed. When the user is monitored to send a confirmation message of configuration completion, the first configuration table completed by the user is stored in a preset configuration file. Since the user may make configuration errors or incomplete configuration information during the configuration process, resulting in the inability to parse the configuration file or a parsing error, this embodiment can also determine whether the parameters of the configuration file meet the preset conditions. The preset conditions can be whether the configuration parameters are complete. Specifically, it can be determined whether the parameters of the configuration file meet the preset conditions based on the path parameters, display length parameters and embedded depth parameters of the configuration file.

[0060] Furthermore, determining whether the parameters of the configuration file meet the preset conditions includes:

[0061] Determine whether the path parameter, display length parameter, and embedded depth parameter exist in the configuration file. If all of the path parameter, display length parameter, and embedded depth parameter exist, the configuration file parameters are determined to meet the preset conditions. If any of the path parameter, display length parameter, and embedded depth parameter does not exist, the configuration file parameters are determined to not meet the preset conditions. Since the path parameter is used to search for the first log file to be displayed, the display length parameter is used to intercept the log file to be displayed, and the embedded depth parameter is used to parse the log file to be displayed, the path parameter, display length parameter, and embedded depth parameter must exist in the configuration file.

[0062] In one embodiment, when the parameters of the configuration file do not meet the preset conditions, or when the configuration file does not exist in the preset storage path, a default configuration file is used as the configuration file corresponding to the request. For example, the parameters of the default configuration file include:

[0063] json.length = 6;

[0064] json.parse.deep=3;

[0065] json.input.log.path= / data / ai / server.log;

[0066] Since the configuration file jsonDataLog.conf is stored in a unified directory, when the configuration file is not found or when the configuration file parameters are incomplete, the default configuration file can be used as the configuration file corresponding to the request.

[0067] The interception module 130 is used to use the configuration file as the configuration file corresponding to the request when the parameters of the configuration file meet the preset conditions, obtain and parse the first log file based on the parameters of the configuration file, and perform an interception operation on the log data of the preset type of the parsed first log file.

[0068] In this embodiment, when the parameters of a configuration file meet preset conditions, the configuration file is used as the configuration file corresponding to the log file display request. Based on the parameters corresponding to the configuration file, a first log file to be displayed is obtained, the first log file is parsed, and then a capture operation is performed on the log data of a preset type in the parsed first log file. The preset type of log data may exceed the display length. By capturing the log data exceeding the display length using the configuration information in the configuration file, the displayed log information is concise and clear, thereby improving the efficiency of log file display on the display interface.

[0069] In one embodiment, the intercepted log data of a preset type is stored in a preset storage space in a preset format. The preset format may be a key-value pair format. By storing the intercepted log data of the preset type in the preset storage space, when a user needs to view the intercepted log data, the user can quickly obtain the intercepted log data.

[0070] In one embodiment, the acquiring and parsing the first log file based on the parameters of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file includes:

[0071] The first log file is obtained based on the path parameter of the configuration file, the obtained first log file is parsed based on the embedded depth parameter of the configuration file, and the preset type of log data of the parsed first log file is intercepted based on the display length parameter of the configuration file. The path parameter includes the path information of the first log file, so the first log file can be obtained according to the path parameter. After obtaining the first log file to be displayed, the first log file is parsed based on the embedded depth parameter of the configuration file. When the embedded depth parameter is a preset value, the preset type of log data is read from the obtained first log file based on the preset characters and the preset value. Specifically, when the embedded depth parameter is 1, the attribute field below the JSON is directly replaced. When the embedded depth parameter is 2, one more layer is parsed below, with the preset character "{}" as one layer. When the embedded depth parameter increases, the number of parsed layers increases successively. Among them, the preset type of log data can be an attribute field of a JSON string.

[0072] The feedback module 140 is configured to perform a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feed back the log file after the replacement operation to the user.

[0073] In this embodiment, a replacement operation is performed on the intercepted log data in the log file based on a preset replacement rule. For example, the intercepted log data can be replaced with an ellipsis "...", and the log file after the replacement operation is fed back to the user. This can shorten the character display length and improve the display efficiency, making it easier for users to quickly find the data they need in the log.

[0074] The intercepted log data is replaced by characters that meet the JSON parsing condition format in the original characters and stored in the cache. For example, the intercepted log data can be replaced by:

[0075] Original character display: {“name”: “zhang san shui xxx”}

[0076] Display after replacement: {"name":"zhang.."}

[0077] The character display length can be shortened to improve display efficiency, making it easier for users to quickly find the data they need in the log.

[0078] In one embodiment, when a user request for obtaining the intercepted log data is received, the intercepted log data is obtained from the index file of the preset storage space according to the index identifier carried in the request and fed back to the user. When a user request for obtaining the intercepted log data is received, the intercepted log data is obtained from the preset storage space (cache) according to the index identifier (e.g., key) carried in the request and displayed.

[0079] In one embodiment, when it is detected that the user has modified the configuration table, the modified second configuration table is obtained, the second log file to be displayed corresponding to the second configuration table is obtained based on the path parameter of the second configuration table, and the log data of the preset type of the second log file is intercepted based on the display length parameter of the second configuration table.

[0080] In addition, the present invention also provides a log display method. Figure 3 FIG. 1 is a flow chart of an embodiment of a log display method of the present invention. When the processor 12 of the electronic device 1 executes the log display program 10 stored in the memory 11, the following steps of the log display method are implemented:

[0081] Step S10: receiving a log file display request from a user, obtaining a first configuration table corresponding to the request type and sending it to the user, so that the user can perform configuration operations on the first configuration table based on the first log file to be displayed carried in the request.

[0082] In this embodiment, when a log file display request is received from a user, a first configuration table corresponding to the request type is obtained and sent to the user, so that the user can perform configuration operations on the first configuration table based on the first log file to be displayed carried in the request, wherein the configuration table may include input items for the path parameter of the log file to be displayed, the display length parameter of the log file to be displayed, and the embedded depth parameter. In actual application, the user can configure the various parameters of the configuration table according to the actual display requirements. A log file is a record file or a collection of files used to record application operation events, which can be used to understand the activities of the application, track diagnostic problems, process historical data, etc. Since log printing is printed line by line, if a JSON string is printed in a line log, some attribute fields of the JSON string are very long, which easily occupies the space of the entire display page when displayed, making it difficult for users (for example, operation and maintenance personnel) to find the data they want to see. Therefore, the configuration table can be sent to the user for the user to configure the configuration table according to the actual display requirements.

[0083] Step S20: monitor in real time whether the user sends a confirmation message of configuration completion. When the user sends a confirmation message of configuration completion, store the configured first configuration table into a preset configuration file, and determine whether the parameters of the configuration file meet the preset conditions.

[0084] In this embodiment, the user can send a confirmation message of configuration completion when the configuration is completed. When the user is monitored to send a confirmation message of configuration completion, the first configuration table completed by the user is stored in a preset configuration file. Since the user may make configuration errors or incomplete configuration information during the configuration process, resulting in the inability to parse the configuration file or a parsing error, this embodiment can also determine whether the parameters of the configuration file meet the preset conditions. The preset conditions can be whether the configuration parameters are complete. Specifically, it can be determined whether the parameters of the configuration file meet the preset conditions based on the path parameters, display length parameters and embedded depth parameters of the configuration file.

[0085] Furthermore, determining whether the parameters of the configuration file meet the preset conditions includes:

[0086] Determine whether the path parameter, display length parameter, and embedded depth parameter exist in the configuration file. If all of the path parameter, display length parameter, and embedded depth parameter exist, the configuration file parameters are determined to meet the preset conditions. If any of the path parameter, display length parameter, and embedded depth parameter does not exist, the configuration file parameters are determined to not meet the preset conditions. Since the path parameter is used to search for the first log file to be displayed, the display length parameter is used to intercept the log file to be displayed, and the embedded depth parameter is used to parse the log file to be displayed, the path parameter, display length parameter, and embedded depth parameter must exist in the configuration file.

[0087] In one embodiment, when the parameters of the configuration file do not meet the preset conditions, or when the configuration file does not exist in the preset storage path, a default configuration file is used as the configuration file corresponding to the request. For example, the parameters of the default configuration file include:

[0088] json.length = 6;

[0089] json.parse.deep=3;

[0090] json.input.log.path= / data / ai / server.log;

[0091] Since the configuration file jsonDataLog.conf is stored in a unified directory, when the configuration file is not found or when the configuration file parameters are incomplete, the default configuration file can be used as the configuration file corresponding to the request.

[0092] Step S30: When the parameters of the configuration file meet the preset conditions, the configuration file is used as the configuration file corresponding to the request, the first log file is obtained and parsed based on the parameters of the configuration file, and an interception operation is performed on the log data of the preset type of the parsed first log file.

[0093] In this embodiment, when the parameters of a configuration file meet preset conditions, the configuration file is used as the configuration file corresponding to the log file display request. Based on the parameters corresponding to the configuration file, a first log file to be displayed is obtained, the first log file is parsed, and then a capture operation is performed on the log data of a preset type in the parsed first log file. The preset type of log data may exceed the display length. By capturing the log data exceeding the display length using the configuration information in the configuration file, the displayed log information is concise and clear, thereby improving the efficiency of log file display on the display interface.

[0094] In one embodiment, the intercepted log data of a preset type is stored in a preset storage space in a preset format. The preset format may be a key-value pair format. By storing the intercepted log data of the preset type in the preset storage space, when a user needs to view the intercepted log data, the user can quickly obtain the intercepted log data.

[0095] In one embodiment, the acquiring and parsing the first log file based on the parameters of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file includes:

[0096] The first log file is obtained based on the path parameter of the configuration file, the obtained first log file is parsed based on the embedded depth parameter of the configuration file, and the preset type of log data of the parsed first log file is intercepted based on the display length parameter of the configuration file. The path parameter includes the path information of the first log file, so the first log file can be obtained according to the path parameter. After obtaining the first log file to be displayed, the first log file is parsed based on the embedded depth parameter of the configuration file. When the embedded depth parameter is a preset value, the preset type of log data is read from the obtained first log file based on the preset characters and the preset value. Specifically, when the embedded depth parameter is 1, the attribute field below the JSON is directly replaced. When the embedded depth parameter is 2, one more layer is parsed below, with the preset character "{}" as one layer. When the embedded depth parameter increases, the number of parsed layers increases successively. Among them, the preset type of log data can be an attribute field of a JSON string.

[0097] Step S40: performing a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file after the replacement operation to the user.

[0098] In this embodiment, a replacement operation is performed on the intercepted log data in the log file based on a preset replacement rule. For example, the intercepted log data can be replaced with an ellipsis "...", and the log file after the replacement operation is fed back to the user. This can shorten the character display length and improve the display efficiency, making it easier for users to quickly find the data they need in the log.

[0099] The intercepted log data is replaced by characters that meet the JSON parsing condition format in the original characters and stored in the cache. For example, the intercepted log data can be replaced by:

[0100] Original character display: {“name”: “zhang san shui xxx”}

[0101] Display after replacement: {"name":"zhang.."}

[0102] The character display length can be shortened to improve display efficiency, making it easier for users to quickly find the data they need in the log.

[0103] In one embodiment, when a user request for obtaining the intercepted log data is received, the intercepted log data is obtained from the index file of the preset storage space according to the index identifier carried in the request and fed back to the user. When a user request for obtaining the intercepted log data is received, the intercepted log data is obtained from the preset storage space (cache) according to the index identifier (e.g., key) carried in the request and displayed.

[0104] In one embodiment, when it is detected that the user has modified the configuration table, the modified second configuration table is obtained, the second log file to be displayed corresponding to the second configuration table is obtained based on the path parameter of the second configuration table, and the log data of the preset type of the second log file is intercepted based on the display length parameter of the second configuration table.

[0105] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which can be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, etc. The computer-readable storage medium includes a data storage area and a program storage area. The data storage area stores data created according to the use of the blockchain node, and the program storage area stores a log display program 10. When the log display program 10 is executed by the processor, it performs the following operations:

[0106] Receiving step: receiving a log file display request from a user, obtaining a first configuration table corresponding to the request type and sending the first configuration table to the user, so that the user can perform a configuration operation on the first configuration table based on the first log file to be displayed carried in the request;

[0107] Determination step: monitoring in real time whether the user sends a confirmation message of configuration completion, when monitoring the user sends a confirmation message of configuration completion, storing the configured first configuration table into a preset configuration file, and determining whether the parameters of the configuration file meet the preset conditions;

[0108] Intercepting step: when the parameters of the configuration file meet the preset conditions, using the configuration file as the configuration file corresponding to the request, acquiring and parsing the first log file based on the parameters of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file; and

[0109] Feedback step: performing a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file after the replacement operation to the user.

[0110] In another embodiment, the log display method provided by the present invention can further ensure the privacy and security of all the data presented above by storing all of the data in a blockchain node. For example, log files to be displayed or intercepted log data can all be stored in the blockchain node.

[0111] It should be noted that the blockchain referred to in this article refers to a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains information about a batch of online transactions, which is used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.

[0112] The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the log display method described above, and will not be described in detail here.

[0113] It should be noted that the serial numbers of the above-mentioned embodiments of the present invention are for descriptive purposes only and do not represent the advantages or disadvantages of the embodiments. In addition, the terms "including", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method comprising the element.

[0114] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, electronic device, or network equipment, etc.) to execute the methods described in each embodiment of the present invention.

[0115] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A log display method, applied to an electronic device, characterized in that: The method comprises: Receiving step: receiving a log file display request from a user, obtaining a first configuration table corresponding to the request type and sending the first configuration table to the user, so that the user can perform configuration operations on the path parameter, display length parameter, and embedded depth parameter of the first log file contained in the first configuration table based on the first log file to be displayed carried in the request; Determination step: monitoring in real time whether the user sends a confirmation message indicating that the configuration is complete. When the user sends a confirmation message indicating that the configuration is complete, storing the completed first configuration table in a preset configuration file, and determining whether the path parameter, display length parameter, and embedded depth parameter contained in the configuration file meet preset conditions; Intercepting step: when each parameter of the configuration file meets a preset condition, using the configuration file as the configuration file corresponding to the request, acquiring and parsing the first log file based on each parameter of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file; and Feedback step: performing a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file after the replacement operation to the user.

2. The log display method according to claim 1, wherein: The judging step further comprises: When various parameters of the configuration file do not meet preset conditions, or when the configuration file does not exist in a preset storage path, a default configuration file is used as the configuration file corresponding to the request.

3. The log display method according to claim 1, wherein: The intercepting step further includes: storing the intercepted log data of a preset type in a preset format in a preset storage space. After the feedback step, the method further includes: When a user's request for obtaining the intercepted log data is received, the intercepted log data is obtained from the index file in the preset storage space according to the index identifier carried in the request and fed back to the user.

4. The log display method according to claim 1, wherein: The determining whether the path parameter, display length parameter, and embedded depth parameter included in the configuration file meet preset conditions includes: Determining whether a path parameter, a display length parameter, and an embedded depth parameter exist in the configuration file; and when the path parameter, the display length parameter, and the embedded depth parameter all exist, determining that the parameters of the configuration file meet a preset condition; When any one of the path parameter, the display length parameter, and the embedded depth parameter does not exist, it is determined that the parameters of the configuration file do not meet the preset conditions.

5. The log display method according to claim 1, wherein: The acquiring and parsing the first log file based on the parameters of the configuration file, and performing an interception operation on log data of a preset type in the parsed first log file includes: The first log file is obtained based on the path parameter of the configuration file, the obtained first log file is parsed based on the embedded depth parameter of the configuration file, and the log data of the preset type of the parsed first log file is intercepted based on the display length parameter of the configuration file.

6. The log display method according to claim 5, wherein: The parsing of the obtained first log file based on the embedded depth parameter of the configuration file includes: When the embedded depth parameter is a preset value, log data of a preset type is read from the obtained first log file based on preset characters and the preset value, wherein the log data of the preset type includes an attribute field of a JSON string.

7. The log display method according to claim 1, wherein: The method also includes: when it is detected that the user has modified the configuration table, obtaining the modified second configuration table, obtaining a second log file to be displayed corresponding to the second configuration table based on a path parameter of the second configuration table, and performing an interception operation on log data of a preset type of the second log file based on a display length parameter of the second configuration table.

8. A log display device, characterized in that: The device comprises: A receiving module is configured to receive a log file display request from a user, obtain a first configuration table corresponding to the request type, and send the first configuration table to the user, so that the user can perform configuration operations on the path parameter, display length parameter, and embedded depth parameter of the first log file contained in the first configuration table based on the first log file to be displayed carried in the request; A judgment module is used to monitor in real time whether the user sends a confirmation message that the configuration is completed. When the user sends a confirmation message that the configuration is completed, the judgment module stores the first configuration table that has been configured in a preset configuration file and judges whether the path parameter, display length parameter, and embedded depth parameter contained in the configuration file meet the preset conditions; An interception module is configured to, when various parameters of the configuration file meet preset conditions, use the configuration file as the configuration file corresponding to the request, obtain and parse the first log file based on the various parameters of the configuration file, and perform an interception operation on log data of a preset type in the parsed first log file; and Feedback module: used for performing a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file after the replacement operation to the user.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the log display method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a data storage area and a program storage area. The data storage area stores data created according to the use of the blockchain node, and the program storage area stores a log display program. When the log display program is executed by the processor, the steps of the log display method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Term processing method, mobile terminal and computer-readable storage medium

    CN107918608A

  • Log viewing method and device, computer device and storage medium

    CN109325010A