#!/bin/ksh
#
# @(#)$Id$
#
# Public Domain Licensed ( free as in 'beer' ) -
# but please leave these lines ( "Name Attribution" )
#
# Author: 2012, Daniel creo Haslinger ( http://creo.blackmesa.at )
#
# Purpose: Convert PF Log device output to Apache Access Log data to
#          use it as input data for the logstalgia visualization tool.


while read LINE; do 

	if test "`echo $LINE | cut -d\ -f6`" = "block" 
	then 
		action=200
	else 
		action=404 
	fi 

	source=`echo $LINE | cut -d\ -f10`
	dest=`echo $LINE | cut -d\ -f12 | cut -d\: -f1`
	dstamp=`date "+%d/%b/%Y:%H:%M:%S"`

	echo "$source - - [$dstamp +0100] \"GET $dest HTTP/1.1\" $action 1000 \"firewall\" \"\")"

	done 

echo "EOF RECEIVED" 

exit 0
