Apache comes with rotatelogs which does exactly what you're looking for.
CustomLog "|/usr/bin/rotatelogs -l /var/logs/apache2/access.log.%Y%m%d 86400" combined
ErrorLog "|/usr/bin/rotatelogs -l /var/logs/apache2/error.log.%Y%m%d 86400"
Or you can write your own small script that does this. Apache than pipes it's log to that script's STDIN again using the following syntax
CustomLog |/path/to/logger.pl combined
Your script reads the log lines on STDIN and writes them to a logfile which name you can choose and change freely.
The script could look something like this
my $logfilePrefix = '/var/log/apache2/access.log.';
while(my $l = <STDIN>)
reopenLog() if(time() >= $rotateAt);
print LOG $l;
my ($day, $month, $year) = (localtime)[3,4,5];
my $logfile = $logfilePrefix.sprintf("%04d%02d%02d", $year+1900, $month+1, $day);
$rotateAt = timelocal(0, 0, 0, (localtime(time() + 86400))[3,4,5]);
open(LOG, ">> $logfile") || die "couldn't write to $logfile: $!\n";
Further reading: http://httpd.apache.org/docs/2.2/logs.html#piped