Help - Search - Members - Calendar
Full Version: Howto Ensim Webalizer
The Planet Forums > System Administration > HOWTOs
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9
madsere
I was looking for a HOWTO for installing Webalizer but was unable to find one, so I had to do it the hard way, i.e. RTFM.

EDIT:

I have removed the howto as so much has been changed since posting this howto and I only updated the main page on my Ensim site.

If you want the latest version of the howto please see http://ensim.webscorpion.com
casechopper
Thanks for the how-to madsere.
I'm having a problem. When I try to install the rpm I get this error.

[admin@ensim admin]$ rpm -ivh webalizer.rpm
error: cannot open Packages index using db3 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm

Do you know what I'm doing wrong?
DanDanFireMan
login as root maybe?
casechopper
Thanks for the help dandan that was my problem. But I've got another problem now.
How do you copy the text into the file? I've copyed it into the part that pops up when I do this command vi /etc/webalizer/domain
How do I save it though? Sorry for the newbie questions but...well I'me a newbie.icon_sad.gif
casechopper
help:(
DanDanFireMan
I would recommend using pico for file editing. Type pico domain.
paste the text in.
Ctrl-X to exit.

To answer your original question.....
In vi to save and exit:
type :wq and press return..dont forget the colon
casechopper
Thank's I'll try that as soon as I get a chance.icon_smile.gif
casechopper
It's working!icon_biggrin.gif Thanks for all the help.
Cyborg
Very nice, very nice.
I also could only find a webalizer rpm for RH 7.2 and it works.

Two more things:
If you want a different directory to access your statistics (I wanted it on mydomain.com/stats), this is what I did.
Change this line in the domain file, e.g. /etc/webalizer/eatatjoes.com

OutputDir /home/virtual/DOMAIN/var/www/html/usage
to
OutputDir /home/virtual/DOMAIN/var/www/html/stats

and in the /etc/cron.daily/webalizer file change it to:

------------------------------------------------------------
for i in *
do
stats=/home/virtual/$i/var/www/html/stats
if [ ! -d $stats ]; then mkdir $stats; fi
webalizer -c $i
echo " "
echo " "
done
------------------------------------------------------------
I also had to chmod /etc/webalizer to make it executable e.g.
chmod 744 /etc/webalizer

thanks a lot madsere
madsere
If you want webalizer to be setup automatically for new domains add the following lines to the file /etc/appliance/customization/virtDomain.sh (create it if it doesn't exist):

#!/bin/sh
DOMAIN=$1
# script to automatically setup webalizer in
# ensim upon domain creations
# Rene Madsen rene@webscorpoin.com April 8, 2002
cat </etc/webalizer/$DOMAIN
LogFile /home/virtual/$DOMAIN/var/log/httpd/access_log
OutputDir /home/virtual/$DOMAIN/var/www/html/usage
Incremental yes
HostName $DOMAIN
PageType htm*
PageType shtm*
PageType cgi
PageType phtml
PageType php*
PageType pl
ReallyQuiet yes
HideURL *.gif
HideURL *.GIF
HideURL *.jpg
HideURL *.JPG
HideURL *.ra
!
#-- end of script
webbcite
Great job Madsere! I finally got around to installing it and it went very well. I would only add a couple of little optional tweaks:

I found the Red Hat 7.1 updated RPM at ftp://updates.redhat.com/7.1/en/powertool...9-0.71.i386.rpm

Here are a couple of optional webalizer tweaks to customize what your customers see. Below is the entire sample file with bold being my comments.

LogFile /home/virtual/domain.com/var/log/httpd/access_log
OutputDir /home/virtual/domain.com/var/www/html/stats
took Cyborgs hints and went with "stats" folder instead of usage
Incremental yes
HostName domain.com
PageType htm*
PageType shtm*
PageType cgi
PageType phtml
PageType php*
PageType pl

HTMLHead
You can put in the above commands to have customized "head" tags for the stats. I like Arial/Helvetica font, so I added it.

HTMLBody
you can add body tags so you can customize the background, text and link colors.
HTMLBody
This is where I add my company logo to the stats page, so all of my customers see my logo as much as possibleicon_wink.gif

HTMLTail MyCompanyName
A link to my company website on each page

ReallyQuiet yes

HideURL *.gif
HideURL *.GIF
HideURL *.jpg
HideURL *.JPG
HideURL *.png
HideURL *.PNG
HideURL *.ra
HideURL *.js
HideURL *.class
Added a couple others I don't want to see

SearchEngine yahoo.com p=
SearchEngine altavista.com q=
SearchEngine google.com q=
SearchEngine eureka.com q=
SearchEngine lycos.com query=
SearchEngine hotbot.com MT=
SearchEngine msn.com MT=
SearchEngine infoseek.com qt=
SearchEngine webcrawler searchText=
SearchEngine excite search=
SearchEngine netscape.com search=
SearchEngine mamma.com query=
SearchEngine alltheweb.com query=
SearchEngine northernlight.com qr=
Added the SearchEngine items as this will help identify what search string keywords are being entered to get to the domain/site

There are other cool little tweaks you can do to your webalizer files to make it perform better or give you better info, but this is as far as i've gotten.

Again, excellent job...this will be a very useful thread for a lot of people...it saved me a bunch of time that is FOR SURE!
bigmattyh
I'm having a couple of problems with the setup here... maybe you guys can help me out!

The first (and most important thing) is that I used the mergelog tool to roll all the logs into access_log, and webalizer isn't going back to recompile the stats. (I ran it the first time without having used mergelog.) Do I need to reinstall/recompile?

And two, I keep getting a message from cron, that the command "webalizer" was not found. When I run the script from the command line, Webalizer runs fine -- just not in cron.


Lastly, my server's been online since January, yet I only have stats from April 7th on. Is this normal? Is there any way to recover the old logs?
madsere
1. Remove all files in the usage directories. They'll be recreated next time webalizer runs.

2. Try changing the comand 'webalizer' to '/usr/bin/webalizer'. Dunno why your cron don't have a decent PATH set but that's another issue.

3. Yes thats normal. Log files are rotated and eventually deleted so you only keep a few weeks worth on your system. Webalizer keeps taps on old stats in a much compressed way so the huge logfiles are normally not necessary as soon as webalizer has done it's job.
DomineauX
I followed the steps to install Webalizer and I created the cron.daily/webalizer as instructed.
After this worked, I create etc/webalizer/domain.com file and then ran the webalizer to create the usage stats for that domain. I was able to see those stats correctly at domain.com/usage.
I then followed Madsere's directions in creating /etc/appliance/customization/virtDomain.sh so that each new site created would automatically use webalizer.
Since creating this, I have been trying to setup a new namebased site and get the following error everytime saying that creating the site failed.
I have renamed the file from /etc/appliance/customization/virtDomain.sh
to /etc/appliance/customization/old.virtDomain.sh
and I have even removed the file entirely to no avail.
If anyone knows what could be causing these errors, please let me know ASAP!

Traceback (most recent call last):
File "/home/build/dev/serverxchange/3.0.3/2/lws/prakash2/WebGui/base/services/virthost/virtualhosting.py", line 867, in _editDomainWithPlan
File "virtualhosting/virthost.py", line 2163, in add_virtual_domain
File "virtualhosting/virthost.py", line 2066, in __edit_virtual_domain
File "virtualhosting/virthost.py", line 1136, in populate_domainfs
File "/home/build/dev/serverxchange/3.0.3/2/lws/prakash2/WebGui/base/services/vh3/apache/virthost_actions.py", line 178, in populate_domainfs
File "/home/build/dev/serverxchange/3.0.3/2/lws/prakash2/WebGui/base/services/vh3/apache/virthost_actions.py", line 541, in custom_config
OSError: [Errno 2] No such file or directory

Thanks,
Tony@Domineaux.net
shin
wow this thing is slow to download...anyone have a mirror?
shin
OMG like 15 minutes to download a 200K file (at 130am on a friday night)
madsere
Shin: what is it that's slow?

Tony: Sorry to hear of your trouble. It seems to me a file that is required by Ensim has been deleted somewhere but I really have no clue what they do with their Phyton stuff :-P

It's not directly related to this Webalizer howto though - once you rename virtDomain.sh it's no longer taken into account.
bigmattyh
Madsere, thanks for the help in getting my old logs working!

Unfortunately, I'm still having that cd problem, where crontab isn't changing to /etc/webalizer. No other directory works either, and /etc/webalizer is the only one I can get to work from the command prompt.

It's giving me this in the daily error-mail:
QUOTE
/etc/cron.daily/webalizer: webalizer: command not found

Any ideas about what's up?
madsere
Yes. Something is wrong with your crontab thingy; it's $PATH is not set so it doesn't know how to find the webalizer binary.

You could just add /usr/bin to the webalizer command but then you might get other errors. Once your PATH is hosed you may get loads of annoying small bugs.

I don't know why it has gone wrong or how to fix it; this is something that you'd have to work on the system to sort out.

I suggest you find the root of the problem instead of curing symptoms here. If necessary hire someone to sort it out for you.
mcmcomput
Wheres that merge log thing? i can't find it.
madsere
Yeah I know, I can't find it myself anymore. Anyway all you need is the mergelog binary and you can download mine from here: http://WebScorpion.com/ensim/mergelog.bin (right-click, save-as)
martinjr76
Thanks all! Installed it with ease icon_biggrin.gif

I've got one question though, the "Usage by Country" showed unresolved/unknown to be 100%. Any ideas how to solve this?
mcmcomput
Yes i have the same problem.
madsere
Just add the lines
CODE
DNSCache   dns_cache.db

DNSChildren    5

Somewhere in the /etc/webalizer/* files.

This force Webalizer to resolve domains next time it runs.
martinjr76
Thanks madsere! It work, though a large part of the hits is still unresolved hehehehee icon_smile.gif
bigmattyh
Anyone else looking for a mergelog RPM:

http://bert.tuxfamily.org/mergelog/rpms/me....i386.rh7.0.rpm

It's a RH7.0 version but it worked fine on my system (Ensim w/ 7.1).

Matt
mcmcomput
I'am getting the following error.

QUOTE
[root@ensim httpd]# ls
access_log  access_log.1  access_log.2  error_log  error_log.1  error_log.2
[root@ensim httpd]# mergelog access* >all
Segmentation fault (core dumped)
[root@ensim httpd]#

My logs are about 500 meg apiece will that cause it?
bigmattyh
I figured out the cron problem (I think) thanks to madsere pointing me in the right direction! Thanks!

I'm curious though, about an error I'm getting. I tried to do the fix earlier in this thread regarding resolving international domains, and I'm getting this:
QUOTE
Warning: Invalid keyword 'DNSCache' (domain.com)
Warning: Invalid keyword 'DNSChildren' (domain.com)

Any thoughts on how to remedy this?
mcmcomput
Don't we have to creat some other files? like *.DB or something?
mcmcomput
Found the answer i think. Try this:
Iam trying it now.

http://forum.rackshack.net/showthread.php?...lizer+Countries
bigmattyh
That is a link to a RaQ package -- not a RedHat package... I'm not Linux-savvy enough to know if that'll work.

I'm going to uninstall webalizer as it is now and recompile it with dns support... see if that does the trick. I've found a thread or two on usenet that supports this idea.
bigmattyh
Update on the country issue...

I had compiled webalizer once before without dns support, and I had installed a bad RPM over it. It worked, mind you, but it was quirky.

Found a good rpm, uninstalled the old version, reinstalled the good RPM, and that was that.
mcmcomput
What about my log merging thing?

QUOTE
[root@ensim httpd]# ls  
access_log access_log.1 access_log.2 error_log error_log.1 error_log.2  
[root@ensim httpd]# mergelog access* >all  
Segmentation fault (core dumped)  
[root@ensim httpd]#  


Any comments? My country thing still doesn't seem to work, all the way. Comments about that?
madsere
I though you just 3 posts back said you found the solution .....

:confused:

Anyway, I have never tried to merge 500 MB logs but I would be prepared to believe they would cause a crash. I dunno.

For the countries, you just need to add the two lines to webalizer, then it will attempt to resolve the names. That assumes you use the webalizer.rpm I pointed to earlier. I understand it is possible to compile webalizer without this so other rpm's/versions may not have this capability. Even with it there are certain IP addresses that are not resolvable to any particular country.
mcmcomput
Guess I'am stuck there? any way to condense the logs? or preserver the stats? like after the months over i can delete the logs right?
shin
thanks for all the help on this thread everyone..finally got it to work...Had to start over today tho...Must have been too tired the other night icon_wink.gif
bigmattyh
By the way -- for anyone merging lots of logs, I've got some numbers that might interest you.

I culled all the old logs I could find off my local machine and merged them all. Mergelog put 'em in one big 7.7 GIG file. It took it about 3 minutes to do this on my Duron 1Ghz w/ 512MB. Webalizer took about the same amount of time to analyze the file.
mcmcomput
What size are each files? I have 3 which are 500+ megs. and it seems to stop after the first. i have the same server as you execpt w/ 1 Gig ram
bigmattyh
One was over 2Gigs.

In SSH, the server did seem to "lock" after a minute or so, but it was still completely operational. Maybe you could open up two connection windows and run "top" in one of them to monitor the load while you merge those files. You may have to manually open the files and cut them up, only doing a couple at a time.
ricu
Hello ..runs perfect..I added webscorps Script from above to /etc/appliance/customization..to automate..I created a test site..nothing--the file was not created. Any ideas?
Thanks Rich
madsere
Which file wasn't created?
There is no output from Webalizer until you have some traffic to build it on.
ricu
I assumed it would create the config file in etc/webalizer for the newly created site..so I would not have to create one for every site by hand,when cron ran a usage(stats)directory would then be created for that site..?
Thanks Rich
madsere
It does create a file in /etc/webalizer/domain.com for each site you create - certainly does that for me - but no domain.com/usage until there is data. I think it creates the actual usage directory but it remains empty until there is data.
ricu
For whatever reason it isnt on mine(just my luck),if it works on yours,should work on mine I would think...setting up by hand isnt all that bad..afterall its not like I have 100's of customers banging on my back door everyday...would have been nice though..if you come up with an idea of why it wont execute..
Just a thought..
Should I be able to execute from command line?
Tried for haha's---get no such file or directory--but its there I know I put it there myself...maybe this explains it to some degree..
If I run locate virtDomain.sh..its right where it should be!!
Any Suggestions!
Thanks Rich
madsere
/etc/appliance/customization/virtDomain.sh - right?

In it you should have a line:

/etc/appliance/customization/webalizer.sh $1

And if you do a cat of /etc/appliance/customization/webalizer.sh you should get something like this:

#!/bin/sh
# script to automatically setup webalizer in
# ensim upon domain creations
# Rene Madsen rene@webscorpoin.com April 8, 2002
DOMAIN=$1
cat </etc/webalizer/$DOMAIN
LogFile /home/virtual/$DOMAIN/var/log/httpd/access_log
OutputDir /home/virtual/$DOMAIN/var/www/html/usage
DNSCache dns_cache.db
DNSChildren 5
Incremental yes
HostName $DOMAIN
PageType htm*
PageType shtm*
PageType cgi
PageType phtml
PageType php*
PageType pl
ReallyQuiet yes
HideURL *.gif
HideURL *.GIF
HideURL *.jpg
HideURL *.JPG
HideURL *.ra
!
#-- end of script

Only other thing I can think of right now; make sure all files in /etc/appliance/customization are executable (755)
ricu
Hello..It was a perm issue..thought never crossed my mind..ah the simple things..the first thing I should have checked..when all else fails go back to basics..
Works like a charm..Well done
Thanks for the help
Rich
shin
OK, maybe one of you guys can help me with this...

I followed these instructions and they seem to work well. Have usage stats on each of my domain names.

Here is the problem. On one domain it seems to be resolving the country fine with only about 6% unresolved. On another domain however, around 80% of the hits are unresolved.

Is there any reason that there should be such a disparady? Is there anything else to get them to resolve?

Thanks
skywalllker
Ok, below here is my step that i follow to set up webalizer at my server but so far my webalizer aren't working. I think I already follow the instructions by 'madsere' above. Please review my step cause i'm a newbie...

1. I have download webalizer
2. rpm -ivh webalizer-2.01_06-11.i386.rpm
3. mkdir /etc/webalizer
4. pico /etc/webalizer/mydomain.com and key in the following code into it:

LogFile /home/virtual/mydomain.com/var/log/httpd/access_log
OutputDir /home/virtual/mydomain.com/var/www/html/usage
Incremental yes
HostName mydomain.com
PageType htm*
PageType shtm*
PageType cgi
PageType phtml
PageType php*
PageType pl
ReallyQuiet yes
HideURL *.gif
HideURL *.GIF
HideURL *.jpg
HideURL *.JPG
HideURL *.ra

5. pico /etc/cron.daily/webalizer and key in the following code into it:

#!/bin/sh

cd /etc/webalizer

for i in *
do
USAGE=/home/virtual/$i/var/www/html/usage
if [ ! -d $USAGE ]; then mkdir $USAGE; fi
webalizer -c $i
echo " "
echo " "
done

5. chmod 744 /etc/webalizer

6. http://www.mydomain.com/usage (to see the result but it turn to 'page not found')

Emmmm... what shall i do now?
Hope you guys can give me a hand here.. thanks in advance..
madsere
It will take up to 24 hours before it runs automatically.

You can "force" an immediate execution by entering the following as root:

# /etc/cron.daily/webalizer
skywalllker
Thanks madsere, its working now
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.