Stats for all accounts - idea/tip !

jeroman8

Well-Known Member
Mar 14, 2003
410
0
166
Note: I'm not a gury - don't know if this can mess things up or if there's a much better idea.

I tested to add a second "CustomLog" line in httpd config for an account and it works.
So if I install a dummy account on the server and then add a second domlogs to all other accounts in httpd that points to dummy file, I will have the stats for all accounts combined
for awstats, webalizer etc.

My dummy:
serverstats.com

In httpd:
CustomLog domlogs/serverstats.com combined

Now I add this line to all other accounts as well so stats is written to both the
accounts own logfile and to this one.

NOTE: Only a small test has been made - you do it on your own risk - I have no idea
if it will mess something up other than the logfile will be huge so you better run stats
often - depending on how heavy stats is.
Just add a cronjob: */30 * * * * /scripts/runweblogs "serverstats.com's_username".
This will run stats for this account ever 30 minutes.

QUESTION:
Is there a template for apache so I can add a line like this auto for new accounts ?
Anyone have a command we can use to add this line for all account already setup ?
 

Bash

Member
May 7, 2005
22
0
151
Hi,

You will have to manually change them or use VI editor and use a whole bunch of flags to accomplish what you are trying to do. If you do not know how to use VI then I would not suggest even trying as your httpd.conf file is very important. I would suggest you to just edit the lines manually, and any new accounts created you will have to just add as well.

-Bash
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,465
30
473
Go on, have a guess
Actually, there is a template for new virtualhost containers. Look in:

/usr/local/cpanel/etc/httptemplates/apache1

You could also do it as part of creating /scripts/postwwwacct (search the forums about that)
 

jeroman8

Well-Known Member
Mar 14, 2003
410
0
166
Thanks for the template tip.

I used my sftp program cuteFTP (very good) to replace/add the custom log line for all accounts.

What I did was to use a replace function in the text of a file.
I replaced all "combined" words with:

combined
CustomLog domlogs/serverstats.se combined

That way this:
CustomLog domlogs/domainbla.com combined

Became this:
CustomLog domlogs/domainbla.com combined
CustomLog domlogs/serverstats.se combined

Important: I first cut out all the accounts, from first virtual host to the last and did this
in a new file and then pasted everything back again with new lines.
I did this because the word "combined" might be somewhere else where we don't wanna do this - it might mess things up.

As always - save a backup of the httpd.conf before you edit it.

This works very good so far and it's pretty cool to have all accounts stats in one awstats.
Now it would be cool to have all servers stats on one account :)