Forum Discussion
getting all headers from http request without using a loop
I am using the below irule to get all headers from every http request. Is there any other efficient way to do this for instance without using a loop. Any input is much appreciated
Present Irule
when HTTP_REQUEST {
set HttpHeader " "
set now [clock format [clock seconds] -format "%D %H:%M:%S %z"]
set contentlength [HTTP::header "Content-Length"]
foreach aHeader [HTTP::header names] {
append HttpHeader $aHeader ":" [HTTP::header value $aHeader] "\r\n"
}
HSL::send $applayer_hsl "<190>\r\n$HttpHeader\r\nPath:[URI::path [HTTP::uri]][URI::basename [HTTP::uri]]\r\nQueryStr:[HTTP::query]\r\nHttpKalive:[HTTP::is_keepalive]\r\nHttpVer:[HTTP::version]\r\nF5Addr: [IP::local_addr]\r\nClientIP:[IP::client_addr]\r\nTime:$now\r\nPort:$ClientPort\r\nServer:[LB::server addr]\r\n"
}
when CLIENT_ACCEPTED {
set applayer_hsl [HSL::open -proto UDP -pool hsl_8080_pool]
set ClientPort [TCP::local_port]
}
Remember HTTP:request only logs the request headers, not the payload (if there is one), and given that the default Max Header Size in an http profile is 32768, you are unlikely to exceed 64K.
- IheartF5_45022Nacreous
Take a look at [HTTP::request]. It dumps the whole request. It's by far the easiest way to get everything you might want to log, but the format isn't necessarily what the log trawlers want to see.....
- m_137079NimbostratusNice ! That makes things way simpler. I have a followup question IheartF5. I am using UDP for the HSL and UDP packet size is 64K max. (correct me if I am wrong). So if my http request is more than 64 K I will not get the whole data in one packet and UDP. What can be done in that scenario (I cannot use TCP) Thanks m@ve
- IheartF5_45022Nacreous
Remember HTTP:request only logs the request headers, not the payload (if there is one), and given that the default Max Header Size in an http profile is 32768, you are unlikely to exceed 64K.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com