Forum Discussion

MEmin's avatar
MEmin
Icon for Nimbostratus rankNimbostratus
Aug 25, 2016

Syslog irule corrupts the web page with Captcha configuration

Hi, We have an irule to send vs traffic through the syslog. But when we enable the page does not work. The webpage is configured with captcha. Have you any suggestions for this issue? Thanks.

when HTTP_REQUEST {

set http_method HTTP/[HTTP::method]
   set http_uri HTTP/[HTTP::uri]
   set http_version HTTP/[HTTP::version]
   set http_request_time [clock clicks -milliseconds]
   set http_user_agent "\"[HTTP::header User-Agent]]\""
   set http_host [HTTP::host]
   set http_username [HTTP::username]
   set client_ip [IP::remote_addr]
   set client_port [TCP::remote_port]
   set http_request_uri [HTTP::uri]
   set request_content_length 0
   if { [HTTP::header exists "Content-Length"] } {
      set request_content_length [HTTP::header "Content-Length"]
   }
   set request_content_type [HTTP::header "Content-type"]
   set referer [HTTP::header value referer]

set now [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"]
}

when HTTP_RESPONSE {

set response_time [expr [clock clicks -milliseconds] - $http_request_time]
   set virtual [virtual]
   set content_length 0
   if { [HTTP::header exists "Content-Length"] } {
      set content_length [HTTP::header "Content-Length"]
   }
   set lb_server "[LB::server addr]:[LB::server port]"
   if { [string compare "$lb_server" ""] == 0 } {
      set lb_server ""
   }
   set status_code [HTTP::status]
   set content_type [HTTP::header "Content-type"]
   set log_msg ""

append log_msg "virtual=$virtual|"
   append log_msg "client_ip=$client_ip|"
   append log_msg "client_port=$client_port|"
   append log_msg "lb_server=$lb_server|"
   append log_msg "request_content_type=$request_content_type|"
   append log_msg "$request_content_length|"
   append log_msg "$http_request_time|"
   append log_msg "host=$http_host|"
   append log_msg "username=$http_username|"
   append log_msg "$http_method|"
   append log_msg "$http_uri|"
   append log_msg "http_version=$http_version|"
   append log_msg "server_status=$status_code|"
   append log_msg "response_content_type=$content_type|"
   append log_msg "$content_length|"
   append log_msg "$response_time|"
   append log_msg "user_agent=$http_user_agent|"

HSL::send [HSL::open -proto UDP -pool POOLNAME] $log_msg

log -noname IP:PORT local0. $log_msg
   log local0. $log_msg
  • What is your question ?. What do you mean by "it doesn't work".

     

    Have you looked to see if the irule fails with an error in the local traffic log ? (/var/log/ltm, or system / logs / local traffic, in the GUI)