add more logging to antivirus

This commit is contained in:
Michael Barz
2023-04-04 09:20:56 +02:00
parent ef27b7695a
commit 6dde3f6ef6
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
Enhancement: Add more logging to av service
We need more debug logging in some situations to understand the state of a virus scan.
https://github.com/owncloud/ocis/pull/5973
@@ -102,6 +102,7 @@ func (av Antivirus) Run() error {
continue
}
av.l.Info().Str("uploadid", ev.UploadID).Str("filename", ev.Filename).Msg("Starting virus scan.")
var errmsg string
res, err := av.process(ev)
if err != nil {
@@ -144,6 +145,7 @@ func (av Antivirus) Run() error {
// process the scan
func (av Antivirus) process(ev events.StartPostprocessingStep) (scanners.ScanResult, error) {
if ev.Filesize == 0 || (0 < av.m && av.m < ev.Filesize) {
av.l.Debug().Str("uploadid", ev.UploadID).Uint64("limit", av.m).Uint64("filesize", ev.Filesize).Msg("Skipping file because file size is higher than the limit.")
return scanners.ScanResult{
Scantime: time.Now(),
}, nil
@@ -163,6 +165,7 @@ func (av Antivirus) process(ev events.StartPostprocessingStep) (scanners.ScanRes
return scanners.ScanResult{}, err
}
defer rrc.Close()
av.l.Debug().Str("uploadid", ev.UploadID).Msg("Downloaded file successfully.")
res, err := av.s.Scan(rrc)
if err != nil {