This script ensures that apache2, postgresql, and debconf all operate correctly when /var/log and /var/cache are mounted on a tmpfs filesystem:
# Put these commands into /etc/init.d/make-tmpfs-dirs

#!/bin/sh
mkdir /var/cache/debconf

mkdir /var/log/apache2
chown root:adm /var/log/apache2
chmod 750 /var/log/apache2

mkdir /var/log/postgresql
chown root:postgres /var/log/postgresql
chmod 774 /var/log/postgresql

exit 0
Now make that script executable:
chmod u+x /etc/init.d/make-tmpfs-dirs
Now link to the make-tmpfs-dirs script from the correct rc.d runlevel directory
cd /etc/rc2.d
ln -s ../init.d/make-tmpfs-dirs S02make-tmpfs-dirs