Linux – How does one keep a file’s timestamp (date modified) after a logrotate

linuxlogrotatetimestamp

Title says it all, I have a log rotate set up daily for some rather large log files. Sometimes we can generate 3 of these a day, sometimes we only generate 1, they're each about 500MB. Is there a way to keep date modified of the file after a log rotate? It's a lot easier to note those dates at a glance when looking for something in the logs, than to head and tail each file looking for dates.

Best Answer

You can configure log rotate to append the date to rotated log files (by specifying dateext option).

Related Topic