fix: minor bugs and tweak log rotation history to 14 days

This commit is contained in:
garethgeorge
2024-05-05 12:54:46 -07:00
parent b6c258c921
commit ad9a77029c
4 changed files with 5 additions and 5 deletions

View File

@@ -76,7 +76,7 @@ func main() {
defer oplog.Close()
// Create rotating log storage
logStore := rotatinglog.NewRotatingLog(path.Join(config.DataDir(), "rotatinglogs"), 30) // 30 days of logs
logStore := rotatinglog.NewRotatingLog(path.Join(config.DataDir(), "rotatinglogs"), 14) // 14 days of logs
if err != nil {
zap.S().Fatalf("error creating rotating log storage: %v", err)
}

View File

@@ -95,7 +95,7 @@ func (o *OpLog) Scan(onIncomplete func(op *v1.Operation)) error {
if lastValidated := sysBucket.Get([]byte("last_validated")); lastValidated != nil {
c.Seek(lastValidated)
}
for k, v := c.Next(); k != nil; k, v = c.Next() {
for k, v := c.Prev(); k != nil; k, v = c.Next() {
op := &v1.Operation{}
if err := proto.Unmarshal(v, op); err != nil {
zap.L().Error("error unmarshalling operation, there may be corruption in the oplog", zap.Error(err))

View File

@@ -142,9 +142,9 @@ func useLegacyCompatMode(oplog *oplog.OpLog, planID string) (bool, error) {
}
delete(instanceIDs, "")
if len(instanceIDs) > 1 {
zap.L().Warn("found mixed instance IDs in indexed snapshots, forcing forget to use new behavior (e.g. --tags including instance ID) despite the presence of legacy (e.g. untagged) snapshots.")
zap.L().Warn("found mixed instance IDs in indexed snapshots, overriding legacy forget behavior to include instance ID tags. This may result in unexpected behavior -- please inspect the tags on your snapshots.")
return false, nil
}
zap.L().Warn("found legacy snapshots without instance ID, forget will use legacy behavior e.g. --tags not including instance ID")
zap.L().Warn("found legacy snapshots without instance ID, recommending legacy forget behavior.")
return true, nil
}

View File

@@ -24,7 +24,7 @@ func ValidateOperation(op *v1.Operation) error {
return errors.New("operation.plan_id is required")
}
if op.InstanceId == "" {
zap.L().Warn("operation.instance_id should typically be set", zap.Any("operation", op))
zap.L().Warn("operation.instance_id should typically be set")
}
if op.SnapshotId != "" {
if err := restic.ValidateSnapshotId(op.SnapshotId); err != nil {