Git Product home page Git Product logo

h2olog's Introduction

h2olog

BPF (kernel doc) backed request logging client for the H2O server.

Quickstart

Root privilege is required to interact with the BPF virtual machine. The log line format is: ConnID ReqID HeaderName HeaderValue, except the first line that represents the HTTP protocol version.

$ sudo h2olog -p $(pgrep -o h2o)

888 1 RxProtocol HTTP/2.0
888 1 RxHeader   :authority torumk.com
888 1 RxHeader   :method GET
888 1 RxHeader   :path /
888 1 RxHeader   :scheme https
888 1 TxStatus   200
... and more ...

Requirements

  • H2O server built after 53e1db42
  • BCC (BPF Compiler Collection) installed on your system
    • BCC v0.11.0 or later is required
  • Root privilege to execute the program

Note that the bcc module on PyPi is unrelated to BPF.

Tracing QUIC events

Server-side QUIC events can be traced using the quic subcommand. Events are rendered in JSON format. This feature is heavily a WIP.

$ sudo h2olog quic -p $(pgrep -o h2o)
               ^
               |_ The quic subcommand

Here's an example trace.

{"at": 1580154303455, "type": "quicly:accept", "master_conn_id": 1, "dcid": "4070a82916f79d71"}
{"at": 1580154303457, "type": "quicly:packet_prepare", "master_conn_id": 1, "first_octet": 192, "dcid": "9e4605bc54ec8b9d"}
{"at": 1580154303457, "type": "quicly:packet_commit", "master_conn_id": 1, "packet_num": 0, "packet_len": 176, "ack_only": 0}
... and more ...

If you find the output to be too noisy, try using the -t option to only trace a specific event type.

$ sudo h2olog quic -t quicly:accept -p $(pgrep -o h2o)

{"at": 1580410632750, "type": "quicly:accept", "master_conn_id": 2, "dcid": "cf53a37d6f47a005"}
{"at": 1580410633662, "type": "quicly:accept", "master_conn_id": 1, "dcid": "180c19519904013e"}
{"at": 1580410636950, "type": "quicly:accept", "master_conn_id": 2, "dcid": "8ccc04ffae33cc7b"}
{"at": 1580410637613, "type": "quicly:accept", "master_conn_id": 3, "dcid": "1f3b9363a583158b"}

Program Anatomy

h2olog is a BCC based single-file Python program (learn more). This might change in the future (e.g. switch to bpftrace), but the same CLI interface will be kept.

TODO

  • Option for output filtering
  • Option to redirect the output to a file

h2olog's People

Contributors

toru avatar gfx avatar

Watchers

Jana Iyengar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.