mz-configure-loki-logging

Configure Grafana Loki logging for Python/Flask apps via mazza-base.

1|Updated Oct 23, 2025
One-click install
npx skills add https://github.com/jmazzahacks/byteforge-claude-skills --skill mz-configure-loki-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mz-configure-loki-logging
Source: https://github.com/jmazzahacks/byteforge-claude-skills/tree/main/skills/mz-configure-loki-logging
Command: npx skills add https://github.com/jmazzahacks/byteforge-claude-skills --skill mz-configure-loki-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the complexity of setting up structured logging and centralized log management for Python/Flask applications, providing seamless transition between local development and production environments.

Core Features & Use Cases

  • Automatic Mode Detection: Console logs for local development, Loki shipping for production.
  • Secure Integration: Uses CA certificates for encrypted Loki communication.
  • Use Case: When deploying a new Flask API service, use this Skill to configure logging that works locally with readable console output and automatically ships structured JSON logs to Grafana Loki in production.

Quick Start

Configure Loki logging for a Python Flask application by providing the application name, main file location, and certificate availability.

Frequently Asked Questions about mz-configure-loki-logging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up centralized logging for a Python Flask application?

Centralized logging for Flask apps uses Grafana Loki to collect structured logs from multiple services. Add the mazza-base dependency, place the CA certificate, update your Dockerfile, and call configure_logging() at the top of your main application file to enable automatic log shipping to Loki endpoints specified via environment variables.

Can I use the same logging setup for both local development and production?

Yes. Set DEBUG_LOCAL=true for local console logging or false for production Loki shipping. The same configure_logging call handles both modes automatically, eliminating the need for separate configurations while keeping local development logs readable.

What do I need to configure Loki logging for a Flask service?

You need the mazza-base library, a CA certificate file (mazza.vc_CA.pem), Loki endpoint credentials (MZ_LOKI_* environment variables), a LOG_LEVEL setting, and a Dockerfile update. The Skill handles the rest through a single function call in your application entry point.

Does Loki logging work with existing Python Flask applications?

Yes. Loki logging applies to both new Flask services and existing Python applications. Integration requires adding the mazza-base dependency and initializing configure_logging at the top of your main file; no architectural changes to your Flask code are needed.

How does environment-driven logging help with Flask deployment?

Environment-driven logging lets you toggle between console output for local debugging and secure Loki shipping for production without code changes. Use DEBUG_LOCAL and LOG_LEVEL environment variables to control behavior across your Flask service's deployment lifecycle.

What security features protect Loki communication from Python applications?

CA certificate-secured connections encrypt all log traffic from Python apps to Grafana Loki. The mazza-base library enforces this encryption by default, requiring the CA bundle path to establish authenticated, secure channels for centralized log collection.