Skip to content

Reusing an Existing Grafana & Loki Stack ​

If you already have a Grafana and Loki stack running on your server, Kubernetes cluster, or Docker Swarm, you do not need to deploy RouteWarden's local Loki or Grafana containers.

You can seamlessly reuse your existing observability infrastructure in three steps:

  1. Import the Dashboard: Export and import the pre-built routewarden-overview.json directly into your existing Grafana.
  2. Ship Logs to Your Existing Loki: Add RouteWarden's parsing pipeline to your existing Grafana Alloy or Promtail agent, or run a lightweight Alloy shipper container pointing directly to your remote Loki endpoint.
  3. Label Containers: Tag your reverse proxy and daemon containers with routewarden.logs=true.
# 1. Export RouteWarden dashboard template to diskrwarden dashboard export ./observability# Dashboard JSON is located at:# ./observability/grafana/dashboards/routewarden-overview.json# Option A: Import via Grafana Web UI# 1. Open your existing Grafana instance in your browser# 2. Navigate to Dashboards > New > Import# 3. Upload routewarden-overview.json (or paste its JSON content)# 4. Select your existing Loki data source from the dropdown prompt# Option B: Import via Grafana HTTP APIcurl -X POST \  -H "Content-Type: application/json" \  -H "Authorization: Bearer <GRAFANA_SERVICE_ACCOUNT_TOKEN>" \  -d "{\"dashboard\": $(cat ./observability/grafana/dashboards/routewarden-overview.json), \"overwrite\": true}" \  https://grafana.example.com/api/dashboards/db

Key Advantages of Reusing Your Existing Stack ​

  • Zero Container Redundancy: You run zero unnecessary containers on your server, conserving memory and CPU.
  • Native Grafana Visualizations: The exported dashboard is 100% standard Grafana JSON. When importing, simply select your existing Loki data source from the dropdown prompt.
  • Unified Log Analytics: Security logs from RouteWarden reside directly alongside your existing application and infrastructure logs, allowing cross-correlation between reverse proxy security blocks and backend application performance.
  • Centralized Alerting: Leverage your existing Grafana Alertmanager, Slack, PagerDuty, or Webhook notification channels without managing duplicate alert rules.

Step-by-Step Integration ​

Step 1: Export and Import Dashboard ​

  1. Run rwarden dashboard export ./observability to write routewarden-overview.json to disk.
  2. In your existing Grafana, navigate to Dashboards > New > Import.
  3. Upload routewarden-overview.json or paste its content.
  4. When prompted, select your existing Loki datasource from the dropdown and click Import.

Step 2: Configure Log Shipping ​

Depending on what collector you run on your gateway host:

  • If you already run Grafana Alloy: Append the discovery.relabel and loki.process blocks from tab 2. Alloy Config above to your host's /etc/alloy/config.alloy.
  • If you already run Promtail: Append the scrape_configs block from tab 3. Promtail Config above to your /etc/promtail/config.yaml.
  • If you have no collector on the gateway host: Run the single lightweight Alloy container from tab 4. Shipper-Only Container configured with your remote Loki endpoint (https://loki.example.com/loki/api/v1/push).

Step 3: Tag Reverse Proxy Containers ​

Ensure your gateway containers carry the label routewarden.logs=true (or routewarden=true) so the discovery relabeling pipeline includes them:

# Tag your gateway containers in docker-compose.ymlservices:  # Traefik example  traefik:    image: traefik:latest    container_name: traefik    labels:      - "routewarden.logs=true"    ports:      - "80:80"      - "443:443"  # Caddy example  caddy:    image: caddy:2-alpine    container_name: caddy    labels:      - "routewarden.logs=true"    ports:      - "80:80"      - "443:443"  # NGINX / OpenResty example  nginx:    image: openresty/openresty:alpine    container_name: nginx    labels:      - "routewarden.logs=true"    ports:      - "80:80"      - "443:443"  # TCP Warden example  tcp-warden:    image: ghcr.io/routewarden/tcp-warden:latest    container_name: tcp-warden    labels:      - "routewarden.logs=true"    ports:      - "2222:2222"

Logs will immediately begin flowing into your existing Loki instance and appearing in your Grafana dashboard.

Released under the MIT License.