Requirements
modprobe ipt_LOGsysctl net.netfilter.nf_log.2 = ipt_LOGUSER ALL=(root) NOPASSWD: /sbin/iptables-save ""USER ALL=(root) NOPASSWD: /sbin/iptables -t raw -F *USER ALL=(root) NOPASSWD: /sbin/iptables -t raw -A * -j TRACEUSER ALL=(root) NOPASSWD: /sbin/sysctl net.netfilter.nf_log.2=ipt_LOGUSER is unix user running ajax.php script (eg. www-data for apache)
sudo -u USER php -S localhost:8080 -t .$logfile in ajax.php to point to file iptables is logging in (eg. /var/log/kern.log)
:msg, regex, "^\[[ ]*[0-9]*\.[0-9]*\] Firewall: " -/var/log/iptables.log
& ~
:msg, regex, "^\[[ ]*[0-9]*\.[0-9]*\] TRACE: " -/var/log/iptables.log
& ~
$logfile for USER (eg. chmod +r $logfile)