2.1 KiB
2.1 KiB
Caddyview
Remote Caddy log viewer over SSH.
Installation
macOS (Homebrew)
brew tap janvete/tools https://git.janvete.com/seth/homebrew-tools.git
brew install caddyview
Linux (APT)
echo "deb [trusted=yes] https://git.janvete.com/seth/apt/raw/branch/main ./" | sudo tee /etc/apt/sources.list.d/janvete.list
sudo apt update
sudo apt install caddyview
Linux (tarball)
Download the latest release from the releases page and extract it:
VERSION=v0.7.0
curl -L "https://git.janvete.com/seth/Caddyview/releases/download/${VERSION}/caddyview-${VERSION}-linux-amd64.tar.gz" | tar xz
sudo mv caddyview /usr/local/bin/
Usage
caddyview ssh root@192.168.x.x
caddyview ssh -p 2222 admin@server.com
Press [1] for live traffic, [2] for last 24 hours, [3] for last 7 days, and [4] to view recent 4xx/5xx errors with URL and origin.
Required Caddyfile Changes
1. Add a log block to your Caddyfile
Add the logging configuration to a snippet or to each individual site block:
(hsts) {
log {
output file /var/log/caddy/access.log {
roll_size 100mb
roll_keep 10
}
format json
}
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Content-Type-Options "nosniff"
Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "geolocation=(), microphone=(), camera=()"
-Server
}
}
some.dns.com {
import hsts
reverse_proxy 192.168.71.6:1378
}
2. Create the log file with correct permissions (BEFORE reloading!)
mkdir -p /var/log/caddy
touch /var/log/caddy/access.log
chown caddy:caddy /var/log/caddy/access.log
3. Reload Caddy
systemctl reload caddy
Development
The source repository is hosted at https://git.janvete.com/seth/Caddyview.
To clone via SSH use the dedicated SSH endpoint:
git clone ssh://git@git-ssh.janvete.com:554/seth/Caddyview.git