Configure > Using h2olog for Tracing
h2olog is an experimental BPF (kernel doc) backed tracing tool for the H2O server. It can be used for tracing quicly and h2o USDT probes.
Since h2olog is an experimental program, its command-line interface might change without notice.
Installing from Source
See requirements for build prerequisites.
If dependencies are satisfied, h2olog is built automatically. It is possible to manually turn on / off the build of h2olog by using the -DWITH_H2OLOG
option. This option takes either ON
> or OFF
as the argument.
If you have BCC
installed to a non-standard path, use pkg-config
for cmake
.
$ PKG_CONFIG_PATH=/path/to/bcc/lib/pkgconfig cmake [options]
Requirements
For building h2olog
- C++11 compiler
- CMake for generating the build files
- pkg-config for detecting dependencies
- Python 3 for the code generator
- BCC (BPF compiler collection, a.k.a. bpfcc; >= 0.11.0) installed on your system
For Ubuntu 20.04 or later, you can install dependencies with:
$ sudo apt install clang cmake python3 libbpfcc-dev linux-headers-$(uname -r)
For running h2olog
- Root privilege to execute h2olog
- Linux kernel (>= 4.10)
Quickstart
h2olog -H -p $H2O_PID
shows varnishlog-like tracing.
$ sudo h2olog -H -p $(pgrep -o h2o)
11 0 RxProtocol HTTP/3.0
11 0 RxHeader :authority torumk.com
11 0 RxHeader :method GET
11 0 RxHeader :path /
11 0 RxHeader :scheme https
11 0 TxStatus 200
11 0 TxHeader content-length 123
11 0 TxHeader content-type text/html
... and more ...
Tracing USDT events
Server-side QUIC events can be traced using the quic
subcommand.
Events are rendered in JSON Lines format.
$ sudo h2olog -p $(pgrep -o h2o)
Here’s an example trace.
{"time":1584380825832,"type":"accept","conn":1,"dcid":"f8aa2066e9c3b3cf"}
{"time":1584380825835,"type":"crypto-decrypt","conn":1,"pn":0,"len":1236}
{"time":1584380825832,"type":"quictrace-recv","conn":1,"pn":0}
{"time":1584380825836,"type":"crypto-handshake","conn":1,"ret":0}
... and more ...