Last active
December 20, 2018 05:07
-
-
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>
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 | |
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