CN115378803B - Log management method, device, blockchain node and storage medium - Google Patents

Log management method, device, blockchain node and storage medium Download PDF

Info

Publication number
CN115378803B
CN115378803B CN202210387218.1A CN202210387218A CN115378803B CN 115378803 B CN115378803 B CN 115378803B CN 202210387218 A CN202210387218 A CN 202210387218A CN 115378803 B CN115378803 B CN 115378803B
Authority
CN
China
Prior art keywords
blockchain
node
log
target node
network connection
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.)
Active
Application number
CN202210387218.1A
Other languages
Chinese (zh)
Other versions
CN115378803A (en
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202210387218.1A priority Critical patent/CN115378803B/en
Publication of CN115378803A publication Critical patent/CN115378803A/en
Application granted granted Critical
Publication of CN115378803B publication Critical patent/CN115378803B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/069Management of faults, events, alarms or notifications using logs of notifications; Post-processing of notifications
    • 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/13File access structures, e.g. distributed indices
    • 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/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a log management method, a log management device, a blockchain node and a storage medium; the application can generate a blockchain log, wherein the blockchain log comprises operation information generated when a blockchain operates at a blockchain node; when the network connection disconnection between the blockchain node and the target node is detected, locally storing a blockchain log, wherein the target node is any node in the distributed cluster; establishing a file index of a block chain log; when the network connection between the blockchain node and the target node is detected to be reestablished, the blockchain log is obtained locally based on the file index and is sent to the target node. In the application, when the network is disconnected or the distributed cluster can not work normally, the blockchain log is stored locally, and when the network is reconnected, the blockchain log stored locally is sent to the distributed cluster, so that the network interference resistance is higher. Therefore, the scheme can improve the network interference resistance in the block chain log management.

Description

Log management method, device, blockchain node and storage medium
Technical Field
The application relates to the technical field of Internet, in particular to a log management method, a log management device, a blockchain node and a storage medium.
Background
Blockchain nodes, generally referred to as computers in a blockchain system, that is, any computer (including cell phones, etc.) connected to the blockchain system is referred to as a node. The blockchain generates a log (log) of event records when running on the blockchain node; each row of blockchain log records a description of the date, time, user and action related operations. The management (e.g., monitoring, analysis, storage, etc.) of blockchain logs is significant to the proper functioning of blockchain systems.
However, when managing blockchain logs, it is susceptible to network interference.
Disclosure of Invention
The application provides a log management method, a log management device, a blockchain node and a storage medium, which can improve the network interference resistance during blockchain log management.
The application provides a log management method, which comprises the following steps:
generating a blockchain log, wherein the blockchain log comprises operation information generated when a blockchain operates at a blockchain node;
when the network connection disconnection between the blockchain node and the target node is detected, locally storing a blockchain log, wherein the target node is any node in the distributed cluster;
establishing a file index of a block chain log;
when the network connection between the blockchain node and the target node is detected to be reestablished, the blockchain log is obtained locally based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode.
The application also provides a log management device, which comprises:
the generation unit is used for generating a blockchain log, and the blockchain log comprises operation information generated when a blockchain operates at a blockchain node;
the storage unit is used for locally storing the blockchain log when the network connection disconnection between the blockchain node and the target node is detected, and the target node is any node in the distributed cluster;
the establishing unit is used for establishing a file index of the blockchain log;
and the sending unit is used for locally acquiring the blockchain log based on the file index when the network connection between the blockchain node and the target node is detected to be reestablished, and sending the blockchain log to the target node so as to enable the distributed cluster to manage the blockchain log in a centralized mode.
In some embodiments, the log management device is further configured to:
acquiring a network address of a target node;
establishing a network connection between the blockchain node and the target node based on the network address of the target node;
and when the network connection between the blockchain node and the target node is successfully established, sending the blockchain log to the target node.
In some embodiments, the log management device is further configured to:
when the network connection establishment between the block chain node and the target node fails, determining the next node which is any node except the target node in the distributed cluster;
acquiring the network address of the target node, including:
the network address of the next node is obtained.
In some embodiments, the log management device is further configured to:
determining the disconnection times of the network connection disconnection of the block chain node and the target node;
when the disconnection times are greater than the times threshold, marking the target node as an unavailable node;
a disconnect request is sent to the unavailable node to disconnect the blockchain node from the network of unavailable nodes.
In some embodiments, the log management device is further configured to:
sending a detection request to a target node at preset time intervals, wherein the detection request is used for detecting whether the network connection between the block chain node and the target node is disconnected;
and when the response information of the target node for the detection request is not received for a preset time period, detecting that the network connection between the blockchain node and the target node is disconnected.
In some embodiments, the generating unit is specifically configured to:
and generating a blockchain log based on a preset regular grammar, wherein the blockchain log comprises keywords and regular expressions matched with the keywords.
In some embodiments, the blockchain log also includes a timestamp including a preset time field.
In some embodiments, the log management device is further configured to:
updating the file index;
the blockchain log is deleted locally.
In some embodiments, applicable to the target node, the log management device is further configured to:
the blockchain log is received for centralized management of the blockchain log by the distributed clusters.
In some embodiments, the log management device is further configured to:
the blockchain log is controlled to be displayed on a graphical user interface of the visualization device so that a user can search, monitor and analyze the blockchain log in the distributed cluster through the graphical user interface.
The application also provides a blockchain node, which comprises a memory and a processor, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to perform steps in any of the log management methods provided by the present application.
The present application also provides a computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of any of the log management methods provided by the present application.
The application can generate a blockchain log, wherein the blockchain log comprises operation information generated when a blockchain operates at a blockchain node; when the network connection disconnection between the blockchain node and the target node is detected, locally storing a blockchain log, wherein the target node is any node in the distributed cluster; establishing a file index of a block chain log; when the network connection between the blockchain node and the target node is detected to be reestablished, the blockchain log is obtained locally based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode.
According to the application, when the network connection is disconnected or the distributed cluster cannot work normally, the blockchain log is stored locally, and when the network connection is reestablished, the blockchain log stored locally at the blockchain node is sent to the distributed cluster, so that the blockchain log is ensured not to be heavy and not to leak, and the network interference resistance is higher; and the distributed clusters are adopted to perform centralized management on the blockchain logs, so that disk resources of the blockchain nodes can be saved. Therefore, the scheme can improve the network interference resistance in the block chain log management.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1a is a schematic diagram of a log management method according to the present application;
FIG. 1b is a schematic flow chart of a log management method according to the present application;
FIG. 2 is a schematic flow chart of the log management method according to the present application applied in a blockchain scenario;
FIG. 3 is a schematic diagram of a log management device according to the present application;
FIG. 4 is a schematic diagram of a blockchain node provided by the present application.
Detailed Description
The following description of the embodiments of the present application will be made more apparent and fully hereinafter with reference to the accompanying drawings, in which some, but not all embodiments of the application are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
The application provides a log management method, a log management device, a blockchain node and a storage medium.
The log management device may be integrated in a blockchain node, where the blockchain node may be a terminal, a server, or other devices. The terminal can be a mobile phone, a tablet personal computer, an intelligent Bluetooth device, a notebook computer, a desktop computer, an intelligent television, an intelligent vehicle-mounted terminal and other devices; the server may be a single server, a server cluster composed of a plurality of servers, or a cloud server. In some embodiments, the server may also be implemented in the form of a terminal.
In some embodiments, referring to fig. 1a, a schematic view of a log management method provided by the present application is shown. In the context of the log management method, a blockchain system, a distributed cluster, and a visualization device are included. Wherein:
a blockchain system may be comprised of one or more blockchain nodes, each storing an identical blockchain, a blockchain comprised of a plurality of blocks, and a blockchain comprised of a plurality of blocks. In order to ensure the information intercommunication in the block chain system, information connection can exist among the block chain link points, and the block chain nodes can transmit information through the information connection.
Distributed clusters are real-time distributed storage, search and analysis engines, and can be composed of one or more nodes (nodes), wherein each cluster has a common cluster name as an identification. There may be master nodes, data nodes, client nodes, etc. in a distributed cluster. Information connection can exist between each node in the distributed cluster, and information transmission can be performed between the nodes through the information connection. In some embodiments, the distributed cluster may be an elastomer search-piggybacked cluster (ES cluster).
The visualization device may be a terminal or server independent of the blockchain system and the distributed cluster, or may be any blockchain node in the blockchain system or any node in the distributed cluster. The visualization device may search, analyze, and visualize blockchain logs stored in the distributed clusters based on the graphical interface. In some embodiments, the visualization device is a Kibana-mounted device.
In some embodiments, the blockchain node may generate a blockchain log that includes operational information generated when the blockchain is operating at the blockchain node; when the network connection disconnection between the blockchain node and the target node is detected, locally storing a blockchain log, wherein the target node is any node in the distributed cluster; establishing a file index of a block chain log; when the network connection between the blockchain node and the target node is detected to be reestablished, the blockchain log is obtained locally based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode.
In this embodiment, when the network connection is disconnected or the distributed cluster cannot work normally, the blockchain log is stored locally, and when the network connection is reestablished, the blockchain log stored locally at the blockchain node is sent to the distributed cluster, so that the distributed cluster centrally manages the blockchain log; the blockchain log can be ensured not to be heavy and leak, and the blockchain log has stronger network interference resistance; and the distributed clusters are adopted to perform centralized management on the blockchain logs, so that disk resources of the blockchain nodes can be saved.
The following will describe in detail. The numbers of the following examples are not intended to limit the preferred order of the examples.
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. The blockchain is essentially a decentralised database, and is a series of data blocks which are generated by association by using a cryptography method, and each data block contains information of a batch of network transactions and is used for verifying the validity (anti-counterfeiting) of the information and generating a next block.
In this embodiment, a log management method is provided, as shown in fig. 1b, and a specific flow of the log management method may be as follows:
110. a blockchain log is generated, the blockchain log including operation information generated when the blockchain is operated at a blockchain node.
In some embodiments, the blockchain node may generate a blockchain log based on a preset regular grammar, the blockchain log including keywords and regular expressions matching the keywords. In some embodiments, the preset regular grammar may be a hook regular grammar, for example, matching may be given keywords, e.g., NUMBER keywords may match NUMBERs, IP keywords may match IP addresses of 127.0.0.1. It should be noted that during the operation of the blockchain, the blockchain log is continuously generated over time, and the generated blockchain log may be encapsulated into a TCP packet at fixed time intervals, and transmitted in the form of the TCP packet when the blockchain log is transmitted later.
In some embodiments, the blockchain log also includes a timestamp that includes a preset time field, e.g., the preset time field may be @ timestamp field, which may allow the blockchain log to be arranged in the time order generated, out of order, and according to the time zone conversion field.
In some embodiments, a switching function that initiates the log management method may be configured in the configuration file of the blockchain link point, which may be triggered at startup of the blockchain node, or at startup of the blockchain, or manually by a user, or the like. After the switch function is triggered, the log management method described in steps 110-140 of this embodiment is performed.
In some embodiments, the network address of the node in the distributed cluster may be configured in a configuration file of the block link point, where the network address includes information such as the IP and port of the node. In some embodiments, the blockchain node may obtain the network address of the target node after the blockchain node is started, or before the blockchain is generated, or after a network connection with the target node is broken, wherein the target node is any node in the distributed cluster, and may be a master node, a data node, or a client node. The blockchain node establishes a network connection between the blockchain node and the target node based on the network address of the target node, wherein the network connection can be a long connection or a short connection, for example, the blockchain node can use Socket to create a new thread to monitor a port of the target node. When the network connection between the block chain node and the target node is successfully established, a block chain log is sent to the target node; for example, the reliable transmission of blockchain logs may be implemented using the TCP protocol through mechanisms such as checksum, sequence number, acknowledgement, retransmission control, connection management, window control, and the like. It should be noted that there are multiple blockchain nodes, so that the blockchain nodes and the distributed clusters can establish a network connection pool. Therefore, all the blockchain nodes support distributed cluster configuration, and the situation that a log management function is unavailable when one node in the distributed cluster cannot work normally can be prevented.
In some embodiments, when the network connection establishment of the blockchain node and the target node fails, determining a next node, wherein the next node is any node except the target node in the distributed cluster; then obtaining the network address of the next node; the blockchain node establishes a network connection between the blockchain node and the next node based on the network address of the next node. If the network connection between the block chain node and the next node is failed to be established, the next node is continuously selected from the distributed cluster until the network connection between the block chain node and any node in the distributed cluster is established successfully, and the log management method is started successfully. If the network connection between the block chain node and all nodes in the distributed cluster fails to be established, the log management method is started to fail. In some embodiments, if the log management method fails to start, the blockchain log may be stored locally at the blockchain node, and the locally stored blockchain log may be sent to the distributed cluster for centralized management until the network connection between the blockchain node and the nodes in the distributed cluster is established successfully. In some embodiments, if the log management method fails to start, the blockchain node may display a prompt message to prompt the user that the log management method fails to start, so that the user locates the problem and processes it in time.
120. When the network connection disconnection between the blockchain node and the target node is detected, the blockchain log is stored locally, and the target node is any node in the distributed cluster.
In some embodiments, when a network disconnection of a blockchain node from a target node is detected, a blockchain log may be stored in a disk of the blockchain node.
In some embodiments, the method for detecting the disconnection of the network is not limited, for example, the blockchain node may send a detection request to the target node at a preset time interval, where the detection request is used to detect whether the network connection between the blockchain node and the target node is disconnected, which may also be referred to as a probe activity; the value of the preset time interval can be set in a self-defined manner according to practical application, for example, the fixed interval time of the encapsulation blockchain log as the TCP data packet can be smaller than or equal to the fixed interval time of the encapsulation blockchain log, so that the data packet is not lost when the network connection is disconnected. When the preset duration of the blockchain node does not receive response information from the target node for the detection request, the network connection disconnection between the blockchain node and the target node is detected, and the preset duration can be set in a self-defined mode according to the actual application condition; the reason why the target node cannot respond to the request of the blockchain node may be caused by network jitter, or may be caused by that the target node cannot work normally, for example, the target node crashes.
In some embodiments, when a network disconnection of the blockchain node from the target node is detected, the blockchain node may also determine a number of disconnection times of the network disconnection of the blockchain node from the target node; when the disconnection times are greater than the times threshold, marking the target node as an unavailable node, and not considering the disconnection caused by network jitter; and the blockchain node sends a disconnection request to the unavailable node so as to disconnect the network connection of the blockchain node and the unavailable node, stop sending the blockchain log to the unavailable node and further store the blockchain log locally. After being marked as an unavailable node, other blockchain nodes of the blockchain system no longer establish network connections with the unavailable node. When the number of breaks is greater than the number threshold, then the blockchain log is stored locally and then step 130 is performed.
130. And establishing a file index of the blockchain log.
The file index can enable the locally stored blockchain logs to have an order, so that the blockchain logs can be read according to the file index later, the situation that the blockchain logs are read repeatedly can be avoided, and the blockchain logs are prevented from being read repeatedly can be ensured.
140. When the network connection between the blockchain node and the target node is detected to be reestablished, the blockchain log is obtained locally based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode.
Accordingly, the target node receives the blockchain log for centralized management of the blockchain log by the distributed cluster.
In some embodiments, when a network connection of a blockchain node to a target node is detected to be reestablished, it may be determined whether there is a blockchain log locally that is not sent to the distributed cluster, e.g., by a file index. When the blockchain log exists locally, the blockchain log is acquired from the local based on the file index and is sent to the target node.
In some embodiments, the blockchain node may also update the file index after locally obtaining the blockchain log based on the file index and sending to the target node; the blockchain log is deleted locally, e.g., the blockchain log that has been sent to the target node is deleted locally.
In some embodiments, the target node may also control the blockchain logs to be displayed on a graphical user interface of the visualization device so that a user may find, monitor, analyze blockchain logs in the distributed cluster through the graphical user interface, and may aggregate multiple conditional search blockchain logs. The blockchain logs are displayed on a graphical user interface of the visualization device, for example, through Kibana, and the blockchain logs in the distributed clusters can be searched, monitored and analyzed through the Web management interface aggregate of Kibana. And the blockchain log generated by each blockchain node at each time can be intuitively seen. Therefore, the efficiency of positioning the block chain after the running error is greatly improved, the abnormal log can be monitored and the alarm can be given, various problems in the block chain system can be found in time, and the efficiency of positioning the block chain system after the running error is improved.
As can be seen from the above, when the network connection is disconnected or the distributed cluster cannot work normally, the blockchain node in this embodiment stores the blockchain log locally, and when the network connection is reestablished, the blockchain log stored locally is sent to the distributed cluster, so that the distributed cluster centrally manages the blockchain log; the blockchain log can be ensured not to be heavy and leak, and the blockchain log has stronger network interference resistance; and the distributed clusters are adopted to perform centralized management on the blockchain logs, so that disk resources of the blockchain nodes can be saved. The block chain logs are visualized through the visualization equipment, so that the log situation of each block chain node at each time can be intuitively seen; the method can also aggregate a plurality of condition searches, greatly improve the efficiency of locating the problem after the operation error of the block chain system, monitor the abnormal block chain log and alarm, and discover the problem in time.
The log management scheme provided by the application can be applied to management scenes of various logs. For example, the management of blockchain journals is taken as an example, and the journal management scheme of the present application will be described in detail.
As shown in fig. 2, a specific flow of the log management method is as follows:
201. after the blockchain node is started, the blockchain node determines whether to start the log management method.
The log management method may be started by automatically triggering a switch function that starts the log management method, or may be started by manual triggering by a user.
202. If the log management method is not started, the blockchain log is stored locally at the blockchain node, and a file index of the blockchain log is established.
203. If the log management method is started, network connection between the blockchain node and the target node in the distributed cluster is established.
204. If the network connection between the block chain node and the target node in the distributed cluster is established successfully, the log management method is started successfully, and the block chain link point sends the block chain log to the distributed cluster in real time. If the network connection between the blockchain node and the nodes in the distributed cluster fails to be established, the log management method is started to fail, and returns to execute step 202 to store the blockchain log locally in the blockchain node, and establish the file index of the blockchain log.
205. The blockchain node sends a detection request to the target node at preset time intervals, wherein the detection request is used for detecting whether the network connection between the blockchain node and the target node is disconnected.
206. When detecting that the network connection of the blockchain node to the target node is broken, the blockchain node may also determine whether a number of times the network connection of the blockchain node to the target node is broken is greater than a number threshold. When the number of disconnection times is smaller than the number threshold, the step 202 is further executed, the blockchain log is stored locally, and the file index of the blockchain log is established. When it is detected that the network connection with the target node is not broken, the execution returns to step 204.
207. When the disconnection times are greater than the times threshold, marking the target node as an unavailable node; the blockchain node stops sending blockchain logs to unavailable nodes. When the number of disconnection times is not greater than the number threshold, step 208 is performed.
208. When the network connection between the blockchain node and the target node is detected to be reestablished, judging whether the blockchain log which is not sent to the distributed cluster exists locally or not.
209. If the blockchain log which is not sent to the distributed cluster exists locally, the blockchain log is obtained locally based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode. If there is no blockchain log locally that is not sent to the distributed cluster, then step 204 is returned to send the blockchain log to the distributed cluster in real time.
210. The blockchain node may also update the file index; the blockchain log that has been sent to the target node is deleted locally.
According to the above, when the network connection is disconnected or the distributed cluster cannot work normally, the blockchain log is stored locally, and when the network connection is reestablished, the blockchain log stored locally is sent to the distributed cluster, so that the distributed cluster can manage the blockchain log in a centralized manner; the blockchain log can be ensured not to be heavy and leak, and the blockchain log has stronger network interference resistance; and the distributed clusters are adopted to perform centralized management on the blockchain logs, so that disk resources of the blockchain nodes can be saved.
In order to better implement the above method, the present application also provides a log management device, and in this embodiment, the method of the present application will be described in detail by taking the specific integration of the log management device in a blockchain node as an example.
For example, as shown in fig. 3, the log management apparatus may include a generation unit 301, a storage unit 302, a creation unit 303, and a transmission unit 304, as follows:
generation unit 301
The generating unit 301 is configured to generate a blockchain log, where the blockchain log includes operation information generated when a blockchain is operated at a blockchain node.
(two) memory cell 302
The storage unit 302 is configured to store, when it is detected that the network connection between the blockchain node and the target node is disconnected, the blockchain log locally, and the target node is any node in the distributed cluster.
(III) the setup unit 303
And a building unit 303, configured to build a file index of the blockchain log.
(IV) transmitting unit 304
And the sending unit 304 is configured to, when detecting that the network connection between the blockchain node and the target node is reestablished, obtain the blockchain log from the local area based on the file index, and send the blockchain log to the target node, so that the distributed cluster centrally manages the blockchain log.
In some embodiments, the log management device is further configured to:
acquiring a network address of a target node;
establishing a network connection between the blockchain node and the target node based on the network address of the target node;
and when the network connection between the blockchain node and the target node is successfully established, sending the blockchain log to the target node.
In some embodiments, the log management device is further configured to:
when the network connection establishment between the block chain node and the target node fails, determining the next node which is any node except the target node in the distributed cluster;
acquiring the network address of the target node, including:
the network address of the next node is obtained.
In some embodiments, the log management device is further configured to:
determining the disconnection times of the network connection disconnection of the block chain node and the target node;
when the disconnection times are greater than the times threshold, marking the target node as an unavailable node;
a disconnect request is sent to the unavailable node to disconnect the blockchain node from the network of unavailable nodes.
In some embodiments, the log management device is further configured to:
sending a detection request to a target node at preset time intervals, wherein the detection request is used for detecting whether the network connection between the block chain node and the target node is disconnected;
and when the response information of the target node for the detection request is not received for a preset time period, detecting that the network connection between the blockchain node and the target node is disconnected.
In some embodiments, the generating unit 301 is specifically configured to:
and generating a blockchain log based on a preset regular grammar, wherein the blockchain log comprises keywords and regular expressions matched with the keywords.
In some embodiments, the blockchain log also includes a timestamp including a preset time field.
In some embodiments, the log management device is further configured to:
updating the file index;
the blockchain log is deleted locally.
In some embodiments, applicable to the target node, the log management device is further configured to:
the blockchain log is received for centralized management of the blockchain log by the distributed clusters.
In some embodiments, the log management device is further configured to:
the blockchain log is controlled to be displayed on a graphical user interface of the visualization device so that a user can search, monitor and analyze the blockchain log in the distributed cluster through the graphical user interface.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the above, the log management device of the present embodiment can store the blockchain log locally in the blockchain node when the network connection is disconnected or the distributed cluster cannot normally work, and when the network connection is reestablished, the locally stored blockchain log is sent to the distributed cluster, so that the blockchain log is ensured not to be heavy and not to leak, and has stronger network interference resistance; and the distributed clusters are adopted to perform centralized management on the blockchain logs, so that disk resources of the blockchain nodes can be saved. Therefore, the scheme can improve the network interference resistance in the block chain log management.
Accordingly, an embodiment of the present application further provides a blockchain node, as shown in fig. 4, fig. 4 is a schematic structural diagram of the blockchain node provided by the embodiment of the present application, where the blockchain node 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer readable storage media, and a computer program stored on the memory 402 and capable of running on the processor. The processor 401 is electrically connected to the memory 402. Those skilled in the art will appreciate that the blockchain node structure shown in the figures does not constitute a limitation of blockchain nodes and may include more or fewer components than shown, or may combine certain components, or may be arranged in a different arrangement of components.
The processor 401 is a control center of the blockchain node 400, connects various portions of the entire blockchain node 400 using various interfaces and lines, and performs various functions and processes of the blockchain node 400 by running or loading software programs and/or modules stored in the memory 402 and invoking data stored in the memory 402, thereby performing overall monitoring of the blockchain node 400.
In an embodiment of the present application, the processor 401 in the blockchain node 400 loads the instructions corresponding to the processes of one or more application programs into the memory 402 according to the following steps, and the processor 401 executes the application programs stored in the memory 402, so as to implement various functions:
generating a blockchain log, wherein the blockchain log comprises operation information generated when a blockchain operates at a blockchain node;
when the network connection disconnection between the blockchain node and the target node is detected, locally storing a blockchain log, wherein the target node is any node in the distributed cluster;
establishing a file index of a block chain log;
when the network connection between the blockchain node and the target node is detected to be reestablished, the blockchain log is obtained locally based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Optionally, as shown in fig. 4, the blockchain node 400 further includes: a touch display 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch display 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407, respectively. Those skilled in the art will appreciate that the blockchain node structure shown in fig. 4 is not limiting of blockchain nodes and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The touch display 403 may be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. Wherein the display panel may be used to display information entered by or provided to a user and various graphical user interfaces of the blockchain node, which may be composed of graphics, text, icons, video, and any combination thereof. Alternatively, the display panel may be configured in the form of a liquid crystal display (LCD, liquid Crystal Display), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations on or near the user (such as operations on or near the touch panel by the user using any suitable object or accessory such as a finger, stylus, etc.), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends the touch point coordinates to the processor 401, and can receive and execute commands sent from the processor 401. The touch panel may overlay the display panel, and upon detection of a touch operation thereon or thereabout, the touch panel is passed to the processor 401 to determine the type of touch event, and the processor 401 then provides a corresponding visual output on the display panel in accordance with the type of touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 403 to realize the input and output functions. In some embodiments, however, the touch panel and the touch panel may be implemented as two separate components to perform the input and output functions. I.e. the touch-sensitive display 403 may also implement an input function as part of the input unit 406.
In an embodiment of the present application, a graphical user interface is generated on touch display 403 by processor 401 executing a blockchain application. The touch display 403 is used for presenting a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface.
The RF circuitry 404 may be configured to transmit and receive RF signals to and from a network device or other blockchain node by establishing wireless communication with the network device or other blockchain node via wireless communication.
The audio circuitry 405 may be used to provide an audio interface between the user and the blockchain node through speakers, microphones. The audio circuit 405 may transmit the received electrical signal after audio data conversion to a speaker, where the electrical signal is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signals into electrical signals, which are received by the audio circuit 405 and converted into audio data, which are processed by the audio data output processor 401 and sent to, for example, another blockchain node via the radio frequency circuit 404, or which are output to the memory 402 for further processing. The audio circuit 405 may also include an ear bud jack to provide communication of the peripheral headphones with the blockchain node.
The input unit 406 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 407 is used to power the various components of the blockchain node 400. Alternatively, the power supply 407 may be logically connected to the processor 401 through a power management system, so as to implement functions of managing charging, discharging, and power consumption management through the power management system. The power supply 407 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown in fig. 4, the blockchain node 400 may also include cameras, sensors, wireless fidelity modules, bluetooth modules, etc., and will not be described in detail herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
As can be seen from the above, when the network connection is disconnected or the distributed cluster cannot work normally, the blockchain node locally stores the blockchain log in the blockchain node, and when the network connection is reestablished, the blockchain log stored locally is sent to the distributed cluster, so that the blockchain log is ensured not to be heavy and not to leak, and the blockchain node has stronger network interference resistance; and the distributed clusters are adopted to perform centralized management on the blockchain logs, so that disk resources of the blockchain nodes can be saved. Therefore, the scheme can improve the network interference resistance in the block chain log management.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer readable storage medium having stored therein a plurality of computer programs that can be loaded by a processor to perform the steps of any of the log management methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
generating a blockchain log, wherein the blockchain log comprises operation information generated when a blockchain operates at a blockchain node;
when the disconnection of the network connection with the target node is detected, the blockchain log is stored locally, and the target node is any node in the distributed cluster;
establishing a file index of a block chain log;
when network connection with the target node is detected to be reestablished, the blockchain log is obtained locally based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The steps in any log management method provided by the embodiment of the present application can be executed by the computer program stored in the storage medium, so that the beneficial effects that any log management method provided by the embodiment of the present application can be achieved, and detailed descriptions of the previous embodiments are omitted herein.
The log management method, device, storage medium and block link point provided by the embodiment of the application are described in detail, and specific examples are applied to illustrate the principle and implementation of the application, and the description of the above embodiments is only used for helping to understand the method and core idea of the application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, the present description should not be construed as limiting the present application.

Claims (12)

1. A method of log management adapted for use with a blockchain node, the method comprising:
generating a blockchain log based on a preset regular grammar, wherein the blockchain log comprises keywords and regular expressions matched with the keywords, and the blockchain log comprises running information generated when a blockchain runs on the blockchain nodes;
when the network connection disconnection between the blockchain node and a target node is detected, the blockchain log is stored locally, and the target node is any node in a distributed cluster;
establishing a file index of the blockchain log;
when the network connection between the blockchain node and the target node is detected to be reestablished, the blockchain log is obtained from the local area based on the file index and is sent to the target node, so that the distributed cluster can manage the blockchain log in a centralized mode.
2. The log management method as set forth in claim 1, further comprising:
acquiring a network address of the target node;
establishing a network connection between the blockchain node and the target node based on the network address of the target node;
and when the network connection between the blockchain node and the target node is successfully established, the blockchain log is sent to the target node.
3. The log management method as defined in claim 2, wherein the method further comprises:
when the network connection between the blockchain node and the target node fails to be established, determining a next node, wherein the next node is any node except the target node in the distributed cluster;
the obtaining the network address of the target node includes:
and acquiring the network address of the next node.
4. The method of log management according to claim 1, wherein the locally storing the blockchain log when detecting that the network connection of the blockchain node to the target node is disconnected, further comprises:
determining the disconnection times of the network connection disconnection of the blockchain node and the target node;
when the disconnection times are greater than a times threshold, marking the target node as an unavailable node;
a disconnection request is sent to the unavailable node to disconnect the blockchain node from the network of unavailable nodes.
5. The method of log management according to claim 1, wherein the locally storing the blockchain log when detecting that the network connection of the blockchain node to the target node is disconnected, further comprises:
sending a detection request to the target node at preset time intervals, wherein the detection request is used for detecting whether the network connection between the blockchain node and the target node is disconnected;
and when the response information of the target node for the detection request is not received for a preset time period, detecting that the network connection between the blockchain node and the target node is disconnected.
6. The method of log management according to claim 1, wherein the blockchain log further includes a timestamp including a preset time field.
7. The method of log management according to claim 1, wherein after the blockchain log is obtained from the local place based on the file index and sent to the target node, further comprising:
updating the file index;
the blockchain log is deleted from the local.
8. The log management method of claim 1, adapted to the target node, the method further comprising:
a blockchain log is received for centralized management of the blockchain log by a distributed cluster.
9. The log management method as defined in claim 8, wherein the method further comprises:
and controlling the blockchain log to be displayed on a graphical user interface of the visualization device so that a user can search, monitor and analyze the blockchain log in the distributed cluster through the graphical user interface.
10. A log management apparatus adapted for use with a blockchain node, comprising:
the generation unit is used for generating a blockchain log based on a preset regular grammar, wherein the blockchain log comprises keywords and regular expressions matched with the keywords, and the blockchain log comprises operation information generated when a blockchain operates at a blockchain node;
the storage unit is used for locally storing the blockchain log when the network connection disconnection between the blockchain node and a target node is detected, wherein the target node is any node in the distributed cluster;
the establishing unit is used for establishing a file index of the blockchain log;
and the sending unit is used for obtaining the blockchain log from the local based on the file index when the network connection between the blockchain node and the target node is detected to be reestablished, and sending the blockchain log to the target node so that the distributed cluster can manage the blockchain log in a centralized way.
11. A blockchain node comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to perform the steps in the log management method as claimed in any one of claims 1 to 9.
12. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps in the log management method of any of claims 1 to 9.
CN202210387218.1A 2022-04-13 2022-04-13 Log management method, device, blockchain node and storage medium Active CN115378803B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210387218.1A CN115378803B (en) 2022-04-13 2022-04-13 Log management method, device, blockchain node and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210387218.1A CN115378803B (en) 2022-04-13 2022-04-13 Log management method, device, blockchain node and storage medium

Publications (2)

Publication Number Publication Date
CN115378803A CN115378803A (en) 2022-11-22
CN115378803B true CN115378803B (en) 2023-12-12

Family

ID=84060579

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210387218.1A Active CN115378803B (en) 2022-04-13 2022-04-13 Log management method, device, blockchain node and storage medium

Country Status (1)

Country Link
CN (1) CN115378803B (en)

Citations (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101611391A (en) * 2007-02-09 2009-12-23 微软公司 The protection cross platform auditing
CN107835095A (en) * 2017-11-20 2018-03-23 杭州迪普科技股份有限公司 A kind of processing method and processing device of daily record
CN109640347A (en) * 2019-02-28 2019-04-16 努比亚技术有限公司 Journal file automatically grabs method, apparatus, mobile terminal and readable storage medium storing program for executing
CN109977089A (en) * 2019-03-13 2019-07-05 深圳壹账通智能科技有限公司 Blog management method, device, computer equipment and computer readable storage medium
CN110019065A (en) * 2017-09-05 2019-07-16 阿里巴巴集团控股有限公司 Processing method, device and the electronic equipment of daily record data
CN110084069A (en) * 2019-04-17 2019-08-02 江苏全链通信息科技有限公司 Server log monitoring method and system based on block chain
KR102021082B1 (en) * 2018-10-22 2019-11-04 주식회사 라인웍스 System and method for detecting network anomaly using the block-chain based index
CN110427077A (en) * 2019-07-26 2019-11-08 岑海明 A kind of moveable calculating storage box based on block chain technology
WO2019218814A1 (en) * 2018-05-16 2019-11-21 腾讯科技(深圳)有限公司 Graph data processing method, method and device for publishing graph data computational tasks, storage medium, and computer apparatus
CN110928851A (en) * 2019-10-12 2020-03-27 中国平安财产保险股份有限公司 Method, device and equipment for processing log information and storage medium
CN110932892A (en) * 2019-11-21 2020-03-27 腾讯科技(深圳)有限公司 Block chain based information early warning method and device, related nodes and storage medium
CN111414431A (en) * 2020-04-28 2020-07-14 武汉烽火技术服务有限公司 Network operation and maintenance data disaster recovery backup management method and system based on block chain technology
WO2020181937A1 (en) * 2019-03-08 2020-09-17 阿里巴巴集团控股有限公司 Method and system for modifying blockchain network configuration
CN111988331A (en) * 2020-08-28 2020-11-24 清华大学 DDoS attack tracking method and system based on block chain
CN112200680A (en) * 2020-12-03 2021-01-08 腾讯科技(深圳)有限公司 Block link point management method, device, computer and readable storage medium
KR20210019771A (en) * 2019-08-13 2021-02-23 건국대학교 산학협력단 Apparatus and method for managing data using blockchain
CN112433885A (en) * 2020-11-19 2021-03-02 腾讯科技(深圳)有限公司 Block chain consensus processing method and device, electronic equipment and storage medium
CN112632639A (en) * 2020-12-29 2021-04-09 航天科工网络信息发展有限公司 Block chain-based distributed trusted log management method
WO2021068488A1 (en) * 2019-10-12 2021-04-15 深圳壹账通智能科技有限公司 Blockchain-based log processing method and apparatus, computer device, and storage medium
CN113055171A (en) * 2021-03-30 2021-06-29 西安电子科技大学 Log security analysis and storage method based on block chain
CN113129149A (en) * 2021-04-23 2021-07-16 中国工商银行股份有限公司 Transaction risk identification method and device based on block chain and safe multi-party calculation
WO2021232292A1 (en) * 2020-05-20 2021-11-25 深圳市欢太科技有限公司 Log data processing method and related product
CN114221777A (en) * 2021-08-17 2022-03-22 北京恒安嘉新安全技术有限公司 Digital currency flow self-synchronization monitoring method, device and equipment under limited condition

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8316046B2 (en) * 2010-04-07 2012-11-20 Apple Inc. Journaling on mobile devices
WO2018201147A2 (en) * 2017-04-28 2018-11-01 Neuromesh Inc. Methods, apparatus, and systems for controlling internet-connected devices having embedded systems with dedicated functions
US11093293B2 (en) * 2018-01-09 2021-08-17 George P. MATUS Configuring nodes for distributed compute tasks
CN108876380B (en) * 2018-08-07 2021-03-23 创新先进技术有限公司 Transaction method and system based on centralized settlement and block chain deposit certificate
US20200412525A1 (en) * 2019-06-26 2020-12-31 Grid7 Llc D/B/A Taekion Blockchain filesystem

Patent Citations (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101611391A (en) * 2007-02-09 2009-12-23 微软公司 The protection cross platform auditing
CN110019065A (en) * 2017-09-05 2019-07-16 阿里巴巴集团控股有限公司 Processing method, device and the electronic equipment of daily record data
CN107835095A (en) * 2017-11-20 2018-03-23 杭州迪普科技股份有限公司 A kind of processing method and processing device of daily record
WO2019218814A1 (en) * 2018-05-16 2019-11-21 腾讯科技(深圳)有限公司 Graph data processing method, method and device for publishing graph data computational tasks, storage medium, and computer apparatus
KR102021082B1 (en) * 2018-10-22 2019-11-04 주식회사 라인웍스 System and method for detecting network anomaly using the block-chain based index
CN109640347A (en) * 2019-02-28 2019-04-16 努比亚技术有限公司 Journal file automatically grabs method, apparatus, mobile terminal and readable storage medium storing program for executing
WO2020181937A1 (en) * 2019-03-08 2020-09-17 阿里巴巴集团控股有限公司 Method and system for modifying blockchain network configuration
CN109977089A (en) * 2019-03-13 2019-07-05 深圳壹账通智能科技有限公司 Blog management method, device, computer equipment and computer readable storage medium
CN110084069A (en) * 2019-04-17 2019-08-02 江苏全链通信息科技有限公司 Server log monitoring method and system based on block chain
CN110427077A (en) * 2019-07-26 2019-11-08 岑海明 A kind of moveable calculating storage box based on block chain technology
KR20210019771A (en) * 2019-08-13 2021-02-23 건국대학교 산학협력단 Apparatus and method for managing data using blockchain
CN110928851A (en) * 2019-10-12 2020-03-27 中国平安财产保险股份有限公司 Method, device and equipment for processing log information and storage medium
WO2021068488A1 (en) * 2019-10-12 2021-04-15 深圳壹账通智能科技有限公司 Blockchain-based log processing method and apparatus, computer device, and storage medium
CN110932892A (en) * 2019-11-21 2020-03-27 腾讯科技(深圳)有限公司 Block chain based information early warning method and device, related nodes and storage medium
CN111414431A (en) * 2020-04-28 2020-07-14 武汉烽火技术服务有限公司 Network operation and maintenance data disaster recovery backup management method and system based on block chain technology
WO2021232292A1 (en) * 2020-05-20 2021-11-25 深圳市欢太科技有限公司 Log data processing method and related product
CN111988331A (en) * 2020-08-28 2020-11-24 清华大学 DDoS attack tracking method and system based on block chain
CN112433885A (en) * 2020-11-19 2021-03-02 腾讯科技(深圳)有限公司 Block chain consensus processing method and device, electronic equipment and storage medium
CN112200680A (en) * 2020-12-03 2021-01-08 腾讯科技(深圳)有限公司 Block link point management method, device, computer and readable storage medium
CN112632639A (en) * 2020-12-29 2021-04-09 航天科工网络信息发展有限公司 Block chain-based distributed trusted log management method
CN113055171A (en) * 2021-03-30 2021-06-29 西安电子科技大学 Log security analysis and storage method based on block chain
CN113129149A (en) * 2021-04-23 2021-07-16 中国工商银行股份有限公司 Transaction risk identification method and device based on block chain and safe multi-party calculation
CN114221777A (en) * 2021-08-17 2022-03-22 北京恒安嘉新安全技术有限公司 Digital currency flow self-synchronization monitoring method, device and equipment under limited condition

Also Published As

Publication number Publication date
CN115378803A (en) 2022-11-22

Similar Documents

Publication Publication Date Title
CN110209639B (en) Information processing method, device and system
CN108446207B (en) Method, device and system for evaluating disaster tolerance capability of computer system
CN112272118A (en) Network repairing method, device, storage medium and electronic equipment
WO2023222109A1 (en) Network wakeup management method and apparatus, electronic device, and storage medium
CN112003978A (en) Conference management interface display method and device, storage medium and terminal equipment
CN115987852A (en) Interface service state detection method and device, computer equipment and storage medium
CN113395165B (en) Consensus process processing method and device, storage medium and computer equipment
CN111198662A (en) Data storage method and device and computer readable storage medium
CN113031453A (en) Intelligent household appliance, cloud server and power consumption abnormity monitoring method for intelligent household appliance
CN111930565B (en) Process fault self-healing method, device and equipment for components in distributed management system
CN113609107A (en) Database management method and device, electronic equipment and storage medium
CN115378803B (en) Log management method, device, blockchain node and storage medium
CN111193636A (en) Method and device for testing availability of single machine
CN116610508A (en) Heat dissipation test method and device, electronic equipment and storage medium
CN113596197B (en) Address switching method and device, electronic equipment and storage medium
CN115987786A (en) Configuration change method, system, terminal equipment and storage medium
CN112835906B (en) Block chain-based data management method, device, system, equipment and medium
CN109947630B (en) Fault notification method, device and storage medium
CN113849356A (en) Equipment testing method and device, electronic equipment and storage medium
CN112637119A (en) Host scanning method and device, storage medium and electronic equipment
CN112118420A (en) Automatic configuration method and device for monitoring system
CN117033084B (en) Virtual machine backup method and device, electronic equipment and storage medium
CN113032361B (en) Database configuration changing method and device, electronic equipment and storage medium
CN115580643A (en) Connection establishing method and device, storage medium and electronic equipment
US20220247522A1 (en) Link monitoring method and terminal

Legal Events

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