Caddyview/README.md

92 lines
2.1 KiB
Markdown

# Caddyview
Remote Caddy log viewer over SSH.
## Installation
### macOS (Homebrew)
```bash
brew tap janvete/tools https://git.janvete.com/seth/homebrew-tools.git
brew install caddyview
```
### Linux (APT)
```bash
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](https://git.janvete.com/seth/Caddyview/releases) and extract it:
```bash
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
```bash
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](https://caddyserver.com/docs/caddyfile/concepts#snippets) or to each individual site block:
```caddyfile
(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!)
```bash
mkdir -p /var/log/caddy
touch /var/log/caddy/access.log
chown caddy:caddy /var/log/caddy/access.log
```
### 3. Reload Caddy
```bash
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:
```bash
git clone ssh://git@git-ssh.janvete.com:554/seth/Caddyview.git
```