clean-logs

Truncates Docker container log files to zero bytes without restarting containers.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/gweone/agent-plugins --skill clean-logs-gweone
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-logs
Source: https://github.com/gweone/agent-plugins/tree/main/plugin/sharpps-liferay/skills/clean-logs
Command: npx skills add https://github.com/gweone/agent-plugins --skill clean-logs-gweone

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Docker container logs grow unbounded over time and consume disk space, and manually locating and clearing each container's log file is tedious and error-prone. ## Core Features & Use Cases - Targeted Log Truncation: Clears the log file of a specific Docker container by resolving its log path via docker inspect. - Interactive Container Selection: Lists running containers and prompts the user to choose one when no container name is provided. - Safe Live Operation: Truncates logs without restarting the container, with a sudo fallback for permission-denied cases. - Use Case: A developer notices a Liferay container's JSON log file has grown to several gigabytes during debugging; they run this skill to wipe the log while the container keeps running. ## Quick Start Clear the logs for my running Docker container named liferay-portal.

Frequently Asked Questions about clean-logs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clear Docker container logs without restarting?

Clear Docker container logs by truncating the container's log file to zero bytes: run truncate -s 0 on the path returned by docker inspect --format='{{.LogPath}}' for that container. The container keeps running because only the log file is emptied.

How to find the log file path of a Docker container?

Find a container's log file path with docker inspect --format='{{.LogPath}}' followed by the container name or ID. This returns the JSON log file location on the host, typically under /var/lib/docker/containers.

Why do I get permission denied when truncating Docker logs?

Permission denied occurs because Docker log files are owned by root. Prefix the truncate command with sudo to gain the required privileges, for example sudo truncate -s 0 on the resolved log path.

Does clearing Docker logs stop or restart the container?

No, truncating the log file does not stop or restart the container. The truncation only empties the existing log file on disk, so the container continues running and writing new log entries afterward.

What are the limitations of truncating Docker logs manually?

Manual truncation is a one-time fix and does not prevent logs from growing again. For long-term control, configure Docker logging driver options such as max-size and max-file to enable automatic log rotation.