Skip to content

Instantly share code, notes, and snippets.

@carlessanagustin
Last active December 20, 2018 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carlessanagustin/71ec077f93e965cc756d2e4429f4f801 to your computer and use it in GitHub Desktop.
Save carlessanagustin/71ec077f93e965cc756d2e4429f4f801 to your computer and use it in GitHub Desktop.
Logrotate setup - apply: wget -O - https://bit.ly/2PkCV8J | sudo bash -s <LOGS_FOLDER> <FILENAME>
#!/usr/bin/env bash
LOGS_FOLDER=$1
FILENAME=$2
DEST_FOLDER=/etc/logrotate.d
cat << EOF > $DEST_FOLDER/$FILENAME
$LOGS_FOLDER/*.log {
rotate 7
size 100M
compress
missingok
notifempty
}
EOF
logrotate --force $DEST_FOLDER/$FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment