Skip to content

Instantly share code, notes, and snippets.

@suside
Created September 21, 2016 08:48
Show Gist options
  • Save suside/8b262fb3fd65b2235d2b8ca6920ee68a to your computer and use it in GitHub Desktop.
Save suside/8b262fb3fd65b2235d2b8ca6920ee68a to your computer and use it in GitHub Desktop.
journald logs disk usage group by/per unit/container
#!/bin/bash
echo "***************************** CONTAINERS *****************************"
for F in `journalctl -F CONTAINER_NAME`
do
echo "$(journalctl CONTAINER_NAME=$F | wc -c | awk '{ print $1/1024/1024"MB" }') $F"
done | sort -nrk 1 | column -c 2
echo "***************************** UNITS *****************************"
for F in `journalctl -F UNIT`
do
echo "$(journalctl UNIT=$F | wc -c | awk '{ print $1/1024/1024"MB" }') $F"
done | sort -nrk 1 | column -c 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment