brew install logrotate
export PATH=${PATH}:/usr/local/sbin
logrotate -?
(I made mine feed_engine
)
/Users/travisvalentine/hungry-projects/feed_engine/log/*.log { (So logrotate knows which files to rotate.)
size 0k (Logrotate runs only if the filesize is equal to (or greater than) this size.)
missingok (Don’t issue an error message if log files are missing.)
rotate 7 (The maximum number of log files to keep. Once you have more, oldest deleted.)
mail [email protected] (email me the log files)
compress (Compress old versions of log files to save space (uses gzip by default))
delaycompress (Delays the compression until the next log rotation.)
notifempty (Won't rotate if the log file is empty.)
copytruncate (Makes a backup copy of the current log and then clears the log file for continued writing.)
}
logrotate -f <configfile>
(In my case, logrotate -f feed_engine)
Also,
sudo brew services start logrotate
to run as daemon