Categorygithub.com/mark-ignacio/http2sqlite
modulepackage
0.0.0-20241231154418-f87da74ca10b
Repository: https://github.com/mark-ignacio/http2sqlite.git
Documentation: pkg.go.dev

# README

http2sqlite

Slap HTTP requests straight into a local SQLite3 database. Fun for debugging!

GPLv3 licensed because if you wanted to pay for something more full-fledged you'd probably be using one of the SaaS services for this, lol.

Request filtering

To facilitate more targeted request logging, the Viper config variable filter supports a github.com/google/cel-go expression that returns a boolean.

For those not familiar with Viper, this means you can configure the CEL filter via any of:

  • execution args: --filter 'expression here'
  • config file: filter: 'expression here'
  • env var: FILTER='expression here'

Supported CEL variables are:

  • host - HTTP host header
  • path - absolute URL path, including the leading slash
  • method - HTTP method
  • header - map of HTTP headers
  • source_address - IP:port as a string

Due to CEL limitations, all n-dashes are converted to underscores. This is particularly noticable when filtering headers.

Example filters

Only save PATCH requests to localhost:4676.

method == "PATCH" && host == "localhost:4676"

Only save requests with a User-Agent of curl/*.

header.User_Agent.startsWith("curl/")
// alternatively, use RE2 regex
header.User_Agent.matches("^curl/.+")
matches(header.User_Agent, "^curl/.+")

Only save requests from a particular IP address.

source_address.startsWith("9.9.9.9")

For everything else that you can do with CEL, reference the language grammar.

# Packages

Copyright © 2022 NAME HERE <EMAIL ADDRESS> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
No description provided by the author