Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I run 30+ sites out of my dedicated server (running CentOS). Some of these are subdomains. I currently use this pattern as a log file naming convention, in /etc/httpd/logs:



Is this best practice? Is there anything I could do to improve naming my log files?

share|improve this question

2 Answers 2

The naming of files is just to your personally taste however from what I can tell in your filenames your not using a rotate and therefor I'd imagine that your logs are rather large and hard to shift though.

You should look at using a rotate by X hours, or days which then changes the labeling of your filenames with the date on the front or end of the filenames.

A typical example would look something like this

LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
ErrorLog "|/usr/sbin/rotatelogs -l /etc/httpd/logs/error_log.%Y-%m-%d-%H 3600"
CustomLog "|/usr/sbin/rotatelogs -l /etc/httpd/logs/access_log.%Y-%m-%d-%H 3600" combined

So personally I'd use:


Which will look like:


Or you could simply have your logs rotate every 24 hours with just the day using

 CustomLog "|/usr/sbin/rotatelogs -l /etc/httpd/logs/access_log.%d"


Using the above just makes it easier to administrate and source problems faster, but again file-naming is down to personal taste and realistically there is no better answer than your own :P

To find out more about rotating logs check out: rotatelogs

share|improve this answer
They are rotated by a cron job. –  Kenzo Jan 31 '13 at 4:54

For nicer sorting, you could start with the TLD, followed by second-level, followed by third-level, etc.:


This way all subdomains of a specific domain are "grouped" together.

share|improve this answer
Actually, while that would be totally unhelpful in my case, it got me thinking of a way to sort that would be helpful. Thanks! –  Kenzo Dec 27 '13 at 20:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.