I noticed that the Engine.log in '~/Library/Logs/Keyboard Maestro' is getting quite large and contains entries that date several years back.
Since Keyboard Maestro doesn’t seem to rotate the log itself, what’s the best way to have it rotated automatically on a regular basis to keep its size under control?
I have never encountered that issue so I hope other replies will explain what is going wrong there. If all else fails, though: you could have a macro move and/or rename the log file (adding the current date) and KM would just create a new Engine.log file as soon as it has something to log.
Frankly, I didn’t consider this an “issue” – just the way KM operates. Does that mean your Engine.log is not retaining years-old entries and growing indefinitely?
I usually try not to pull log files out from under running processes – that’s often not a good idea. But now that you mentioned simply deleting it, I checked Activity Monitor, and it does indeed look like Keyboard Maestro Engine is not keeping Engine.log open at all times.
That means I could just do this the standard way and use macOS’s newsyslog to rotate the log file on a weekly or monthly basis without having to worry about what that might do to KM.
Hi, @mfichtner. When you mentioned rotate were you referring to the following process?
If that's the case, I don't think that's how Keyboard Maestro operates. @peternlewis, please correct me if I wrong. I haven't been able to find this information in the wiki.
Keyboard Maestro rotates the log within the single file.
It does not, as some log rotations work, rotate the log by renaming the log file to a numbered sequence, each sequential log file to the next number, dropping the last of the sequence, and starting a new log.
When the log file gets past 13MB, it is trimmed back to the last 7MB or so.
I can't imagine anyone desiring to save old backups of the log file to ensure they don't lose data from more than 7MB of log data ago.
So there is no need to do anything to limit the log file size.
Yes, that’s what I had in mind. And it’s what newsyslog does. But in this particular case, I think @peternlewis’s solution is perfectly adequate. Engine.log is not nearly as important as, say, syslog or mail server logs, where you want to retain “historical” data. Doing full log rotation would be overkill when another method for controlling log file size is already in place.
That looks pretty impressive. I’ll definitely check it out – but not for this particular purpose.
With older versions of MacOS, I think you could use newsyslog for third party logs. With Tahoe, however, I think you need to write your own shell script and use launchd.
But in your case, @mfichtner, it all seems to be moot.