CN111767262A - Log display method, device, equipment and storage medium - Google Patents

Log display method, device, equipment and storage medium Download PDF

Info

Publication number
CN111767262A
CN111767262A CN202010610560.4A CN202010610560A CN111767262A CN 111767262 A CN111767262 A CN 111767262A CN 202010610560 A CN202010610560 A CN 202010610560A CN 111767262 A CN111767262 A CN 111767262A
Authority
CN
China
Prior art keywords
log
configuration
file
preset
user
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
CN202010610560.4A
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.)
Shenzhen Saiante Technology Service Co Ltd
Original Assignee
Ping An International Smart City 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 Ping An International Smart City Technology Co Ltd filed Critical Ping An International Smart City Technology Co Ltd
Priority to CN202010610560.4A priority Critical patent/CN111767262A/en
Publication of CN111767262A publication Critical patent/CN111767262A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/168Details of user interfaces specifically adapted to file systems, e.g. browsing and visualisation, 2d or 3d GUIs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a data processing technology and provides a log display method, a log display device, log display equipment and a log storage medium. The method comprises the steps of receiving a log file display request sent by a user, obtaining a configuration table corresponding to the request type and sending the configuration table to the user, enabling the user to perform configuration operation on the configuration table based on a log file to be displayed, storing the configured configuration table into a preset configuration file when it is monitored that the user sends confirmation information of configuration completion, judging whether parameters of the configuration file meet preset conditions or not, obtaining and analyzing the log file based on the parameters of the configuration file when the preset conditions are met, performing intercepting operation on preset type log data of the analyzed log file, performing replacing operation on the intercepted log data in the log file based on preset replacing rules, and feeding the log file subjected to the replacing operation back to the user. The invention can improve the display efficiency of the log file on the display interface.

Description

Log display method, device, equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a log display method, apparatus, device, and storage medium.
Background
The log locating is an important part of the system no matter in the service development process, the service test process and the production environment, most of the currently viewed logs depend on tools provided by the linux operating system, such as tail, less, more and the like, and when the data volume of the log file is too large, the log is viewed by using the tools, so that a large amount of display space is occupied by some attribute fields on a display page, and the required viewed logs are difficult to locate quickly by developers.
Disclosure of Invention
In view of the above, the present invention provides a log display method, device, apparatus and storage medium, and aims to solve the technical problem that logs required to be viewed are difficult to be quickly located in the prior art.
In order to achieve the above object, the present invention provides a log display method, which comprises:
a receiving step: receiving a log file display request sent by a user, acquiring 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 operation on the first configuration table pair based on a first log file to be displayed carried in the request;
a judging step: monitoring whether a user sends confirmation information of configuration completion in real time, storing a first configuration table of configuration completion into a preset configuration file when the user sends confirmation information of configuration completion is monitored, and judging whether parameters of the configuration file meet preset conditions or not;
intercepting: when the parameters of the configuration file meet preset conditions, taking the configuration file as the configuration file corresponding to the request, acquiring and analyzing the first log file based on the parameters of the configuration file, and performing interception operation on the preset type log data of the analyzed first log file; and
a feedback step: and performing replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file subjected to the replacement operation to the user.
Preferably, the judging step further includes:
and when the parameters of the configuration file do not meet the preset conditions or the configuration file does not exist in a preset storage path, taking the default configuration file as the configuration file corresponding to the request.
Preferably, the intercepting step further comprises:
storing the intercepted log data of the preset type in a preset storage space in a preset format, wherein after the feedback step, the method further comprises the following steps: and when a request for acquiring the intercepted log data by a user is received, acquiring the intercepted log data from the index file of the preset storage space according to the index identification carried in the request and feeding the intercepted log data back to the user.
Preferably, the determining whether the parameter of the configuration file meets a preset condition includes:
judging whether a path parameter, a display length parameter and an embedded depth parameter exist in the configuration file, and judging that the parameters of the configuration file meet preset conditions when the path parameter, the display length parameter and the embedded depth parameter exist;
and when any one of the path parameter, the display length parameter and the embedded depth parameter does not exist, judging that the parameter of the configuration file does not meet the preset condition.
Preferably, the obtaining and parsing the first log file based on the parameter of the configuration file, and the performing an intercepting operation on the preset type of log data of the parsed first log file includes:
the method comprises the steps of obtaining a first log file based on a path parameter of a configuration file, analyzing the obtained first log file based on an embedded depth parameter of the configuration file, and intercepting preset types of log data of the analyzed first log file based on a display length parameter of the configuration file.
Preferably, the parsing the acquired first log file based on the embedded depth parameter of the configuration file includes:
and when the embedded depth parameter is a preset value, reading a preset type of log data from the acquired first log file based on a preset character and the preset value, wherein the preset type of log data comprises an attribute field of a JSON character string.
Preferably, the method further comprises: when it is detected that a user modifies the configuration table, a modified second configuration table is obtained, a 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 an intercepting operation is executed on the preset type log data of the second log file based on the display length parameter of the second configuration table.
In order to achieve the above object, the present invention further provides a log displaying apparatus, including:
a receiving module: the log file display method comprises the steps that a log file display request sent by a user is received, a first configuration table corresponding to the request type is obtained and sent to the user, and the user can perform configuration operation on the first configuration table pair based on a first log file to be displayed carried in the request;
a judging module: the device comprises a configuration file, a first configuration table and a second configuration table, wherein the configuration file is used for monitoring whether a user sends confirmation information of configuration completion in real time, storing the first configuration table of configuration completion into a preset configuration file when the user sends confirmation information of configuration completion, and judging whether parameters of the configuration file meet preset conditions or not;
an intercepting module: when the parameters of the configuration file meet preset conditions, the configuration file is used as the configuration file corresponding to the request, the first log file is acquired and analyzed based on the parameters of the configuration file, and intercepting operation is performed on the log data of the analyzed preset type of the first log file;
a feedback module: the log file processing system is used for executing replacement operation on the intercepted log data in the first log file based on a preset replacement rule and feeding the log file after the replacement operation is executed back to the user.
In order to achieve the above object, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the log presentation method of any one of claims 1 to 5.
In order to achieve the above object, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a storage data area and a storage program area, the storage data area stores data created according to the use of the blockchain node, and the storage program area stores a journal presentation program, and when the journal presentation program is executed by a processor, any step of the journal presentation method is implemented.
According to the log display method, the log display device, the log display equipment and the log display storage medium, the log file is analyzed and replaced through the configuration information, the displayed log information is concise, the situation that when certain field information of the log file needs to be viewed, the situation that the position of the log needing to be viewed is difficult to be quickly positioned due to too long field attributes is avoided, and the display efficiency of the log file on a display interface is improved.
Drawings
FIG. 1 is a diagram of an electronic device according to a preferred embodiment of the present invention;
FIG. 2 is a block diagram of a preferred embodiment of the log presentation device of FIG. 1;
FIG. 3 is a flowchart of a preferred embodiment of a log presentation method according to the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of an electronic device 1 according to a preferred embodiment of the invention.
The electronic device 1 includes but is not limited to: memory 11, processor 12, display 13, and network interface 14. The electronic device 1 is connected to a network through a network interface 14 to obtain raw data. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System for mobile communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), Wi-Fi, or a communication network.
The memory 11 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 11 may be an internal storage unit of the electronic device 1, such as a hard disk or a 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 (Flash Card), and the like equipped with the electronic device 1. Of course, the memory 11 may also comprise both an internal memory unit and an external memory device of the electronic device 1. In this embodiment, the memory 11 is generally used for storing an operating system installed in the electronic device 1 and various application software, such as program codes of the log presentation program 10. Further, the memory 11 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 12 is typically used for controlling the overall operation of the electronic device 1, such as performing data interaction or communication related control and processing. In this embodiment, the processor 12 is configured to run the program code stored in the memory 11 or process data, for example, run the program code of the log display program 10.
The display 13 may be referred to as a display screen or display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-emitting diode (OLED) touch screen, or the like. The display 13 is used for displaying information processed in the electronic device 1 and for displaying a visual work interface, e.g. displaying the results of data statistics.
The network interface 14 may optionally comprise a standard wired interface, a wireless interface (e.g. WI-FI interface), the network interface 14 typically being used for establishing a communication connection between the electronic device 1 and other electronic devices.
Fig. 1 shows only the electronic device 1 with the components 11-14 and the journal presentation program 10, but it should be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
Optionally, the electronic device 1 may further comprise a user interface, the user interface may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may further comprise a standard wired interface and a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch screen, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
The electronic device 1 may further include a Radio Frequency (RF) circuit, a sensor, an audio circuit, and the like, which are not described in detail herein.
In the above embodiment, the processor 12, when executing the log presentation program 10 stored in the memory 11, may implement the following steps:
a receiving step: receiving a log file display request sent by a user, acquiring 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 operation on the first configuration table pair based on a first log file to be displayed carried in the request;
a judging step: monitoring whether a user sends confirmation information of configuration completion in real time, storing a first configuration table of configuration completion into a preset configuration file when the user sends confirmation information of configuration completion is monitored, and judging whether parameters of the configuration file meet preset conditions or not;
intercepting: when the parameters of the configuration file meet preset conditions, taking the configuration file as the configuration file corresponding to the request, acquiring and analyzing the first log file based on the parameters of the configuration file, and performing interception operation on the preset type log data of the analyzed first log file; and
a feedback step: and performing replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file subjected to the replacement operation to the user.
The storage device may be the memory 11 of the electronic device 1, or may be another storage device communicatively connected to the electronic device 1.
For detailed description of the above steps, please refer to the following description of fig. 2 regarding a program module diagram of an embodiment of the log presentation apparatus 100 and fig. 3 regarding a flowchart of an embodiment of the log presentation method.
Referring to fig. 2, a functional block diagram of the log displaying apparatus 100 according to the present invention is shown.
The log displaying apparatus 100 of the present invention may be installed in an electronic device. According to the implemented functions, the log displaying apparatus 100 may include a receiving module 110, a determining module 120, an intercepting module 130, and a feedback module 140. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the receiving module 110 is configured to receive a log file display request sent by a user, acquire a first configuration table corresponding to the request type, and send the first configuration table to the user, so that the user performs a configuration operation on the first configuration table based on a first log file to be displayed carried in the request.
In this embodiment, when a log file display request sent by a user is received, a first configuration table corresponding to the request type is obtained and sent to the user, so that the user performs configuration operation on the first configuration table based on a first log file to be displayed carried in the request, where the configuration table may include a path parameter of the log file to be displayed, a display length parameter of the log file to be displayed, and an entry of an embedded depth parameter, and in actual application, the user may configure various parameters of the configuration table according to an actual display requirement. The log file is a record file or a file set used for recording operation events of the application program, and can be used for understanding activities of the application program, tracking of diagnosis problems, processing historical data and the like.
The determining module 120 is configured to monitor whether the user sends confirmation information of configuration completion in real time, store the first configuration table of configuration completion in a preset configuration file when it is monitored that the user sends confirmation information of configuration completion, and determine whether a parameter of the configuration file meets a preset condition.
In this embodiment, a user may send confirmation information of completion of configuration when the configuration is completed, and when it is monitored that the user sends the confirmation information of completion of configuration, a first configuration table of completion of configuration of the user is stored in a preset configuration file.
Further, the step of judging whether the parameters of the configuration file meet preset conditions includes:
judging whether a path parameter, a display length parameter and an embedded depth parameter exist in the configuration file, judging that the parameter of the configuration file meets a preset condition when the path parameter, the display length parameter and the embedded depth parameter exist, and judging that the parameter of the configuration file does not meet the preset condition when any one of the path parameter, the display length parameter and the embedded depth parameter does not exist. The path parameter is used for searching the first log file to be displayed, the display length parameter is used for intercepting the log file to be displayed, and the embedded depth parameter is used for analyzing the log file to be displayed, so the path parameter, the display length parameter and the embedded depth parameter must exist in the configuration file.
In an embodiment, when the parameter of the configuration file does not satisfy a preset condition, or when the configuration file does not exist in a preset storage path, the default configuration file is used as the configuration file corresponding to the request. For example, the parameters of the default configuration file include:
json.length=6;
json.parse.deep=3;
json.input.log.path=/data/ai/server.log;
conf is stored in the unified directory, so that when the configuration file is not found or when the configuration file parameters are incomplete, a default configuration file can be used as a configuration file corresponding to the request.
An intercepting module 130, configured to, when a parameter of the configuration file meets a preset condition, use the configuration file as a configuration file corresponding to the request, obtain and analyze the first log file based on the parameter of the configuration file, and perform an intercepting operation on the log data of the preset type of the analyzed first log file.
In this embodiment, when a parameter of a configuration file meets a preset condition, the configuration file is used as a configuration file corresponding to a log file display request, a first log file to be displayed is obtained based on the parameter corresponding to the configuration file, the first log file is analyzed, and then an intercepting operation is performed on log data of a preset type of the analyzed first log file. The preset type of log data can be log data exceeding the display length, and the log data exceeding the display length is intercepted through the configuration information of the configuration file, so that the displayed log information is concise and clear, and the display efficiency of the log file on a display interface is improved.
In one embodiment, the intercepted log data of the preset type is stored in a preset format to a preset storage space. The preset format can be a key value pair format, and by storing the intercepted log data of the preset type into the preset storage space, when a user needs to check the intercepted log data, the user can conveniently and quickly acquire the intercepted log data.
In an embodiment, the obtaining and parsing the first log file based on the parameters of the configuration file, and performing an intercepting operation on the log data of the preset type of the parsed first log file includes:
the method comprises the steps of obtaining a first log file based on a path parameter of a configuration file, analyzing the obtained first log file based on an embedded depth parameter of the configuration file, and intercepting preset types of log data of the analyzed first log file based on a display length parameter of the configuration file. The path parameters comprise path information of the first log file, so that the first log file can be obtained according to the path parameters, the first log file is analyzed based on an embedded depth parameter of the configuration file after the first log file to be displayed is obtained, 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, specifically, when the embedded depth parameter is 1, an attribute field below JSON is directly replaced, when the embedded depth parameter is 2, a layer is analyzed downwards, the preset characters { }' are taken as one layer, and when the embedded depth parameter is increased progressively, the number of layers to be analyzed is increased progressively in sequence. Wherein the preset type of log data can be an attribute field of a JSON string.
And a feedback module 140, configured to perform a replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feed the log file after the replacement operation is performed back to the user.
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 may be replaced with an ellipsis form of "…", and the log file after the replacement operation is performed is fed back to the user, so that the character display length may be shortened, the display efficiency may be improved, and the user may conveniently and quickly find the data required in the log.
Performing a replacement operation on the intercepted log data, and storing a character in the original character, which conforms to the JSON parsing condition format, in a cache, for example, performing a replacement operation on the intercepted log data may be:
and (3) displaying the original characters: { "name": "zhang san shui xxx" }
And (4) displaying after replacement: { "name": "zhang
The method can shorten the character display length, improve the display efficiency and facilitate a user to quickly search the required data in the log.
In one embodiment, when a request for obtaining the intercepted log data from a user 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 request of a user for obtaining the intercepted log data is received, obtaining the intercepted log data display from the preset storage space (cache) according to an index identifier (e.g. key) carried in the request.
In one embodiment, when it is detected that a user modifies the configuration table, a modified second configuration table is obtained, a second log file to be displayed corresponding to the second configuration table is obtained based on a path parameter of the second configuration table, and an interception operation is performed on preset type log data of the second log file based on a display length parameter of the second configuration table.
In addition, the invention also provides a log display method. Fig. 3 is a schematic method flow diagram of an embodiment of the log displaying method of the present invention. The processor 12 of the electronic device 1, when executing the log presentation program 10 stored in the memory 11, implements the following steps of the log presentation method:
step S10: receiving a log file display request sent by a user, acquiring 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 operation on the first configuration table pair based on a first log file to be displayed carried in the request.
In this embodiment, when a log file display request sent by a user is received, a first configuration table corresponding to the request type is obtained and sent to the user, so that the user performs configuration operation on the first configuration table based on a first log file to be displayed carried in the request, where the configuration table may include a path parameter of the log file to be displayed, a display length parameter of the log file to be displayed, and an entry of an embedded depth parameter, and in actual application, the user may configure various parameters of the configuration table according to an actual display requirement. The log file is a record file or a file set used for recording operation events of the application program, and can be used for understanding activities of the application program, tracking of diagnosis problems, processing historical data and the like.
Step S20: monitoring whether a user sends confirmation information of configuration completion in real time, storing a first configuration table of configuration completion into a preset configuration file when the user sends confirmation information of configuration completion is monitored, and judging whether parameters of the configuration file meet preset conditions.
In this embodiment, a user may send confirmation information of completion of configuration when the configuration is completed, and when it is monitored that the user sends the confirmation information of completion of configuration, a first configuration table of completion of configuration of the user is stored in a preset configuration file.
Further, the step of judging whether the parameters of the configuration file meet preset conditions includes:
judging whether a path parameter, a display length parameter and an embedded depth parameter exist in the configuration file, judging that the parameter of the configuration file meets a preset condition when the path parameter, the display length parameter and the embedded depth parameter exist, and judging that the parameter of the configuration file does not meet the preset condition when any one of the path parameter, the display length parameter and the embedded depth parameter does not exist. The path parameter is used for searching the first log file to be displayed, the display length parameter is used for intercepting the log file to be displayed, and the embedded depth parameter is used for analyzing the log file to be displayed, so the path parameter, the display length parameter and the embedded depth parameter must exist in the configuration file.
In an embodiment, when the parameter of the configuration file does not satisfy a preset condition, or when the configuration file does not exist in a preset storage path, the default configuration file is used as the configuration file corresponding to the request. For example, the parameters of the default configuration file include:
json.length=6;
json.parse.deep=3;
json.input.log.path=/data/ai/server.log;
conf is stored in the unified directory, so that when the configuration file is not found or when the configuration file parameters are incomplete, a default configuration file can be used as a configuration file corresponding to the request.
Step S30: and when the parameters of the configuration file meet preset conditions, taking the configuration file as the configuration file corresponding to the request, acquiring and analyzing the first log file based on the parameters of the configuration file, and performing interception operation on the preset type log data of the analyzed first log file.
In this embodiment, when a parameter of a configuration file meets a preset condition, the configuration file is used as a configuration file corresponding to a log file display request, a first log file to be displayed is obtained based on the parameter corresponding to the configuration file, the first log file is analyzed, and then an intercepting operation is performed on log data of a preset type of the analyzed first log file. The preset type of log data can be log data exceeding the display length, and the log data exceeding the display length is intercepted through the configuration information of the configuration file, so that the displayed log information is concise and clear, and the display efficiency of the log file on a display interface is improved.
In one embodiment, the intercepted log data of the preset type is stored in a preset format to a preset storage space. The preset format can be a key value pair format, and by storing the intercepted log data of the preset type into the preset storage space, when a user needs to check the intercepted log data, the user can conveniently and quickly acquire the intercepted log data.
In an embodiment, the obtaining and parsing the first log file based on the parameters of the configuration file, and performing an intercepting operation on the log data of the preset type of the parsed first log file includes:
the method comprises the steps of obtaining a first log file based on a path parameter of a configuration file, analyzing the obtained first log file based on an embedded depth parameter of the configuration file, and intercepting preset types of log data of the analyzed first log file based on a display length parameter of the configuration file. The path parameters comprise path information of the first log file, so that the first log file can be obtained according to the path parameters, the first log file is analyzed based on an embedded depth parameter of the configuration file after the first log file to be displayed is obtained, 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, specifically, when the embedded depth parameter is 1, an attribute field below JSON is directly replaced, when the embedded depth parameter is 2, a layer is analyzed downwards, the preset characters { }' are taken as one layer, and when the embedded depth parameter is increased progressively, the number of layers to be analyzed is increased progressively in sequence. Wherein the preset type of log data can be an attribute field of a JSON string.
Step S40: and performing replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file subjected to the replacement operation to the user.
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 may be replaced with an ellipsis form of "…", and the log file after the replacement operation is performed is fed back to the user, so that the character display length may be shortened, the display efficiency may be improved, and the user may conveniently and quickly find the data required in the log.
Performing a replacement operation on the intercepted log data, and storing a character in the original character, which conforms to the JSON parsing condition format, in a cache, for example, performing a replacement operation on the intercepted log data may be:
and (3) displaying the original characters: { "name": "zhang san shui xxx" }
And (4) displaying after replacement: { "name": "zhang
The method can shorten the character display length, improve the display efficiency and facilitate a user to quickly search the required data in the log.
In one embodiment, when a request for obtaining the intercepted log data from a user 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 request of a user for obtaining the intercepted log data is received, obtaining the intercepted log data display from the preset storage space (cache) according to an index identifier (e.g. key) carried in the request.
In one embodiment, when it is detected that a user modifies the configuration table, a modified second configuration table is obtained, a second log file to be displayed corresponding to the second configuration table is obtained based on a path parameter of the second configuration table, and an interception operation is performed on preset type log data of the second log file based on a display length parameter of the second configuration table.
Furthermore, the embodiment of the present invention also provides a computer-readable storage medium, which may 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 disc read only memory (CD-ROM), a USB memory, and the like. The computer-readable storage medium includes a storage data area and a storage program area, the storage data area stores data created according to the use of the blockchain node, the storage program area stores a log presentation program 10, and when executed by a processor, the log presentation program 10 implements the following operations:
a receiving step: receiving a log file display request sent by a user, acquiring 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 operation on the first configuration table pair based on a first log file to be displayed carried in the request;
a judging step: monitoring whether a user sends confirmation information of configuration completion in real time, storing a first configuration table of configuration completion into a preset configuration file when the user sends confirmation information of configuration completion is monitored, and judging whether parameters of the configuration file meet preset conditions or not;
intercepting: when the parameters of the configuration file meet preset conditions, taking the configuration file as the configuration file corresponding to the request, acquiring and analyzing the first log file based on the parameters of the configuration file, and performing interception operation on the preset type log data of the analyzed first log file; and
a feedback step: and performing replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file subjected to the replacement operation to the user.
In another embodiment, in order to further ensure the privacy and security of all the data, all the data may be stored in a node of a block chain. Such as log files to be exposed, or intercepted log data, etc., which may be stored in block link points.
It should be noted that the blockchain in the present invention is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the log displaying method, and is not described herein again.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention essentially or contributing 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 several instructions for enabling a terminal device (such as a mobile phone, a computer, an electronic device, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A log display method is applied to electronic equipment and is characterized by comprising the following steps:
a receiving step: receiving a log file display request sent by a user, acquiring 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 operation on the first configuration table pair based on a first log file to be displayed carried in the request;
a judging step: monitoring whether a user sends confirmation information of configuration completion in real time, storing a first configuration table of configuration completion into a preset configuration file when the user sends confirmation information of configuration completion is monitored, and judging whether parameters of the configuration file meet preset conditions or not;
intercepting: when the parameters of the configuration file meet preset conditions, taking the configuration file as the configuration file corresponding to the request, acquiring and analyzing the first log file based on the parameters of the configuration file, and performing interception operation on the preset type log data of the analyzed first log file; and
a feedback step: and performing replacement operation on the intercepted log data in the first log file based on a preset replacement rule, and feeding back the log file subjected to the replacement operation to the user.
2. The log presentation method of claim 1, wherein said determining step further comprises:
and when the parameters of the configuration file do not meet the preset conditions or the configuration file does not exist in a preset storage path, taking the default configuration file as the configuration file corresponding to the request.
3. The log presentation method of claim 1, wherein said intercepting step further comprises: storing the intercepted log data of the preset type in a preset storage space in a preset format, wherein after the feedback step, the method further comprises the following steps:
and when a request for acquiring the intercepted log data by a user is received, acquiring the intercepted log data from the index file of the preset storage space according to the index identification carried in the request and feeding the intercepted log data back to the user.
4. The log presentation method of claim 1, wherein the determining whether the parameters of the configuration file satisfy a preset condition comprises:
judging whether a path parameter, a display length parameter and an embedded depth parameter exist in the configuration file, and judging that the parameters of the configuration file meet preset conditions when the path parameter, the display length parameter and the embedded depth parameter exist;
and when any one of the path parameter, the display length parameter and the embedded depth parameter does not exist, judging that the parameter of the configuration file does not meet the preset condition.
5. The log presentation method of claim 1, wherein the obtaining and parsing the first log file based on the parameters of the configuration file, and performing an intercepting operation on the pre-set type log data of the parsed first log file comprises:
the method comprises the steps of obtaining a first log file based on a path parameter of a configuration file, analyzing the obtained first log file based on an embedded depth parameter of the configuration file, and intercepting preset types of log data of the analyzed first log file based on a display length parameter of the configuration file.
6. The log presentation method of claim 5, wherein said parsing the obtained first log file based on the embedded depth parameter of the configuration file comprises:
and when the embedded depth parameter is a preset value, reading a preset type of log data from the acquired first log file based on a preset character and the preset value, wherein the preset type of log data comprises an attribute field of a JSON character string.
7. The log presentation method of claim 1, wherein the method further comprises: when it is detected that a user modifies the configuration table, a modified second configuration table is obtained, a 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 an intercepting operation is executed on the preset type log data of the second log file based on the display length parameter of the second configuration table.
8. An apparatus for presenting a log, the apparatus comprising:
a receiving module: the log file display method comprises the steps that a log file display request sent by a user is received, a first configuration table corresponding to the request type is obtained and sent to the user, and the user can perform configuration operation on the first configuration table pair based on a first log file to be displayed carried in the request;
a judging module: the device comprises a configuration file, a first configuration table and a second configuration table, wherein the configuration file is used for monitoring whether a user sends confirmation information of configuration completion in real time, storing the first configuration table of configuration completion into a preset configuration file when the user sends confirmation information of configuration completion, and judging whether parameters of the configuration file meet preset conditions or not;
an intercepting module: when the parameters of the configuration file meet preset conditions, the configuration file is used as the configuration file corresponding to the request, the first log file is acquired and analyzed based on the parameters of the configuration file, and intercepting operation is performed on the log data of the analyzed preset type of the first log file;
a feedback module: the log file processing system is used for executing replacement operation on the intercepted log data in the first log file based on a preset replacement rule and feeding the log file after the replacement operation is executed back to the user.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the log presentation method of any one of claims 1 to 7.
10. A computer-readable storage medium, comprising a storage data area and a storage program area, wherein the storage data area stores data created according to the use of a blockchain node, and the storage program area stores a log presentation program, and when the log presentation program is executed by a processor, the steps of the log presentation method according to any one of claims 1 to 7 are implemented.
CN202010610560.4A 2020-06-30 2020-06-30 Log display method, device, equipment and storage medium Pending CN111767262A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010610560.4A CN111767262A (en) 2020-06-30 2020-06-30 Log display method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010610560.4A CN111767262A (en) 2020-06-30 2020-06-30 Log display method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111767262A true CN111767262A (en) 2020-10-13

Family

ID=72724131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010610560.4A Pending CN111767262A (en) 2020-06-30 2020-06-30 Log display method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111767262A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527747A (en) * 2020-12-23 2021-03-19 安徽航天信息有限公司 Log template configuration and display method and device
CN112612664A (en) * 2020-12-24 2021-04-06 百度在线网络技术(北京)有限公司 Electronic equipment testing method and device, electronic equipment and storage medium
CN113687852A (en) * 2021-09-09 2021-11-23 中国银行股份有限公司 Automatic generation method and device for log collection configuration file

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527747A (en) * 2020-12-23 2021-03-19 安徽航天信息有限公司 Log template configuration and display method and device
CN112612664A (en) * 2020-12-24 2021-04-06 百度在线网络技术(北京)有限公司 Electronic equipment testing method and device, electronic equipment and storage medium
CN112612664B (en) * 2020-12-24 2024-04-02 百度在线网络技术(北京)有限公司 Electronic equipment testing method and device, electronic equipment and storage medium
CN113687852A (en) * 2021-09-09 2021-11-23 中国银行股份有限公司 Automatic generation method and device for log collection configuration file

Similar Documents

Publication Publication Date Title
CN112491602B (en) Behavior data monitoring method and device, computer equipment and medium
CN106202117B (en) Data processing method and device and server
CN111767262A (en) Log display method, device, equipment and storage medium
CN111651468B (en) SQL analysis-based data updating method and device, electronic equipment and storage medium
CN110688598B (en) Service parameter acquisition method and device, computer equipment and storage medium
US10387370B2 (en) Collecting test results in different formats for storage
CN111859076B (en) Data crawling method, device, computer equipment and computer readable storage medium
CN112039900A (en) Network security risk detection method, system, computer device and storage medium
CN111400380A (en) Method for checking table data, electronic device and storage medium
CN110647471A (en) Interface test case generation method, electronic device and storage medium
CN111552712A (en) Report data extraction method and device and computer equipment
CN110932918A (en) Log data acquisition method and device and storage medium
CN110688315A (en) Interface code detection report generation method, electronic device, and storage medium
CN112817935A (en) Data processing method, device and equipment based on field type and storage medium
CN114579446A (en) Data processing method and device, computer equipment and computer readable storage medium
WO2019071899A1 (en) Electronic device, vehicle data import method and storage medium
CN112083925A (en) Data acquisition method, device, equipment and storage medium based on H5 page development
CN112181794A (en) Page monitoring method and device, computer equipment and storage medium
CN111651472A (en) Data query method, server and storage medium
CN111324539A (en) Account switching test method and system
CN111553655A (en) Method and system for showing handling history
CN110727576A (en) Web page testing method, device, equipment and storage medium
CN115481002A (en) Abnormal behavior identification method, device, equipment and storage medium
CN111435326A (en) Method and device for analyzing crash logs
CN114662114A (en) Log-based code desensitization vulnerability detection method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right

Effective date of registration: 20210201

Address after: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant after: Shenzhen saiante Technology Service Co.,Ltd.

Address before: 1-34 / F, Qianhai free trade building, 3048 Xinghai Avenue, Mawan, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong 518000

Applicant before: Ping An International Smart City Technology Co.,Ltd.

TA01 Transfer of patent application right
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination