The situation is like that: Applications can use the syslog(3) API and the asl(3) API to log messages, other data logged can come from the kernel or from the network. All of these messages are handed over to the syslog Daemon: syslogd(8). The syslogd now outputs log messages both the BSD way (it writes stuff into various basic log files like /var/log) and into a unified log message store (/var/log/asl.log).
If you want certain log messages not to appear in your log files (eg. you read logs like system.log by selecting them in Console.app), you will need to configure syslog.conf(5) like chiggsy said. If you want messages not to be stored in the asl database, you will need to configure asl.conf(5).
If, for example, you do not longer want Bonjour's (mDNSResponders) Log messages to be stored in the ASL db, you will need to add the following line to /etc/asl.conf :
? [= Sender mDNSResponder] ignore
… and then "gently" restart the syslogd by:
sudo killall -HUP syslogd
Now, messages from mDNSResponder will no longer appear when you go into Console.app's "all messages", but still exist within your logfiles.
Lastly, if you call syslog(1) from the command line, it acts as a nice frontend for querying the ASL db - you could for example ask it to show all messages from the Time Machine Backup starter that were logged in the last two hours by running:
syslog -k Facility -k Sender com.apple.backupd-auto -k Time ge −2h
…which explains, why the ASL db is handy: you can search for log files simultaneously in "all log files".
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.
Best Answer
Yes, you can safely delete log files. In the case of an application needing to write a new entry and the file not being found, it will be re-created automatically.
Just bear in mind that these ASL (Apple System Log) files may contain some useful information to trace or debug any issues you could be experimenting with your computer, which, of course, will be lost with the deletion of the files.
So, in case you might want to take a look at these files before deleting them, you could use the
syslog
command as follows:syslog -f /private/var/log/asl/nameOfTheFile.asl