Solved

Apache log file rotation

Posted on 2011-03-13
4
710 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
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). #…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

734 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