Custom Apache-style logging for Java-based applications
Problem this snippet solves: I had a requirement to have the F5 BigIP produce logs which replicated our current custom Apache Logs. The Apache custom log format was:
CustomLog /../apache/logs/ssl_...
Published Mar 17, 2015
Version 1.0jkstraw_44238
Nimbostratus
Joined March 07, 2007
jkstraw_44238
Nimbostratus
Joined March 07, 2007
gotran
Mar 21, 2017Nimbostratus
You missed a backslash in line 10.
when HTTP_REQUEST {
set http_request_time [clock clicks -milliseconds]
set request_log_line "\
[HTTP::request_num],\
[IP::remote_addr],\
[HTTP::method],\
[HTTP::version],\
[HTTP::host],\
\"[HTTP::uri]\",\
\"[HTTP::header value Referer]\",\
\"[HTTP::header User-Agent]\",\
\"[HTTP::cookie value JSESSIONID]\",\
[SSL::cipher name],\
[SSL::cipher version],\
[SSL::cipher bits]"
}
when HTTP_RESPONSE {
set http_response_time [ clock clicks -milliseconds ]
log local0. "$request_log_line,\
[HTTP::status],\
[HTTP::payload length],\
[expr $http_response_time - $http_request_time]"
}
Another option is to send the log to a remote syslog changing this line
log local0. "$request_log_line,\
to
log local0.info "$request_log_line,\