how to configure DA to keep 7 days' worth of log lines in all of our log files?

greentea

Verified User
Joined
Apr 23, 2005
Messages
26
Hi,

Is there any way we can configure DA to keep 7 days' worth of log lines in all of our log files, e.g. apache error log, instead of the default 1 day which is discarded everyday?

We would appreciate any sample code or scripts, if applicable.

Thank you in advance.
 
DirectAdmin rotates apache logs based on size. If the logs are going over that size in a one day period, then they will be rotated. Might want to check in Administrator settings.

It's also possible that logrotate was setup to rotate the apache logs everyday.
 
Hi,

We just checked our Administrator settings and it shows:

Max File Upload Size (bytes) 10485760
Apache Log Rotate Size (Megabytes) 5
Keep Number of Apache Log Backups 5

We checked admin.site-helper.com but the Administrator settings section said nothing about the above fields.

Could someone please explain what they are, what they do and what settings we should use to ensure that DA keeps 7 days' worth of log lines in all of our log files, e.g. apache error log, instead of the default 1 day which is discarded everyday?

Thank you in advance.
 
The first controls the max size (in bytes) of files that can be uploaded through the filemanager.

The second controls when apache logs are rotated. Currently they are rotated every 5mg. The size is checked and logs are rotated if needed when the tally is run every night.

And the last value controls the number of backlogs you want to keep. So for example, when a log is rotated it is renamed something like log.01 and then log is truncated and starts a new. Then log.01 becomes log.02 and log becomes log.01 and so on.
 
With the latest update logs are rotated daily, but I don't see where to control this.
 
I have not run accross it yet aswell. Might send DirectAdmin an email if they don't respond here or nobody else knows.
 
DA just got back to me. Daily log rotation is now forced. You can no longer set file size to rotate logs. You can set how many logs you want to keep. So to keep a week just set this to 7 in admin settings.
 
Ok, that's what I got from reading the features description but it just didn't seem like the direction DirectAdmin was heading on features lately (configurable).
 
Last edited:
Yeah I foud that strange indeed. I would rather have it this way then the way it was previously. It would be nice to specify day, week, month at least.
 
This new method is highly annoying. It screws up my nightly log processing [which can be rescheduled but that's not the point] and is just crazy as to how many files it creates in the domain's log directory...

I can only imagine what happens if I need to search for something. I much prefered having [usually] just one log per month.

I don't see any reason why this has to be forced on users.

At the very least I'd like to see them rotated into the same archive for the month instead of creating one for every day stored.
 
I'm noticing apache.logrotate in /usr/local/directadmin/data/templates

If this script is called when the nightly tally runs it may be possible to workaround this by keeping track of the number of times it had been executed and then execute when it meets the desired threshold.

I haven't tried this, but it could be a possibility.
 
Hello,

The logs directly in /var/log/httpd are controlled by logrotate.
The logs in /var/log/httpd/domains are controlled by DA.

The reason we had to switch to the nightly rotation is because webalizer requires that the logs not be actively written to while it's running. The only way to accomplish that efficiently (that we could see) is to rename the logs to *.log.1 quickly (all at once), and then issue an HUP to apache to reopen new *.log files, leaving the *.log.1 files as inactive and ready for webalizer to use. Doing it this way has it's advantages as well, for one, allowing webalizer to work as it was intented to (same things applies to tar, it doesn't like active logs while compressing). Secondly, by rotating daily, webalizer doesn't have to reprocess old log data over again which should speed up the nightly tally fairly substantially (webalizer uses up the majority of the resources during the tally due to all the parsing).


There are ways to work around the nightly tally, mainly by editing the httpd.conf templates to not use the path for the logs/errorlogs that DA is expecting, thus allowing you to do whatever you'd like to them (note that it would stop webalizer from showing correct stats). Another option would be to add a 2nd CustomLog line for your own logs, leaving DA's intact, and adding a 2nd log for your own purposes.

As ususal, suggestions are welcome. ;) (Just keep in mind the reason we did it)

John
 
At what hour is this logrotate process executed?

I need to execute my awstats over my apache logs before directadmin erases it...
 
Apache Logs

Ok.. Here's the suggestion.. Make the logging behavior an option. I have written a script and utilize an off-box solution (weblog expert) because it provides fantastic stats for my customers..

However, the new config kills me.. WebLog Expert does not keep history, but did utilize the compressed logs. Also, the # of logs retained kills me on sites that have more than 5 subdomains..

Since it is administrative, give us the option on webalizer friendly (new way) or the old way. Until then, I have nuked the logrotate.d/apache.conf file and am setting retention to 500 to protect the historical data that some of my sites need that is now gone due to the new rotation configuration.
 
uhm, how do i keep a week of logs as backup
Mine get rotated every 4 hours, so now i only have 5x4hours = 20 hours of logs

-rw-r--r-- 1 root root 152474 Jun 7 00:11 Jun-2005.1.tar.gz
-rw-r--r-- 1 root root 21954 Jun 7 04:10 Jun-2005.2.tar.gz
-rw-r--r-- 1 root root 13096 Jun 7 08:11 Jun-2005.3.tar.gz
-rw-r--r-- 1 root root 84259 Jun 7 12:10 Jun-2005.4.tar.gz
-rw-r--r-- 1 root root 110870 Jun 6 20:11 Jun-2005.tar.gz
 
Re: Apache Logs

davidb said:

Since it is administrative, give us the option on webalizer friendly (new way) or the old way. Until then, I have nuked the logrotate.d/apache.conf file and am setting retention to 500 to protect the historical data that some of my sites need that is now gone due to the new rotation configuration.

what did you change?
 
DirectAdmin Support said:
The reason we had to switch to the nightly rotation is because webalizer requires that the logs not be actively written to while it's running.
Where we can read about that?
There are many control panels using webalizer, but at least 2 of them - CPanel and ISPmanager, doesn't seem to perform daily rotation and doesn't seem to have any problems with that, AFAIK.

So now, we have no way to switch back to rotation scheme used in previous DA versions? There is only two options now:
1) Use daily rotation by DA (rotation=1)
or
2) "make your own script to rotate by size or monthly and to put archives to domain's /stats/ directory" (rotation=0)
Is that so?

(So, in my opinion, that "feature" in v1.24 only made DA worse...)
 
log file rotation suggestion

for legal reasons it is really terrible to remove logs on a daily basis especially for an ecommerce site. My suggestion is to rotate daily as you do now but to append the day's logs to a "master backup log file" and that is the file which you control through the Administrator in terms of "true rotation". this way users can download a month of activity or a week of activity and then wipe out the backup any time. plus if people are using directadmin to charge for hosting it gives them additional revenue for storing log files.
 
Current Status of loggin

What is the current status of the logging options? I am trying to improve my process and want to get clarification on the current frequency and how they are maintained (subdomains, etc). Also, is there an easy way to retrofit all of the users httpd.conf files with a second logging option line?
 
Back
Top