Log rotation in Mac OSX Clark Wilkins 2022.03.19
I have recently started exploring log rotation to better handle some of the Amazon EC2 servers I am using. As part of the learning project, I wanted to do some log rotation in my sandbox environment, where I have some Node/Express APIs doing a lot of logging.
I was surprised, at first, to find there is no logrotate binary, but a bit of investigation turned valuable links here and here.
For my sandbox, I need to rotate logfiles in a local directory, triggered when the file size reaches 100KB, keeping the last two archived logs, running at midnight. This is what it looks like:
sh-3.2# cat /private/etc/newsyslog.d/clark.conf # logfilename [owner:group] mode count size whenOnce this is setup, there's nothing more to do. Thanks to the sources cited above.