Server Access Log
Since v0.7 To manage aah server effectively it is necessary to know details about the request, response, processing time, client IP address, etc. aah provides the flexible and configurable server access log capabilities.
Access log processing handled in separate goroutine, it won’t stand in way.
Table of Contents
Supported Access Log flag
Log Flag | Description |
---|---|
clientip | Client IP address aka Remote IP address |
reqtime | Time of the request is received by server. Local time in default format RFC3339 or you can provide your format |
requrl | Relative request URL not including query string |
reqmethod | Request HTTP method |
reqproto | Request Protocol. For e.g: HTTP/1.1 , HTTP/2.0 |
reqid | Request ID if present otherwise value - is logged. Refer to config request.id.header in the aah.conf |
reqhdr:<header_name> | Request header, if present otherwise value - is logged |
querystr | Request query string if present otherwise value - is logged |
resstatus | Response Status Code |
ressize | Bytes sent, excluding response HTTP headers, otherwise value - is logged; if no bytes were sent |
reshdr:<header_name> | Response header, if present otherwise value - is logged |
restime | Request processing time in milliseconds . The time elapsed between the request received by server and the last bytes were written on the wire by server |
custom | Add non-space string into log string |
Default access log pattern
Sample Server Access Log of default pattern
::1 - 2017-07-21T14:56:15-07:00 GET / HTTP/2.0 200 12735 0.7020 "https://aahframework.org/"
::1 - 2017-07-21T14:56:15-07:00 GET /assets/css/aah-f2f8e6e.css HTTP/2.0 200 7408 0.3377 "https://aahframework.org/"
::1 - 2017-07-21T14:56:15-07:00 GET /assets/js/aah-f2f8e6e.js HTTP/2.0 200 522 0.2688 "https://aahframework.org/"
::1 - 2017-07-21T14:56:15-07:00 GET /assets/css/bootstrap.min.css HTTP/2.0 200 125523 4.1035 "https://aahframework.org/"
::1 - 2017-07-21T14:56:15-07:00 GET /assets/img/aah-logo-64x64.png HTTP/2.0 200 2404 0.2033 "https://aahframework.org/"
::1 - 2017-07-21T14:56:15-07:00 GET /assets/js/ie10-viewport-bug-workaround.js HTTP/2.0 200 651 0.2062 "https://aahframework.org/"
::1 - 2017-07-21T14:56:15-07:00 GET /assets/fonts/timeburnerbold.ttf HTTP/2.0 200 78170 1.4987 "https://aahframework.org/assets/css/aah-f2f8e6e.css"
Access Log Configuration
access_log { ... }
configuration goes under config section server { ... }
in the aah.conf
..
Examples
Added respective flag into pattern config.