1

My computer is used for website development. As part of the website application, I have created log files, which previously had been stored in /var/log/webapps/appname (where appname varies per function). These files were left in place during macOS upgrades as expected.

Some time during Mojave or Catalina, these log files were removed upon an OS upgrade. So I moved the location out of /var/log and into my user space into /Users/jas/Websites/RepHunter/log/webapps/. That has not helped--upon any OS upgrade, the log files and directories are removed. This is an annoyance.

Now I have noticed that these log files get removed by the system between system upgrades at some random-seeming time.

I do not use tools such as Onyx to remove log files.

What can I do to find out what is causing this undesired log file removal and stop it?

EDIT:

  1. Web server is apache. Have never had the removal of logs until recently.
5
  • Excellent details. I can’t imagine the OS is messing with that folder in ~ but who knows till we catch it in the act. Are you using Apache or some other server? Sorry for question upon question. Hopefully someone knows what’s cleaning the logs.
    – bmike
    Nov 23, 2020 at 18:50
  • Try chflags -R sappnd /Users/jas/Websites/RepHunter/log/webapps/ if you only append to the logs.
    – Joy Jin
    Nov 24, 2020 at 3:29
  • macOS upgrades should not remove them. Look into /var/logs/install.log perhaps?
    – Joy Jin
    Nov 24, 2020 at 3:30
  • Or, if you are in macOS High Sierra or higher, you can create an APFS volume and mount it on /Users/jas/Websites/RepHunter/log/webapps/. In recovery/installation system the volume will be mounted on /volumes/<name> (if nothing went wrong) and nothing will be there to be deleted (it will be treated like an external data disk and macOS shouldn't touch it). You can also create snapshots of that volume using Carbon Copy Cloner.
    – Joy Jin
    Nov 24, 2020 at 4:58
  • The chflags might be useful. However I believe I would have to boot to single user or something like that to use it. There is nothing in /var/log/install.log that references 'webapps", which it seems like it should if it touched that. The additional mounted APFS volume is also a possibility. Yet these logs are for my workstation and have to be there because the application expects them. However, they are not that critical. So I am not wanting to resort to complex workarounds. Nov 24, 2020 at 21:16

0

You must log in to answer this question.

Browse other questions tagged .