LogProx ποΈ
HTTP proxy with conditional logging and request control
π Quick Start
Installation
# Build from source
Basic Usage
# Start with default config
# Specify custom config
# Set environment variables
PORT=8080 CONFIG_FILE=config.yaml
Simple Example
Create config.yaml:
logging:
default: false
rules:
- name: "Monitor API calls"
match_conditions:
path:
patterns:
capture:
method: true
path: true
timing: true
Start LogProx and test:
# Proxy format: http://host:port/https://upstream-domain/path
β¨ Features
- π Conditional Logging: Log requests based on path, method, headers, body
- π‘οΈ Request Control: Drop requests based on configurable rules
- π Hot Reload: Update configuration without restarting
- π Built-in Monitoring: Health checks and configuration endpoints
ποΈ Architecture
βββββββββββββββ βββββββββββββ ββββββββββββββββββ
β Client βββββΆβ LogProx βββββΆβ Upstream API β
β Application β β β β β
βββββββββββββββ βββββββββββββ ββββββββββββββββββ
β
βΌ
ββββββββββββββ
β Logs & β
β Metrics β
ββββββββββββββ
βοΈ Configuration
LogProx uses YAML configuration with environment variable support (${VAR_NAME}).
Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
Server port |
CONFIG_FILE |
config.yaml |
Configuration file path |
Quick Reference
logging:
default: false
rules:
- name: "API Monitoring"
match_conditions:
path:
methods:
capture:
drop:
default: false
rules:
- name: "Block Bots"
match_conditions:
headers:
response:
response_logging:
default: false
rules:
- name: "Log Errors"
match_conditions:
status_codes:
capture:
Request Format
Proxy requests use URL path encoding:
http://localhost:3000/https://api.example.com/users/123
β
Encoded upstream URL
Pattern Matching
Regex Examples:
.*- Match any characters^/api/- Match paths starting with /api/\d+- Match one or more digits(option1|option2)- Match either option
Matching Logic:
- Path patterns: At least one must match
- Methods: Must be in methods list (if specified)
- Headers: All specified headers must match
- Body patterns: At least one must match
- Rule evaluation: First match wins
π API Reference
| Endpoint | Method | Response |
|---|---|---|
/health |
GET | 200 OK with body "OK" |
/config |
GET | Current JSON configuration |
/config/docs |
GET | Configuration documentation |
/config/reload |
POST | Reload configuration |
Usage Examples
# Health check
# Get current config
|
# Reload configuration
# View documentation
π§ Troubleshooting
Configuration Issues
# Validate YAML syntax
# Enable debug logging
RUST_LOG=debug
Common Problems
- Invalid proxy format: Use
/https://domain/pathformat - Regex errors: Test patterns with regex debugger
- Permission denied: Check config file permissions
π€ Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
π License
GNU GPLv3 Β© Bryan Lott