leading zeros for hourly access logs

jrmarino

Well-Known Member
#1
I know this is a small thing, but can you use leading zeros for the hour part of the filename for access logs? Here's a recent example of mine:

Code:
access.log.2007_08_15.2
access.log.2007_08_15.20
access.log.2007_08_15.21
access.log.2007_08_15.22
access.log.2007_08_15.23
access.log.2007_08_15.3
access.log.2007_08_15.4
access.log.2007_08_15.5
access.log.2007_08_15.6

I would like the filenames to be this instead:
Code:
access.log.2007_08_15.02
access.log.2007_08_15.03
access.log.2007_08_15.04
access.log.2007_08_15.05
access.log.2007_08_15.06
...
access.log.2007_08_15.20
access.log.2007_08_15.21
access.log.2007_08_15.22
access.log.2007_08_15.23
The reason should be obvious. The files are not sorted in order if you don't use leading zeros for the hour. Note that you do correctly use leading zeros for the month and day, so if nothing else: be consistent.

Thanks for listening.
 
Top