place apache logs in /var/logs

19 posts / 0 new
Last post
#1 Mon, 06/23/2008 - 21:34
ScOut3R

place apache logs in /var/logs

Hey There,

i'd like to change where apache logs for the hosted domains. I' set up the relevant part of server template like this: [code:1]ErrorLog /var/log/hosting/${DOM}/logs/error_log CustomLog /var/log/hosting/${DOM}/logs/access_log combined[/code:1]

but when i try to create a virtual server apache complains that this is a bad file descriptor. /var/log/hosting is there.

Sun, 06/07/2009 - 07:25
Joe
Joe's picture

But the ${DOM} subdirectory isn't. I guess you could create it using a "Command to run before" (found in the Module Configuration under "Actions upon server and user creation").

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:25
Joe
Joe's picture

But the ${DOM} subdirectory isn't. I guess you could create it using a "Command to run before" (found in the Module Configuration under "Actions upon server and user creation").

--

Check out the forum guidelines!

Mon, 06/23/2008 - 22:23
Joe
Joe's picture

Oh, yeah, note that the ENV variables are slightly different in commands called outside of Virtualmin--click on any of the options to see the substitution format. You'd want $VIRTUALSERVER_DOM:

mkdir /var/log/hosting/$VIRTUALSERVER_DOM

But I should also warn you that none of the other tools are going to have any clue where this stuff is. Webalizer, AWstats, etc. You probably really don't want to do this. Backups also won't know about your change.

What do you gain by having logs outside of /home?

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:25
Joe
Joe's picture

But the ${DOM} subdirectory isn't. I guess you could create it using a "Command to run before" (found in the Module Configuration under "Actions upon server and user creation").

--

Check out the forum guidelines!

Tue, 06/24/2008 - 09:15
ScOut3R

At least log rotation noticed this. :)

I dont want to include logs in the domain quota.
Are there other ways to do this?

Tue, 06/24/2008 - 10:26 (Reply to #6)
Joe
Joe's picture

<div class='quote'>At least log rotation noticed this.</div>

Hmm...If that's the case, then maybe Jamie made it a lot smarter than I expected (I believe log rotation is configured in the same way that the other stuff is--so maybe Virtualmin <i>does</i> notice the change...that'd be pretty slick, but I think I'd still be surprised if it is working that way!).

Anyway, I can't think of a good way to go about getting them outside of the scope of quotas. Most people struggle to figure out ways to make sure everything <i>is</i> covered by quotas, and not vice-versa! A symbolic link might do it, but that'd also probably be tricky. Might be worth a try--at least then you can be reasonably confident that everything is going to work as usual, but the actual data will be stored on the other partition.

--

Check out the forum guidelines!

Wed, 06/25/2008 - 04:52 (Reply to #7)
sgrayban

If the log file is owned by the same user quota is still enforced. Read the man pages about quota.

Wed, 06/25/2008 - 14:39 (Reply to #8)
Joe
Joe's picture

<div class='quote'>If the log file is owned by the same user quota is still enforced.</div>

I'm assuming it's on a different partition, which takes it out of control of quotas. We do this trick for Dovecot index/control files, now, in a default install...if the /var/lib/dovecot directory is on a different partition from home, Virtualmin will setup those files to live there (which makes it impossible for the mailbox to become inaccessible due to quota being reached).

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:25
Joe
Joe's picture

But the ${DOM} subdirectory isn't. I guess you could create it using a &quot;Command to run before&quot; (found in the Module Configuration under &quot;Actions upon server and user creation&quot;).

--

Check out the forum guidelines!

Thu, 06/26/2008 - 08:32
ScOut3R

Is there a way to make this from the Apache template?

Mon, 06/30/2008 - 09:40
ScOut3R

mkdir /var/log/hosting/$VIRTUALSERVER_DOM

Is there a way to make this from the Apache template?

Mon, 06/30/2008 - 11:35 (Reply to #12)
sgrayban

Just a note on this for anyone reading it.

Debian minimal installs do NOT partition servers correctly -- as the default only 2 partitions are created - /root and / - so no matter where you have files they are ALWAYS quota counted.

Mon, 06/30/2008 - 14:56 (Reply to #13)
Joe
Joe's picture

<div class='quote'>Debian minimal installs do NOT partition servers correctly -- as the default only 2 partitions are created - /root and / - so no matter where you have files they are ALWAYS quota counted.</div>

And, that's not actually all that terrible. ;-)

Most folks who are using quotas <i>want</i> quotas to apply to everything (except the Dovecot index and control files...but Dovecot in newer versions handles problems with these files sanely without the &quot;different partition&quot; workaround--the version included in Debian 4.0 almost certainly handles quota overage sanely, though I haven't tested it).

But, yeah, if you want to do anything fancy related to not counting certain things in quotas, you do have to have a partition on which to put those non-quota items, and that's not always what happens by default.

--

Check out the forum guidelines!

Mon, 06/30/2008 - 15:24 (Reply to #14)
Joe
Joe's picture

<div class='quote'>Is there a way to make this from the Apache template? </div>

No, it's set in the Module Configuration in the &quot;Actions upon server and user creation&quot; section.

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:25
Joe
Joe's picture

But the ${DOM} subdirectory isn't. I guess you could create it using a &quot;Command to run before&quot; (found in the Module Configuration under &quot;Actions upon server and user creation&quot;).

--

Check out the forum guidelines!

Mon, 06/30/2008 - 11:58
ScOut3R

I'm using separate partitions.

Sun, 06/07/2009 - 07:25
Joe
Joe's picture

But the ${DOM} subdirectory isn't. I guess you could create it using a &quot;Command to run before&quot; (found in the Module Configuration under &quot;Actions upon server and user creation&quot;).

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:25
ScOut3R

<b>Joe wrote:</b>
<div class='quote'>But the ${DOM} subdirectory isn't. I guess you could create it using a &quot;Command to run before&quot; (found in the Module Configuration under &quot;Actions upon server and user creation&quot;).</div>

Thank You!

I've made a little shell script that creates the appropriate directories and log files and now it works like a charm.

Topic locked