F5 TCL irule examples
Jump to navigation
Jump to search
when CLIENT_ACCEPTED { set hsl [HSL::open -proto UDP -pool /APPLICATION/test_logserver] set tstamp [clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S %z"] HSL::send $hsl "<22> $tstamp [IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port] CLIENT_ACCEPTED\n" TCP::collect } when CLIENT_DATA { set cdata [TCP::payload] if { [ string length $cdata ] <= 0 } { return } if { not ( $cdata contains "\r\n" ) } { return } if { $cdata starts_with "MAIL FROM:" } { set cfrom [TCP::payload] set tstamp [clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S %z"] HSL::send $hsl "<22> $tstamp [IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port] $cfrom\n" return } if { $cdata starts_with "RCPT TO:" } { set crcpt "$crcpt[TCP::payload]" set tstamp [clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S %z"] HSL::send $hsl "<22> $tstamp [IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port] $crcpt\n" return } TCP::release TCP::collect } when CLIENT_CLOSED { set tstamp [clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S %z"] HSL::send $hsl "<22> $tstamp [IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port] CLIENT_CLOSED\n" }