Skip to content

Instantly share code, notes, and snippets.

@sheershoff sheershoff/dcsl
Last active May 20, 2018

What would you like to do?
Docker-compose logs sorted by time
usage="Input piped docker-compose logs -t, or a file created from this command, to show logs lines sorted by time.\n\n Usage:\n\n $(basename "$0") [-h|--help] - this message\n $(basename "$0") - runs default docker-compose logs -t and sorts'em\n docker-compose logs -t|$(basename "$0") - pipe logs to this command\n $(basename "$0") my-compose.log - or choose file with logs to display\n\n"
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-"
case "$1" in
-h|--help) printf "$usage"
if [ -t 0 ]; then
docker-compose logs -t|sort -t "|" -k +2d
sort -t "|" -k +2d $input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.