Debug Backend Logs #
Use Grafana — it is the log path for developers. Open the gcp-operations or backend dashboard.
It needs no GCP IAM beyond Cloudflare Access, covers full history, and can aggregate.
kubectl logs reads the same logs straight from one pod:
kubectl -n fs-apps logs deploy/backend
It shows the current pod’s output, so history ends at the last restart.
| You need | Use |
|---|---|
| History, rates, grouping | Grafana |
| One pod’s live output | kubectl logs (above) |
| A raw query, admin only | gcloud logging read |
History across past pods #
Grafana holds the full history.
kubectl logs reaches only the running pod, so anything from a previous pod needs Grafana or Cloud Logging.
Developers: use Grafana — the gcp-operations and backend dashboards wrap these queries in panels, need no GCP IAM, and already have access to the log bucket.
Counts, rates, grouping #
Cloud Logging cannot aggregate.
It returns rows only, with no stats equivalent.
Anything that counts or groups goes through the Grafana BigQuery datasource (funnelstory-bq-logs, both environments).
Backend logs stream into a linked BigQuery dataset (backend_app_logs) for SQL.
SELECT
TIMESTAMP_TRUNC(timestamp, MINUTE) AS t,
JSON_VALUE(json_payload, '$.message') AS message,
COUNT(*) AS n
FROM `PROJECT.backend_app_logs._AllLogs`
WHERE timestamp BETWEEN @start AND @end
GROUP BY t, message
ORDER BY t DESC
See Grafana for login steps.
Related #
- GKE diagnostics — find the pod, read why it restarted
- environment reference
Next: run the kubectl logs command at the top — it covers most day-to-day debugging.