0

I need Apache accesslog file to be parsed fast in realtime and always to keep only last 3 months data. So I need tool which everyday cutting old records(and moving them to another file) from log file while keeping same filename for main access_log.

Is it possible with logrotate?

Thanks!

Whity.

0

Sure, you can do it with logrotate, something like this:

/var/log/httpd/access_log {
    missingok
    notifempty
    sharedscripts
    daily
    rotate 90
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
    compress
}
0

I don't know the purposes, but as I guess it would be a better way to use mod_log_sql for access logging. It stores access information into a database table, by inserting a record for each request. Then this table can be queried to obtain the desired information from the access log which is a much faster way than parsing a text file. Hence it will result in a faster log processing, without lack of deleting or moving information from one place to another.

  • I need it for awstats to show only last 3 month of data. One of its plugin very slow when parsing long log files. – Boris Ivanov Oct 19 '11 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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