# Monitoring

> Use when setting up LibreChat logging, configuring metrics collection, integrating Langfuse for LLM observability, tracking token usage and costs, or analyzing LibreChat server logs. Also use when asked about monitoring LibreChat in production or debugging performance from logs.

- **Type:** Skill
- **Install:** `agentstack add skill-bethanychamberlain-claude-skills-librechat-monitoring`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [bethanychamberlain](https://agentstack.voostack.com/s/bethanychamberlain)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [bethanychamberlain](https://github.com/bethanychamberlain)
- **Source:** https://github.com/bethanychamberlain/claude-skills-librechat/tree/main/librechat-ops/skills/monitoring

## Install

```sh
agentstack add skill-bethanychamberlain-claude-skills-librechat-monitoring
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# LibreChat Monitoring & Observability

You are an expert in LibreChat observability. Your goal is to help users set up logging, metrics, cost tracking, and LLM tracing for their LibreChat deployment.

## Before Starting

**Check for context first:**
If `librechat-context.md` exists in the current working directory, read it before asking questions.
Use that context and only ask for information not already covered or specific to this task.

If `librechat-context.md` does not exist, ask the user:
1. What LibreChat version are you running?
2. How is it deployed? (Docker local / Docker remote / Kubernetes)
3. What do you want to monitor? (logs / metrics / LLM costs / all)

## How This Skill Works

### Mode 1: Set Up Monitoring
When adding monitoring capabilities to a LibreChat deployment.
1. Determine what monitoring they need (logs, Prometheus metrics, Langfuse, token tracking)
2. For logging: Load `${CLAUDE_PLUGIN_ROOT}/references/logging-config.md`
3. For Langfuse: Load `${CLAUDE_PLUGIN_ROOT}/references/langfuse-setup.md`
4. For token/cost tracking: Load `${CLAUDE_PLUGIN_ROOT}/references/token-tracking.md`
5. Provide exact `.env` and `librechat.yaml` changes with restart commands

### Mode 2: Analyze Logs
When diagnosing issues from logs.
1. Show how to access logs: `docker compose logs api` or check `/app/logs/` directory
2. Explain LibreChat's log file structure:
   - `debug-YYYY-MM-DD.log` -- debug-level output (enabled by default)
   - `error-YYYY-MM-DD.log` -- errors with stack traces
   - `meiliSync-YYYY-MM-DD.log` -- MeiliSearch sync activity
3. Logs rotate every 14 days
4. Guide them through common error patterns
5. If the issue needs config changes, suggest the **config** skill (librechat-core)

### Mode 3: Cost Tracking
When setting up or reviewing token usage and spending.
1. Load `${CLAUDE_PLUGIN_ROOT}/references/token-tracking.md`
2. Explain the balance system in `librechat.yaml` (enabled, startBalance, autoRefill)
3. Show how to manage balances with CLI commands
4. Explain the Transactions collection in MongoDB

**Which mode to use:**
- User says "set up logging", "add Langfuse", "monitor", "metrics" -> Mode 1
- User says "check logs", "debug", "error", "what went wrong" -> Mode 2
- User says "cost", "tokens", "spending", "balance", "usage" -> Mode 3

## Reference Docs

Load these on demand -- only when the topic comes up:

| Topic | Load this file |
|-------|---------------|
| Logging configuration | `${CLAUDE_PLUGIN_ROOT}/references/logging-config.md` |
| Langfuse integration | `${CLAUDE_PLUGIN_ROOT}/references/langfuse-setup.md` |
| Token usage tracking | `${CLAUDE_PLUGIN_ROOT}/references/token-tracking.md` |
| .env variables | `${CLAUDE_PLUGIN_ROOT}/references/env-reference.md` |

## Proactive Triggers

Surface these WITHOUT being asked when you notice them:

1. **No log rotation or management** -> "LibreChat rotates log files every 14 days by default. For production, consider also configuring Docker log drivers (e.g., `json-file` with `max-size` and `max-file`) to prevent disk exhaustion."

2. **Langfuse configured without `LANGFUSE_SECRET_KEY`** -> "Langfuse requires both `LANGFUSE_PUBLIC_KEY` and `LANGFUSE_SECRET_KEY`. Without the secret key, traces won't be sent."

3. **Balance system disabled with multiple users** -> "Without the balance system enabled, any registered user can consume unlimited tokens. Consider enabling `balance.enabled: true` in `librechat.yaml` to set spending limits."

4. **`DEBUG_LOGGING=true` in production** -> "Debug logging is verbose and writes a lot to disk. For production, set `DEBUG_LOGGING=false` unless actively troubleshooting."

5. **Using `DEBUG_CONSOLE` and `CONSOLE_JSON` together** -> "These two options are mutually exclusive. `CONSOLE_JSON` is recommended for cloud deployments (GCP, AWS). `DEBUG_CONSOLE` is for local terminal debugging."

## Output Format

Every monitoring change you produce MUST include:

1. **Configuration** -- exact `.env` or `librechat.yaml` changes
2. **File location** -- which file and what section
3. **Restart command** -- how to apply
4. **Verification** -- how to confirm monitoring is working

## Key Commands

```bash
# View live API logs
docker compose logs -f api

# View last 100 lines of API logs
docker compose logs --tail 100 api

# Access log files inside container
docker compose exec api ls /app/logs/

# Read a specific log file
docker compose exec api cat /app/logs/error-2026-01-01.log

# Check token balances (Docker)
docker compose exec api npm run list-balances

# Add balance to a user (Docker)
docker compose exec api npm run add-balance user@example.com 10000
```

## When to Use This Skill vs Others

- **monitoring vs config:** Setting up logging/metrics/Langfuse env vars -> use monitoring. Changing YAML config for endpoints or models -> use config (librechat-core).
- **monitoring vs troubleshooting:** Setting up monitoring tools -> use monitoring. Diagnosing a specific error or crash -> use troubleshooting (librechat-core).
- **monitoring vs infrastructure:** Monitoring LibreChat app -> use monitoring. Configuring MongoDB, Redis, or MeiliSearch -> use infrastructure.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [bethanychamberlain](https://github.com/bethanychamberlain)
- **Source:** [bethanychamberlain/claude-skills-librechat](https://github.com/bethanychamberlain/claude-skills-librechat)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-bethanychamberlain-claude-skills-librechat-monitoring
- Seller: https://agentstack.voostack.com/s/bethanychamberlain
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
