Get the FREE Ultimate OpenClaw Setup Guide →

docker-logs

Scanned
npx machina-cli add skill gologo13/agent-skills/docker-logs --openclaw
Files (1)
SKILL.md
1.8 KB

Docker Logs Tail

Tail logs from Docker containers to check for errors and monitor application behavior.

Instructions

When user requests to check container logs:

  1. Discover running containers: First, list all running containers to see what's available:

    docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"
    
  2. Ask user which container(s): Present the list and ask which container(s) they want to monitor

  3. Use appropriate command: Run docker logs with suitable flags based on their needs

Common Commands

List running containers

docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"

Tail logs for a specific container

docker logs -f <container_name>

Tail logs with timestamps

docker logs -f --timestamps <container_name>

Tail last N lines

docker logs -f --tail 100 <container_name>

Check logs since specific time

docker logs -f --since 5m <container_name>

View logs from all containers (with docker compose)

docker compose logs -f

View logs from specific services

docker compose logs -f <service1> <service2>

Filter for errors

docker logs <container_name> 2>&1 | grep -i error

Usage Flow

  1. Run docker ps to discover available containers
  2. Present the container list to the user
  3. Ask which container(s) they want to tail
  4. Ask if they want any filters (errors only, last N lines, since time, etc.)
  5. Execute the appropriate docker logs command

Source

git clone https://github.com/gologo13/agent-skills/blob/main/skills/docker-logs/SKILL.mdView on GitHub

Overview

Docker Logs Tail helps you monitor container output by tailing logs to spot errors and understand app behavior. It starts by listing running containers, prompts you to pick which container to monitor, and then executes docker logs with flags tailored to your needs.

How This Skill Works

The skill first uses docker ps to discover active containers, then prompts you to select target container(s). It runs docker logs with live tail (-f) and optional flags like --timestamps, --tail, or --since to fit your debugging scenario; for multi-service setups, docker compose logs can be used to view logs across services.

When to Use It

  • Investigating errors in a specific container to diagnose a malfunction
  • Monitoring application behavior during a new deployment or rollback
  • Debugging flaky services in development by tailing real-time logs
  • Auditing recent activity by viewing logs since a known time
  • Reviewing logs across all services with docker compose during integration tests

Quick Start

  1. Step 1: Run docker ps with a formatted output to discover containers
  2. Step 2: Pick which container(s) you want to monitor from the list
  3. Step 3: Run docker logs -f <container_name> with optional flags like --timestamps, --tail, or --since

Best Practices

  • Always start with docker ps to confirm which containers are available before tailing
  • Use --tail to limit output when logs are verbose
  • Add --timestamps to correlate events with exact times
  • Pipe logs through grep or a similar filter to surface errors quickly
  • For multi-service contexts, prefer docker compose logs to monitor all relevant services

Example Use Cases

  • Tail the web-app container to verify that deploys fix 500 errors by watching recent logs
  • Monitor the api-service with timestamps to correlate requests and errors under heavy load
  • Check database container logs since deployment time to confirm migrations ran
  • View logs from all services with docker compose logs -f during end-to-end tests
  • Filter for errors in a worker container to identify retry failures

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers