Forum Discussion
Mazen2006_14317
Nimbostratus
Feb 17, 2014iRule to log HTTP request as Apache combined standard format
Hello,
I need to log HTTP request and response as Apache combined standard format like this:
LogFormat "%h %{X-ReqTime}o %D %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined ...
Mazen2006_14317
Nimbostratus
Mar 18, 2014Hello,
I discover that we loose some logs using the log local0. command. it seems due to the UDP protocol. I need to send log to syslog by TCP. I update my irule by using the HSL command. Can i specify the source IP from which the syslog receives the logs? What is the default source IP when nothing is precised?
when HTTP_REQUEST { set host [HTTP::host]
set username [HTTP::username]
set client_IP [IP::client_addr]
set request "\"[HTTP::method] [HTTP::uri] HTTP/[HTTP::version]\""
set request_time [clock clicks -milliseconds]
set referer [HTTP::header "Referer"]
set ua [HTTP::header "User-Agent"]
set xff [HTTP::header "X-Forwarded-For"]
}
when HTTP_RESPONSE {
set response_time [expr [clock clicks -milliseconds] - $request_time]
set now [clock format [clock seconds] -format "%d/%b/%Y:%H:%M:%S %z"]
set contentlength [HTTP::header "Content-Length"]
set status [HTTP::status]
HSL::send [HSL::open -proto TCP -pool /CLI01_COPR/POOL_SYSLOG] "$host $client_IP $username $now $request $status $contentlength \"$referer\" \"$ua\" \"$xff\" $response_time"
}
This irule is used by the VS whith the address 172.19.143.2%201:81. POOL_SYSLOG has one member, the node: 10.100.100.13:514.
Please help!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
