H2O

the optimized HTTP/1.x, HTTP/2, HTTP/3 server

Powered by Oktavia

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

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

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 ...