-
Notifications
You must be signed in to change notification settings - Fork 23
Log Events
###Scope and events of interest
Nodes as black boxes (we don't care about their conclusions) The system of interacting nodes as a white box (we know/log what should and is going on)
But developers might find the tool useful to get insight into their clients. So log whatever you want (to add interesting bits or lower the development burden).
The expected events and the format of their log records are defined below. You are free to emit additional event logs.
Each event has a set of expected named attributes. You can add more attributes but not less.
You might want to use different event names, which align better with your modules/metaphors/whatever. Please add your translations to logging/event_names_map.py.
The log database can not efficiently do joins. Therefore logs need to provide as much context as is needed to make sense. i.e. log data is not normalized
Expected log records are json dicts which map
message_name : dict(of key value pairs)
Example:
{'message_name': {eth_version=0, version='py', coinbase='address'}}
To get the latest definitions see/run: logging/events.py
[
{
"starting": {
"comment": "one of the first log events, before any operation is started",
"client_impl": "Impl/OS/version, e.g. Go/Linux/0.8.2",
"eth_version": "int, e.g. 52",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ"
}
},
{
"p2p.connected": {
"remote_version_string": "Impl/OS/version, e.g. Go/Linux/0.8.2",
"comment": "as soon as a successful connection to another node is established",
"remote_addr": "ipv4:port, e.g. 10.46.56.35:30303",
"remote_id": "hex128, e.g. 0123456789abcdef... exactly 128 digits",
"num_connections": "int, e.g. 4 - number of other nodes this client is currently connected to",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ"
}
},
{
"p2p.disconnected": {
"comment": "as soon as a disconnection from another node happened",
"remote_id": "hex128, e.g. 0123456789abcdef... exactly 128 digits",
"num_connections": "int, e.g. 4 - number of other nodes this client is currently connected to",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ",
"remote_addr": "ipv4:port, e.g. 10.46.56.35:30303"
}
},
{
"eth.miner.new_block": {
"comment": "as soon as the block was mined, before adding as new head",
"block_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"block_number": 0,
"chain_head_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ",
"block_prev_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}
},
{
"eth.chain.received.new_block": {
"comment": "whenever a _new_ block is received, before adding",
"block_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"block_number": 0,
"chain_head_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"remote_id": "hex128, e.g. 0123456789abcdef... exactly 128 digits",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ",
"block_prev_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}
},
{
"eth.chain.new_head": {
"comment": "whenever head changes",
"block_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"block_number": 0,
"chain_head_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ",
"block_prev_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}
},
{
"eth.tx.received": {
"tx_hash": "hex64, e.g. 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"remote_id": "hex128, e.g. 0123456789abcdef... exactly 128 digits",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ"
}
},
{
"notjson": {
"comment": "not to be implemented by clients",
"logging_error": "",
"ts": "YYYY-MM-DDTHH:MM:SS.SSSSSSZ",
"log_line": ""
}
}
]
Note: you don't have to log the comment. guuid is added by the logforwarder. "notjson" will wrap any non json deserizable log lines.