tracing: log_p2p_connections.bt example
A bpftrace script that logs information from the net:*_connection tracepoints. I've tested this script with bpftrace version 0.14.1 and v0.20.2.
This commit is contained in:
2 files changed
+72
No files matched your search
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bpftrace
|
||||
|
||||
BEGIN
|
||||
{
|
||||
printf("Logging opened, closed, misbehaving, and evicted P2P connections\n")
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:inbound_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
$conn_type = str(arg2);
|
||||
$network = (int32) arg3;
|
||||
$existing = (uint64) arg4;
|
||||
printf("INBOUND conn from %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:outbound_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
$conn_type = str(arg2);
|
||||
$network = (int32) arg3;
|
||||
$existing = (uint64) arg4;
|
||||
printf("OUTBOUND conn to %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:closed_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
$conn_type = str(arg2);
|
||||
$network = (int32) arg3;
|
||||
printf("CLOSED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:evicted_inbound_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
$conn_type = str(arg2);
|
||||
$network = (int32) arg3;
|
||||
printf("EVICTED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:misbehaving_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$message = str(arg1);
|
||||
printf("MISBEHAVING conn id=%ld, message='%s'\n", $id, $message);
|
||||
}
|
||||
Reference in new issue
Block a user