agentleFS
allanninalallanninal/claude-code-skills/skills/logs/SKILL.md

logs

Skill1 starsChanged 9 months agoMITView on GitHub

View and aggregate logs from various sources (systemd, docker, application files). Use when debugging, monitoring services, or investigating errors.

We split this skill into the rules it gives an agent

5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If logs are empty:

    line 163
  2. Very specific:

    Check if service is running: systemctl status $SERVICE

    line 164
  3. Very specific:

    Check log rotation: ls -la /var/log/

    line 165
  4. Very specific:

    Check Docker container status: docker ps -a

    line 166
  5. Distinctive:

    Verify log file permissions

    line 167

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Log Aggregator

View and search logs from multiple sources across your projects.

Arguments

  • $0: Service name or project (optional - shows all if not specified)
  • $1: Options - error, warn, tail, search:pattern (optional)

Log Sources by Project

ProjectSourceLocation/Command
eruditiontx-services-mvpsystemdjournalctl -u erudition-service
eruditiontx-services-mvpapp~/Projects/eruditiontx-services-mvp/logs/
mathmatterstx-servicessystemdjournalctl -u mathmatters-service
agila-tax-managementdockerdocker logs agila-backend
notaryo.phNext.js.next/ logs, terminal output
bocs-turboVercelvercel logs

Commands

View Recent Logs

Systemd Services:

journalctl -u $SERVICE -n 100 --no-pager
# Follow mode
journalctl -u $SERVICE -f

Docker Containers:

docker logs $CONTAINER --tail 100
# Follow mode
docker logs $CONTAINER -f

Application Log Files:

tail -n 100 ~/Projects/$PROJECT/logs/app.log
# Follow mode
tail -f ~/Projects/$PROJECT/logs/app.log

Filter by Level

Errors Only:

# Systemd
journalctl -u $SERVICE -p err -n 100 --no-pager

# Docker/Files
docker logs $CONTAINER 2>&1 | grep -i "error\|exception\|traceback"

# Log files
grep -i "error\|exception\|traceback" ~/Projects/$PROJECT/logs/app.log

Warnings:

grep -i "warn\|warning" $LOG_SOURCE

Search Logs

# Search for pattern
journalctl -u $SERVICE | grep -i "$PATTERN"
docker logs $CONTAINER 2>&1 | grep -i "$PATTERN"
grep -i "$PATTERN" ~/Projects/$PROJECT/logs/*.log

Time-Based Filtering

# Last hour
journalctl -u $SERVICE --since "1 hour ago"

# Today
journalctl -u $SERVICE --since today

# Specific time range
journalctl -u $SERVICE --since "2024-01-01 00:00:00" --until "2024-01-01 23:59:59"

Log Aggregation Mode

View logs from multiple services at once:

# All Erudition services
journalctl -u erudition-service -u mathmatters-service -f

# All Docker containers
docker-compose logs -f

Log Analysis

Count Errors by Type

grep -i "error" $LOG_FILE | sort | uniq -c | sort -rn | head -20

Find Slow Requests

grep -E "took [0-9]+ms" $LOG_FILE | awk '{print $NF}' | sort -rn | head -10

Track Request IDs

grep "$REQUEST_ID" $LOG_FILE

Output Format

Logs: [service-name]
Source: [systemd/docker/file]
Filter: [all/error/warn]
Time: [range]

---
[Formatted log entries with timestamps]
---

Summary:
- Total entries: X
- Errors: Y
- Warnings: Z
- Time span: [start] to [end]

Common Log Patterns

FastAPI (Python)

INFO:     127.0.0.1:52847 - "GET /health HTTP/1.1" 200 OK
ERROR:    Exception in route handler: [error message]

Next.js

ready - started server on 0.0.0.0:3000
error - Error: [error message]
warn - [warning message]

Docker

[timestamp] [level] [message]

Troubleshooting

If logs are empty:

  1. Check if service is running: systemctl status $SERVICE
  2. Check log rotation: ls -la /var/log/
  3. Check Docker container status: docker ps -a
  4. Verify log file permissions

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.