Solved

Apache log file rotation

Posted on 2011-03-13
4
704 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now