Add initial niaeve implementation of SFTP logging

This will end up flooding the activity logs due to the way SFTP works, we'll need to have an intermediate step in Wings that batches events every 10 seconds or so and submits them as a single "event" for activity.
This commit is contained in:
DaneEveritt
2022-07-09 19:37:39 -04:00
parent 204a4375fc
commit 59fbd2bcea
6 changed files with 93 additions and 33 deletions

View File

@@ -18,6 +18,7 @@ func processActivityLogs(m *server.Manager, c int64) error {
// Don't execute this cron if there is currently one running. Once this task is completed
// go ahead and mark it as no longer running.
if !processing.SwapIf(true) {
log.WithField("subsystem", "cron").Warn("cron: process overlap detected, skipping this run")
return nil
}
defer processing.Store(false)

View File

@@ -26,7 +26,7 @@ func Scheduler(m *server.Manager) (*gocron.Scheduler, error) {
}
s := gocron.NewScheduler(l)
_, _ = s.Tag("activity").Every(config.Get().System.ActivitySendInterval).Seconds().Do(func() {
_, _ = s.Tag("activity").Every(int(config.Get().System.ActivitySendInterval)).Seconds().Do(func() {
if err := processActivityLogs(m, config.Get().System.ActivitySendCount); err != nil {
log.WithField("error", err).Error("cron: failed to process activity events")
}