Forum Discussion

Wil_Schultz_101's avatar
Icon for Nimbostratus rankNimbostratus
Jan 17, 2012

How can I test to see if HTTP::Status exists?

I'm using an HSL config that prints out some useful syslog information. It works well, except for one type of request. Unfortunately I don't know what that request looks like quite yet, basically I've got a checken/egg thing happening.



Here's the error I'm seeing:


TCL error: /Common/ - Illegal argument. Invalid client side API (line 15) invoked from within "HTTP::status"









So here's what I have, the commeted section where HTTP::status is referenced causes this issue. I suspect it's not seeing a status code and complaining. I'd love to test if HTTP::status exists, if not insert XXX as the status code, and if it does insert the real status code.:






set hsl [HSL::open -proto TCP -pool syslog_pool]








set http_request_time [clock clicks -milliseconds]


set remote_addr "[IP::remote_addr]"


set LogString1 "<190> $remote_addr \"[HTTP::header Host]\" \"[HTTP::method] [HTTP::uri] HTTP\/[HTTP::version]\" \"[HTTP::header User-Agent]\""










set http_status XXX


if { [HTTP::status] } {


set http_status [HTTP::status]






set LogString2 "[HTTP::status] pool_info: [LB::server] (ResponseTime: [expr [clock clicks -milliseconds] - $http_request_time]ms)"


set LogString2 "$http_status pool_info: [LB::server] (ResponseTime: [expr [clock clicks -milliseconds] - $http_request_time]ms)"


set LogString2 "pool_info: [LB::server] (ResponseTime: [expr [clock clicks -milliseconds] - $http_request_time]ms)"




HSL::send $hsl "$LogString1 | $LogString2 \n"





1 Reply

  • Dupe of this post: