from small one page howto to huge articles all in one place
 

search text in:





Poll
What does your sytem tell when running "ulimit -u"?








poll results



Last additions:
Disable Anti-Aliasing fonts

Disable Anti-Aliasing fonts

words:

186

views:

5441

userrating:

no votes yet


May 25th. 2007:
Words

491

Views

6270

why adblockers are bad


handy one-liners for sed (Unix stream editor)
Tutorial:

handy one-liners for sed (Unix stream editor)

words:

4078

views:

17889

userrating:

no votes yet


rotating apache logfiles with cronolog

rotating apache logfiles with cronolog

words:

294

views:

6725

userrating:

no votes yet


Druckversion . pdf icon
You are here: System

rotating apache logfiles with cronolog

When your webserver has a couple of hits per day your logfile will increase to a limit when it becomes difficult to handle.

You can use a lot of ways to rotate your logfile automatically.

One of this possibilities is cronolog.

First, you have to install cronolog with the install tool for your distribution, which is quite painless.

Now you have to configure the apache logfile. Normally you already have a line like

CustomLog /some/path/transfer.log" combined
all you have to do is change the line to a line similar to this:
CustomLog "|/path/to/cronolog /some/path/transfer-%Y-%m-%d.log" combined
This would create a logfile for each day in the given path. A description of the % template is at the website for cronolog.

The files will be named after the template you give, if you want to have somewhere else or a different template for the filename, adjust it to your liking.

there is just one problem...

Normally you have a program to generate stats from your logfile. Now they are unable to find the logfile, because the name changes every once in a while.

But luckily, the cronolog has the feature to create a symlink to the current logfile. That way there is a static filename to the most recent log file.

Just make sure, you run the stats tool before the log gets rotated.

But you will loose the info between the last run and the new logfile. This can be corrected if you run the stats tool after the rotation on the last logfile once.

cronolog does provide a symlink there, too.

CustomLog "|/usr/sbin/cronolog -S /some/path/transfer.log -P /some/path/transfer.log.old
/some/path/transfer-%Y-%m-%d.log" combined
(line splitted for readability, it is one line)

All you have to change is the crontab for your stats tool to normally use the transfer.log and run once after the rotation on transfer.log.old<

an example for awstats:

/path/to/awstats.pl -config=www.yourdomain.com -logfile /some/path/transfer.log.old


rate this article:
current rating: no votes yet
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back
comment this article
Please read "Why adblockers are bad". Ärger mit Freenet.de



to the forum.
:
:
other Ads
Stellenangebote
Stellenangebote
für Fach- und
Führungskräfte
www.nachoben.com
Other free services
toURL.org
Shorten long
URLs to short
links like
http://tourl.org/2
tourl.org
.
FeedCollector
Combine various newsfeeds to one customized webpage
www.feedcollector.org
.
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
www.reversednslookup.org
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004 S&P Softwaredesign
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 12.8 ms
system status display