13

I've got a program that runs as a launchd agent, and I have stdout and stderr sent to a log file using the StandardErrorPath and StandardOutputPath keys. I'm quite keen on having stdout/stderr logged somewhere, and it seems like having launchd set this up would be the sensible thing.

(My intention was to suggest a file in ~/Library/Logs/ as a good setting. Then you can easily see the output in Console.app.)

Something I've noticed though is that launchd never seems to clean up these logs! I was expecting it to clear the log on each reboot, perhaps, or every few days, or something - but it seems not to. After a couple of weeks, I've got a 7MByte 22,000-line log file, virtually none of which is relevant. (It's highly unlikely you'd care about anything that happened before the last reboot, and in fact rather unlikely you'd care about anything that didn't happen in the last 15 minutes.)

Is there something I can do to stop the file growing indefinitely?

Tom Seddon
  • 2,648
  • 1
  • 19
  • 28
  • I have same issue with plist standardoutpath log file. seem there is no way to manage that out put file. – cidy.long Aug 25 '16 at 21:50
  • 1
    Sounds like you're wanting [log rotation](https://richard-purves.com/2017/11/08/log-rotation-mac-admin-cheats-guide/) – TheDarkKnight Dec 20 '22 at 11:03
  • Thanks. I don't work on (or use) this program any more, but that looks like about the sort of thing I was hoping for. For anybody else finding this later: there's also something called ASL, it seems, which sounds like it's related. Plenty of broken links to be found with Google! – Tom Seddon Dec 23 '22 at 22:41

0 Answers0