I have Apache2 web access logs that are created in /var/log/apache2/ that I want to preserve forever so that a web statistics analyser can process them and show me how page hits are changing over a period of months. I use Time Machine as a backup, and hoped that it would backup these log files too, but have now discovered that they are not included (tmutil confirms that the individual files are excluded). There are thousands of log files (one per day, for each of 10 virtual hosts) and at least 10 are generated each new day, so manually including a rule for each is not possible. Is there a way to tell Time Machine to include the whole of /var/log/apache2 and its sub-directories (the TM Preference Pane makes it easy to exclude folders, but I don't see a way of telling it to include folders)?

I'm running Mac OS X 10.10 on a recent Mac Mini and using the MacPorts version of Apache, but I doubt that my question is specific to this hardware/software.


Time Machine is designed around ease of use, rather than utility. It does not backup everything on the hard drive, typically not including files that are not necessary to recover from a failure. Log files seem to fit this category.

The first option is to see if you can remove the exclusion using tmutil, which is the commandline version of Time Machine.

tmutil removeexclusion "/var/log/apache2"

Typically, this command is used for exclusions the user has created, but its worth a try.

The other option is to use something like chron and bash (or Automator) to simply compress the log files into an archive (zip file) and place the archive in your documents folder. I would suggest that you perhaps name your archive file with the date, so Time Machine does not assume they are duplicate or simply newer versions of the same file.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .