query-loki-project-logslisted
Install: claude install-skill Sube-py/awesome-skills
# Query Loki Project Logs
Use this skill to inspect Loki logs with the house convention:
- `project_name` identifies the service or deployment and usually matches the git repository name
- `env` identifies the deployment environment such as `dev`, `test`, or `prod`
- `filename` identifies the concrete stream, such as `pd_router-web-stderr.log` or `pd_router-nginx-stdout.log`
The helper script is compatible with both:
- newer Loki setups that use `project_name`
- older Loki setups that still use `project`
It auto-detects the project label unless `--project-label` or `LOKI_PROJECT_LABEL` is set.
If the user prefers dashboards over CLI triage, Grafana dashboards can use the same labels and keywords:
- project filter: `project_name` or `project`
- environment filter: `env`
- stream filter: `filename`
- free-text filter: the request path, trace keyword, or error signature
## Quick Start
1. Resolve the Loki address and credentials.
2. List available project values.
3. List available environment values if needed.
4. List the target project's `filename` values.
5. Pick the stream that matches the question.
6. Query the time window and summarize findings.
Prefer the helper script first:
```bash
export LOKI_ADDR="https://your-loki.example.com"
export LOKI_USERNAME="your-basic-auth-user"
export LOKI_PASSWORD="your-basic-auth-password"
python3 scripts/loki_project_logs.py projects --since 720h
python3 scripts/loki_project_logs.py envs --since 720h
python3 scripts/loki_project