Last active
May 7, 2025 08:38
-
-
Save ivuorinen/f6c02c8f5cad7186827e77837ad0ef90 to your computer and use it in GitHub Desktop.
Find and truncate Traefik log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Truncate Traefik high volume log | |
# CRONTAB: 0 */2 * * * /root/scripts/traefik-truncate-log.sh > /dev/null 2>&1 | |
TRAEFIK=$(docker ps --no-trunc | grep 'traefik' | awk '{ print $1 }'); | |
TRAEFIK_PATH="/var/lib/docker/containers/$TRAEFIK/"; | |
/usr/bin/find "$TRAEFIK_PATH" -type f \( -name "*-json.log" \) -size +5M -exec bash -c 'echo "" > "$1"' _ {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment