mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-24 20:18:13 +02:00
proxy: add support for logging http request headers (#4388)
* config: add customization options for logging * config: validate log fields * proxy: add support for logging http request headers * log subset of headers * fix test name * dont use log.HTTPHeaders for access logs * canonicalize http/2 headers
This commit is contained in:
parent
4698e4661a
commit
638d9f3d6c
11 changed files with 172 additions and 13 deletions
|
@ -32,9 +32,15 @@ func (srv *Server) StreamAccessLogs(stream envoy_service_accesslog_v3.AccessLogS
|
|||
evt = log.Info(stream.Context())
|
||||
}
|
||||
evt = evt.Str("service", "envoy")
|
||||
for _, field := range srv.currentConfig.Load().Config.Options.GetAccessLogFields() {
|
||||
|
||||
fields := srv.currentConfig.Load().Config.Options.GetAccessLogFields()
|
||||
for _, field := range fields {
|
||||
evt = populateLogEvent(field, evt, entry)
|
||||
}
|
||||
// headers are selected in the envoy access logs config, so we can log all of them here
|
||||
if len(entry.GetRequest().GetRequestHeaders()) > 0 {
|
||||
evt = evt.Interface("headers", entry.GetRequest().GetRequestHeaders())
|
||||
}
|
||||
evt.Msg("http-request")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue