Where to store apache log files?

13 posts / 0 new
Last post
#1 Thu, 03/03/2011 - 08:55
samsagaz

Where to store apache log files?

Hi guys, i really dont know if will be better to store apache VirtualServer log files inside the home directory or inside /var/log/virtualmin/ will be better?

if store inside Home this will use user quota its ok?

Thanks in advance

Thu, 03/03/2011 - 09:36
andreychek

Howdy,

Both would use the user quota. When stored in /var/log/virtualmin, the files are still owned as the Virtual Server owner.

I haven't seen any problems with the log files when a user hits their quota... while I don't know for certain, I suspect Apache just stops logging until space is freed up.

-Eric

Thu, 03/03/2011 - 09:49
samsagaz

Oh, ok, thanks!

so is the same if store it into /var/log or /home... i think that /home is better for me because the slice are bigger in /home

what do you think? something bad if store in /home?

Thu, 03/03/2011 - 09:57
andreychek

I would suggest using the defaults, which are to put the logs in /var/log/virtualmin.

In there, it's not possible for the user to accidentally delete or rename the logs directory, which can cause all sorts of trouble :-)

However, they'll still have symlinks to their logfiles in $HOME/logs/, so it remains easy for the user to access their logs.

-Eric

Fri, 04/15/2011 - 09:21
Murz

If we store logs in /var/log/virtualmin with symlinks in home folder, users can't view and copy those files via proftp session, they see only small symlink file. How I can solve this problem?

Fri, 04/15/2011 - 12:13
andreychek

Well, what's in $HOME/logs/ is indeed a symlink.

And if you have directory limits set to prevent FTP users from browsing outside their home directories, I believe that would prevent the FTP user from retrieving files symlink'd to outside files.

The only ways to change that behavior would be:

  1. Turn off the setting that restricts users to their home directory

  2. Move the Apache logs into the users home directory.

    -Eric

Fri, 04/15/2011 - 14:53
andreychek

How I can change this settings in virtualmin for store logs in home directory?

Well, remember that your users can access the Apache logs from the Virtualmin interface, in the "Logs and Reports" section on the left.

However, if you want Virtualmin to put it's logs in the user's home directory, and not in /var/log/virtualmin... you can do that, but it's not a trivial change :-)

In System Settings -> Server Templates -> Apache Website, you have to edit the ErrorLog and CustomLog directives in "Directives and settings for new websites", and change them to point to the home directory. It would look something like this:

ErrorLog ${HOME}/logs/error_log
CustomLog ${HOME}/logs/access_log combined

Then, you'd want to set "Write logs via program" to "Yes", since without that, if the user does something to accidentally delete the logs directory, it'd prevent Apache from starting up.

That only changes things for new Virtual Servers, you now have to go make updates for your existing domains.

To do that that, you'd need to edit the existing Apache VirtualHosts config files, and change their config info to use /home for the logging.

Then, you'd need to edit /etc/logrotate.conf, and make sure it's rotating the correct logs.

Once you have all that configured -- you'd then want to run "virtualmin enable-writelogs --all-domains" to make sure it's using the writelogs program to writing to the logs.

Rather than doing all that, I highly recommend having your users just use the Virtualmin interface for viewing logs. But, if you really want it to be accessible via FTP, it can certainly be done.

-Eric

Mon, 04/18/2011 - 01:16
Murz

I didn't give for each user access to virtualmin interface, only ftp&mysql. And on most of other hostings log files always located in home directories, so users are accustomed to this.

Thank's for the instruction how to do this!

I successfully change apache conf files, but can't find the "Write logs via program" item in configuration pages, where it is located? And how writing logs via virtualmin wrapper affect the performance of system?

And question about symlinks - if logs located in /var/log/virtualmin, some script creates symlinks to them from home folder, if I create files in home folder, it will works correctly, without errors on creating symlinks?

Mon, 04/18/2011 - 08:52
andreychek

The "Write Logs Via Program" options is the third option I see on the Apache Website Server Template. It's below "Automatically add appropriate SuExec directive" and above "Add Apache user to Unix group for new servers".

If you don't see it, it may mean it's not a feature available in the GPL version of Virtualmin.

This will all still work without it though, it just means that you need to make sure your FTP users don't go deleting or renaming the "logs" directories :-)

if I create files in home folder, it will works correctly, without errors on creating symlinks?

To be honest with you, no one has ever wanted to move the logs back into the home dir, so I'm not sure :-)

I think that's how it'll work... that Virtualmin will simply detect that the location of the logfiles is in the homedir, and there's no need to make symlinks.

Though, that would only happen for new domains... for your existing domains, you'd need to first delete those symlinks.

-Eric

Thu, 04/21/2011 - 05:06
Murz

If you don't see it, it may mean it's not a feature available in the GPL version of Virtualmin.

Yes, I use GPL and it miss, here is the screenshot: http://wstaw.org/m/2011/04/20/plasma-desktopYN7180.jpg

To be honest with you, no one has ever wanted to move the logs back into the home dir, so I'm not sure :-)

Many of our users asks access to log files via ftp, they want download full files, so I do the changes as you describe and all works normally after changes. Thanks!

Thu, 04/21/2011 - 10:03
andreychek

One other idea is that if this is a Sub-Server template, that feature apparently isn't in there... that feature is only available in the main Server Templates.

But, if you're looking in the main server templates and you aren't seeing it... then yeah, it may be a Pro-only feature.

I'm glad to hear that setup is working for you now though!

-Eric

Tue, 12/11/2012 - 01:46
nibb

So why is this not listed in the comparison page of GLP vs Pro?

Im finding now that there are hidding features which are not there, and its seems its because they are only available in the Pro. Nothing wrong with that, but instead of making users search why something is not there it should be listed here: http://www.virtualmin.com/compare.html

I also need to store logs in the home directories. So I guess this can be done with the GLP version correct because you need to enable this check?

I mean from the GUI, I guess you can always enable it on Apache itself.

What happens if you enable this on a Pro version and then move the account to GLP edition?

Tue, 12/11/2012 - 03:18
helpmin

Actually it would be a great feature to have an option to place/move the logs to the home folder :-)

Topic locked