Skip to content

Instantly share code, notes, and snippets.

@jmkim
Created June 18, 2018 01:36
Show Gist options
  • Save jmkim/29a66f103a7e94a375307de11d081dd1 to your computer and use it in GitHub Desktop.
Save jmkim/29a66f103a7e94a375307de11d081dd1 to your computer and use it in GitHub Desktop.
Log combiner for logrotate
#!/bin/bash
for a in $(ls -1 access* | sort -t. -k3,3nr)
do
cat "$a" >> combined_access.log
done
for e in $(ls -1 error* | sort -t. -k3,3nr)
do
cat "$e" >> combined_error.log
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment