Skip to content

Commit

Permalink
[Logfile] Clean up state folder on init (#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
lisguo authored Apr 11, 2024
1 parent b88e6ae commit df56c0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/inputs/logfile/logfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ func (t *LogFile) Start(acc telegraf.Accumulator) error {
return fmt.Errorf("failed to create state file directory %s: %v", t.FileStateFolder, err)
}

// Clean state file regularly
// Clean state file on init and regularly
go func() {
t.cleanupStateFolder()
ticker := time.NewTicker(1 * time.Hour)
defer ticker.Stop()
for {
Expand Down

0 comments on commit df56c0e

Please sign in to comment.