I think you could be trying to over complicate this problem, could you not just do the following?
$SERVER["socket"] == “192.168.1.1:80″ {
accesslog.filename = "/var/log/lighttpd/192.168.1.1-access.log"
}
You also mentioned you were having trouble with include_shell try the following
lighttpd.conf
include_shell "/etc/lighttpd/scripts/servername.sh"
accesslog.filename = "/var/log/lighttpd/" + var.servername + "-access.log"
scripts/servername.sh - for hostname
#!/bin/bash
echo 'var.servername="'$(uname -n)'"'
OR
scripts/servername.sh - for ip address
#!/bin/bash
echo 'var.servername="'$(/sbin/ifconfig | sed -n '2 p' | awk '{print $2}' | sed s/addr://g)'"'
(change the sed and awk param to get the right IP for your on more than one interface)
This will give you what you are looking for.
Alternatively just cat accesslog.filename = "/var/log/lighttpd/" +
uname -n+ "-access.log"
to the end of the config file for a cheap and dirty solution.