Environment Variables
Configure Loggator using environment variables in your docker-compose.yml or .env file.
Required Variables
Section titled “Required Variables”MEILISEARCH_HOST
Section titled “MEILISEARCH_HOST”The URL where Meilisearch is accessible.
MEILISEARCH_HOST: http://meilisearch:7700- Default:
http://meilisearch:7700 - Format:
http://host:portorhttps://host:port - Example:
http://localhost:7700(for development)
MEILISEARCH_API_KEY
Section titled “MEILISEARCH_API_KEY”The master key for authenticating with Meilisearch.
MEILISEARCH_API_KEY: your-secure-key-here- Default: None (required)
- Format: Base64 string
- Security: Must match
MEILI_MASTER_KEYin Meilisearch container - Generate:
openssl rand -base64 32
Container Filtering
Section titled “Container Filtering”DOCKER_LABEL_FILTER
Section titled “DOCKER_LABEL_FILTER”Define which containers Loggator should monitor.
DOCKER_LABEL_FILTER: loggator.enable=true- Default:
loggator.enable=true - Format:
key=value - Examples:
app.monitor=true- Custom labelenvironment=production- Filter by environment
Only containers with this exact label will be monitored.
Web Server
Section titled “Web Server”The port on which Loggator’s web interface runs.
PORT: 3000- Default:
3000 - Format: Integer (1-65535)
- Note: This is the internal port. Map it differently in Docker:
ports:- "8080:3000" # Access on port 8080
AI Assistant Configuration
Section titled “AI Assistant Configuration”All AI variables are optional. Without them, Loggator works as a log viewer without AI features.
OPENROUTER_API_KEY
Section titled “OPENROUTER_API_KEY”Your OpenRouter API key for AI-powered chat.
OPENROUTER_API_KEY: sk-or-v1-...- Default: None (AI disabled)
- Format: String starting with
sk-or-v1- - Get Key: OpenRouter Dashboard
- Free Tier: Available with rate limits
AI_MODEL
Section titled “AI_MODEL”The OpenRouter model to use for chat.
AI_MODEL: xiaomi/mimo-v2-flash:free- Default:
xiaomi/mimo-v2-flash:free - Format:
provider/model-nameorprovider/model-name:variant
Recommended Free Models:
xiaomi/mimo-v2-flash:free- Fast, good for logsgoogle/gemini-2.0-flash-thinking-exp:free- Reasoning modelmeta-llama/llama-3.2-3b-instruct:free- Lightweight
Paid Models (Better Quality):
anthropic/claude-3.5-sonnet- Best qualityopenai/gpt-4-turbo- Very capablegoogle/gemini-pro-1.5- Fast and good
SITE_URL
Section titled “SITE_URL”Your site’s URL for OpenRouter attribution.
SITE_URL: http://localhost:3000- Default:
http://localhost:3000 - Format: Full URL with protocol
- Purpose: OpenRouter uses this for usage tracking
- Production Example:
https://logs.mycompany.com
Development Variables
Section titled “Development Variables”NODE_ENV
Section titled “NODE_ENV”Set the application environment.
NODE_ENV: production- Default:
production - Options:
development,production - Effect: Enables/disables debug logging
Meilisearch Configuration
Section titled “Meilisearch Configuration”These are set on the Meilisearch container, not Loggator.
MEILI_MASTER_KEY
Section titled “MEILI_MASTER_KEY”Master key for Meilisearch authentication.
# In meilisearch serviceMEILI_MASTER_KEY: your-secure-key-here- Must Match:
MEILISEARCH_API_KEYin Loggator - Generate:
openssl rand -base64 32 - Min Length: 16 characters
MEILI_ENV
Section titled “MEILI_ENV”Meilisearch environment mode.
MEILI_ENV: production- Default:
development - Options:
development,production - Production: Disables development features, improves performance
Complete Example
Section titled “Complete Example”.env File
Section titled “.env File”# RequiredMEILI_MASTER_KEY=bLwLpwgIW6VQTBrt7ZhUw9MiJXYh8Vat7YVr4lU-5XA
# Optional - AI FeaturesOPENROUTER_API_KEY=sk-or-v1-1234567890abcdefAI_MODEL=xiaomi/mimo-v2-flash:freeSITE_URL=http://localhost:3000
# Optional - CustomizationDOCKER_LABEL_FILTER=loggator.enable=truePORT=3000NODE_ENV=productiondocker-compose.yml
Section titled “docker-compose.yml”services: meilisearch: image: getmeili/meilisearch:v1.12 environment: MEILI_MASTER_KEY: ${MEILI_MASTER_KEY} MEILI_ENV: production
loggator: image: ghcr.io/mbeggiato/loggator:latest environment: MEILISEARCH_HOST: http://meilisearch:7700 MEILISEARCH_API_KEY: ${MEILI_MASTER_KEY} DOCKER_LABEL_FILTER: ${DOCKER_LABEL_FILTER:-loggator.enable=true} PORT: ${PORT:-3000} OPENROUTER_API_KEY: ${OPENROUTER_API_KEY} AI_MODEL: ${AI_MODEL:-xiaomi/mimo-v2-flash:free} SITE_URL: ${SITE_URL:-http://localhost:3000} NODE_ENV: ${NODE_ENV:-production}Validation
Section titled “Validation”Check if variables are loaded correctly:
# Inside Loggator containerdocker exec loggator env | grep MEILISEARCH
# Test Meilisearch connectiondocker exec loggator curl http://meilisearch:7700/healthSecurity Best Practices
Section titled “Security Best Practices”- Never hardcode secrets in
docker-compose.yml - Use
.envfiles and add them to.gitignore - Rotate keys regularly (every 90 days)
- Use strong keys (minimum 32 characters)
- Limit container access with the label filter
- Use read-only Docker socket (
:roflag)
Troubleshooting
Section titled “Troubleshooting”Connection refused to Meilisearch
Section titled “Connection refused to Meilisearch”Check that:
MEILISEARCH_HOSTpoints to the correct container name- Both containers are on the same Docker network
- Meilisearch is running:
docker compose ps meilisearch
Authentication failed
Section titled “Authentication failed”Verify:
MEILI_MASTER_KEYandMEILISEARCH_API_KEYare identical- Keys are at least 16 characters long
- No extra spaces in environment values
AI not working
Section titled “AI not working”Confirm:
OPENROUTER_API_KEYis valid- API key has credits/quota available
- Model name is correct and available
Test the API key:
curl https://openrouter.ai/api/v1/models \ -H "Authorization: Bearer $OPENROUTER_API_KEY"Next Steps
Section titled “Next Steps”- Docker Setup - Configure container monitoring
- AI Assistant - Choose the best AI model
- API Reference - Use Loggator programmatically