Solved

Apache log file rotation

Posted on 2011-03-13
4
708 Views
Last Modified: 2012-05-11
Hi

I need to rotate logs on my apache webserver once every day. I am not a big CentOS user, so followed the examples in the docs for piped logs, but started to receive an error because bin/rotatelogs did not exist. It said that it was included in the distro, but not on mine!

We used this line in the httpd.conf, after following the docs:
CustomLog "|bin/rotatelogs /var/log/httpd/access_log.%Y-%m-%d 86400" combined

Open in new window


Can anyone help me resolve this - I am happy to use another solution to rotate logs, but you must include step by step instructions for installation.

The must have factor in this is the files must be identifiable by date in the file name. We use them to parse stats on a monthly basis.

Thanks!
0
Comment
Question by:mmc98dl1
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 250 total points
ID: 35120343
0
 
LVL 12

Author Comment

by:mmc98dl1
ID: 35126675
ok so that seems to be a good tool.

It doesnt describe how I can make the resulting file name show a date, it only states how I can get a .x to signify the number in the rotation.

I need a file name like yyyy-mm-dd.log

How would I do this?
0
 
LVL 12

Author Closing Comment

by:mmc98dl1
ID: 35127065
I noted further to this that a flag of dateext exists, and this creates the file with yyyymmdd - just what I need.

man logrotate was really helpful

Thanks for the lead
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 35127231
Welcome
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question