Skip to content

Instantly share code, notes, and snippets.

@koliadych
Created May 10, 2026 21:20
Show Gist options
  • Select an option

  • Save koliadych/abfe882e78e797ce7d7f256994f6ce4e to your computer and use it in GitHub Desktop.

Select an option

Save koliadych/abfe882e78e797ce7d7f256994f6ce4e to your computer and use it in GitHub Desktop.
fintechner trace 502
#!/bin/bash
set -euo pipefail
export AWS_PAGER=""
REGION=ap-northeast-1
INSTANCE_ID=i-089ad4a6b76132ba2
CMD_ID=$(aws --region "$REGION" ssm send-command \
--instance-ids "$INSTANCE_ID" \
--document-name AWS-RunShellScript \
--parameters '{"commands":[
"echo === recent caddy access log entries with status >= 400 ===",
"sudo tail -500 /var/log/caddy/access.log 2>/dev/null | sudo tail -50 || sudo cat /var/log/caddy/access.log | tail -50",
"echo",
"echo === dashboard journal last 60 ===",
"sudo journalctl -u fintechner-dashboard -n 60 --no-pager",
"echo",
"echo === connector journal last 30 ===",
"sudo journalctl -u fintechner-connector -n 30 --no-pager",
"echo",
"echo === direct connector POST test ===",
"echo --- /admin/runtime/reload (no auth, expect 401) ---",
"curl -sS -X POST -o /dev/null -w \"http=%{http_code} time=%{time_total}s\\n\" http://localhost:8080/admin/runtime/reload",
"echo --- /runtime/reload (root path) ---",
"curl -sS -X POST -o /dev/null -w \"http=%{http_code} time=%{time_total}s\\n\" http://localhost:8080/runtime/reload",
"echo --- listing connector routes via random path ---",
"curl -sS -o /dev/null -w \"http=%{http_code}\\n\" http://localhost:8080/__nonsense__"
]}' \
--query Command.CommandId --output text)
for i in $(seq 1 25); do
sleep 4
STATUS=$(aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query Status --output text 2>/dev/null || echo Pending)
case "$STATUS" in Success|Failed|Cancelled|TimedOut) echo " $STATUS"; break ;; *) echo " $STATUS";; esac
done
echo
aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query StandardOutputContent --output text
echo
echo "--- STDERR ---"
aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query StandardErrorContent --output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment