Skip to content

Commit b43442d

Browse files
committed
WIP
1 parent 71e2130 commit b43442d

3 files changed

Lines changed: 12 additions & 22 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# httpjail
22

3-
[![GitHub](https://img.shields.io/badge/GitHub-coder%2Fhttpjail-blue?logo=github&style=flat-square)](https://github.com/coder/httpjail)
3+
[![Documentation](https://img.shields.io/badge/docs-coder.github.io%2Fhttpjail-blue?logo=readthedocs&style=flat-square)](https://coder.github.io/httpjail/)
44
[![Crates.io](https://img.shields.io/crates/v/httpjail.svg)](https://crates.io/crates/httpjail)
55
[![CI](https://github.com/coder/httpjail/actions/workflows/tests.yml/badge.svg)](https://github.com/coder/httpjail/actions/workflows/tests.yml)
66

docs/advanced/server-mode.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ curl https://github.com # This request will go through httpjail
2121
```
2222

2323
**Note**: In server mode, httpjail does not create network isolation. Applications must be configured to use the proxy via environment variables or application-specific proxy settings.
24+
25+
Server Mode is particularly powerful when paired with
26+
network-level firewall rules that force HTTP(s) traffic
27+
through the proxy.

docs/guide/request-logging.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,18 @@ every request to BigQuery:
3737
#!/bin/bash
3838
# log-to-bigquery.sh
3939

40-
LOG_FILE="/tmp/requests-$$.ndjson"
41-
42-
# Process each request
4340
while read -r line; do
44-
# Append to newline-delimited JSON file
41+
# Create BigQuery insert payload
4542
echo "$line" | jq -c '{
46-
timestamp: now | todate,
47-
url: .url,
48-
method: .method,
49-
host: .host,
50-
path: .path
51-
}' >> "$LOG_FILE"
43+
rows: [{
44+
insertId: (now | tostring),
45+
json: . + {timestamp: (now | todate)}
46+
}]
47+
}' | bq insert my-project:httpjail_logs.requests
5248

5349
# Allow all requests
5450
echo "true"
5551
done
56-
57-
# On exit, load all data to BigQuery
58-
trap 'bq load --source_format=NEWLINE_DELIMITED_JSON \
59-
--autodetect \
60-
my-project:httpjail_logs.requests \
61-
"$LOG_FILE"' EXIT
6252
```
6353

6454
Usage:
@@ -67,8 +57,4 @@ Usage:
6757
httpjail --proc ./log-to-bigquery.sh --request-log local-backup.log -- your-app
6858
```
6959

70-
This example shows how to:
71-
72-
- Collect requests in newline-delimited JSON format
73-
- Load data to BigQuery on process exit
74-
- Combine local logging with cloud analytics
60+
This example shows real-time logging where each request is immediately inserted into BigQuery. Note: `bq insert` is intended for testing only - for production use BigQuery client libraries.

0 commit comments

Comments
 (0)