mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
logging user-agent in audit
This commit is contained in:
parent
84ec43c75b
commit
d066d547cc
@ -99,6 +99,10 @@ type Event struct {
|
|||||||
// Source IPs, from where the request originated and intermediate proxies.
|
// Source IPs, from where the request originated and intermediate proxies.
|
||||||
// +optional
|
// +optional
|
||||||
SourceIPs []string
|
SourceIPs []string
|
||||||
|
// UserAgent is an optional field that specifies the caller of this request.
|
||||||
|
// Note that the UserAgent is provided by the client, and must not be trusted.
|
||||||
|
// +optional
|
||||||
|
UserAgent string
|
||||||
// Object reference this request is targeted at.
|
// Object reference this request is targeted at.
|
||||||
// Does not apply for List-type requests, or non-resource requests.
|
// Does not apply for List-type requests, or non-resource requests.
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -105,6 +105,10 @@ type Event struct {
|
|||||||
// Source IPs, from where the request originated and intermediate proxies.
|
// Source IPs, from where the request originated and intermediate proxies.
|
||||||
// +optional
|
// +optional
|
||||||
SourceIPs []string `json:"sourceIPs,omitempty" protobuf:"bytes,10,rep,name=sourceIPs"`
|
SourceIPs []string `json:"sourceIPs,omitempty" protobuf:"bytes,10,rep,name=sourceIPs"`
|
||||||
|
// UserAgent is an optional field that specifies the caller of this request.
|
||||||
|
// Note that the UserAgent is provided by the client, and must not be trusted.
|
||||||
|
// +optional
|
||||||
|
UserAgent string `json:"userAgent,omitempty" protobuf:"bytes,18,opt,name=userAgent"`
|
||||||
// Object reference this request is targeted at.
|
// Object reference this request is targeted at.
|
||||||
// Does not apply for List-type requests, or non-resource requests.
|
// Does not apply for List-type requests, or non-resource requests.
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -101,6 +101,10 @@ type Event struct {
|
|||||||
// Source IPs, from where the request originated and intermediate proxies.
|
// Source IPs, from where the request originated and intermediate proxies.
|
||||||
// +optional
|
// +optional
|
||||||
SourceIPs []string `json:"sourceIPs,omitempty" protobuf:"bytes,10,rep,name=sourceIPs"`
|
SourceIPs []string `json:"sourceIPs,omitempty" protobuf:"bytes,10,rep,name=sourceIPs"`
|
||||||
|
// UserAgent is an optional field that specifies the caller of this request.
|
||||||
|
// Note that the UserAgent is provided by the client, and must not be trusted.
|
||||||
|
// +optional
|
||||||
|
UserAgent string `json:"userAgent,omitempty" protobuf:"bytes,18,opt,name=userAgent"`
|
||||||
// Object reference this request is targeted at.
|
// Object reference this request is targeted at.
|
||||||
// Does not apply for List-type requests, or non-resource requests.
|
// Does not apply for List-type requests, or non-resource requests.
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -42,6 +42,7 @@ func NewEventFromRequest(req *http.Request, level auditinternal.Level, attribs a
|
|||||||
RequestReceivedTimestamp: metav1.NewMicroTime(time.Now()),
|
RequestReceivedTimestamp: metav1.NewMicroTime(time.Now()),
|
||||||
Verb: attribs.GetVerb(),
|
Verb: attribs.GetVerb(),
|
||||||
RequestURI: req.URL.RequestURI(),
|
RequestURI: req.URL.RequestURI(),
|
||||||
|
UserAgent: req.UserAgent(),
|
||||||
}
|
}
|
||||||
|
|
||||||
ev.Level = level
|
ev.Level = level
|
||||||
|
Loading…
Reference in New Issue
Block a user