Skip to content

Better Stack

We use Better Stack to handle centralized logging and uptime monitoring. This integration ensures that logs are not lost in ephemeral containers and provides immediate alerting for system failures.

Security & Environment Variables

Sensitive credentials are strictly managed via environment variables. You must configure your .env file (locally) or the Secrets settings (on Hugging Face) with:

# Better Stack Credentials
BETTER_STACK_TOKEN="your_source_token_here"
BETTER_STACK_HOST="your_source_host_here"

Retrieving Credentials

  • Log in to the Better Stack Dashboard.
  • Go to Telemetry -> Sources.
  • Click Configure on your source project.
  • Copy the Source Token and Ingesting Host.

Features

  1. Live Logs (Live Tail)

Logs are routed directly to the Better Stack dashboard.

How to view: Navigate to the Telemetry tab in Better Stack to see logs streaming in real-time.

Filter: You can filter by log level (INFO, WARNING, ERROR).

  1. Uptime Monitoring A monitor is configured to ping the Hugging Face Space URL.

Check Frequency: Every 3 minutes.

Better Stack email

  1. Incident Alerts Automated alerts are triggered when:

  2. A log with level ERROR is detected in the stream.

  3. The Uptime monitor detects the service is "Down".

Better Stack email

Testing the Integration

To verify that logging is correctly configured and reaching the dashboard:

  • Start the application.
  • Trigger a test error log manually (or use a test script):

import logging
logging.error("Test Error for Better Stack verification")
- Check the Live Tail in Better Stack; the entry should appear almost instantly. - Check the Uptime dashboard to confirm the status is "Up"