provider events: add support for omit_object_data search param

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-12-08 10:02:12 +01:00
parent 75d911f29e
commit a7f9581d99
11 changed files with 65 additions and 36 deletions

View File

@@ -167,9 +167,11 @@ func searchProviderEvents(w http.ResponseWriter, r *http.Request) {
return
}
filters.Role = getRoleFilterForEventSearch(r, claims.Role)
filters.OmitObjectData = getBoolQueryParam(r, "omit_object_data")
if getBoolQueryParam(r, "csv_export") {
filters.Limit = 100
filters.OmitObjectData = true
if err := exportProviderEvents(w, &filters); err != nil {
panic(http.ErrAbortHandler)
}
@@ -316,7 +318,7 @@ func (e *fsEvent) getCSVData() []string {
if e.FileSize > 0 {
fileSize = util.ByteCountIEC(e.FileSize)
}
return []string{timestamp.Format(time.RFC3339), e.Action, pathInfo.String(),
return []string{timestamp.Format(time.RFC3339Nano), e.Action, pathInfo.String(),
fileSize, status, e.Username, e.Protocol, e.IP, e.SSHCmd}
}
@@ -339,6 +341,6 @@ func (e *providerEvent) getCSVHeader() []string {
func (e *providerEvent) getCSVData() []string {
timestamp := time.Unix(0, e.Timestamp).UTC()
return []string{timestamp.Format(time.RFC3339), e.Action, e.ObjectType, e.ObjectName,
return []string{timestamp.Format(time.RFC3339Nano), e.Action, e.ObjectType, e.ObjectName,
e.Username, e.IP}
}