Make sure to update the mtime of a logfile after archiving it. This
ensures that the next rotation happens at the correct time when using interval-based rotations. PR: bin/174438 Reviewed by: gad Approved by: rstone (co-mentor) MFC after: 1 week
This commit is contained in:
parent
468d206524
commit
9df22a6e88
@ -1814,12 +1814,21 @@ do_rotate(const struct conf_entry *ent)
|
||||
printf("\tcp %s %s\n", ent->log, file1);
|
||||
else
|
||||
printf("\tln %s %s\n", ent->log, file1);
|
||||
printf("\ttouch %s\t\t"
|
||||
"# Update mtime for 'when'-interval processing\n",
|
||||
file1);
|
||||
} else {
|
||||
if (!(flags & CE_BINARY)) {
|
||||
/* Report the trimming to the old log */
|
||||
log_trim(ent->log, ent);
|
||||
}
|
||||
savelog(ent->log, file1);
|
||||
/*
|
||||
* Interval-based rotations are done using the mtime of
|
||||
* the most recently archived log, so make sure it gets
|
||||
* updated during a rotation.
|
||||
*/
|
||||
utimes(file1, NULL);
|
||||
}
|
||||
change_attrs(file1, ent);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user