Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Log analyser for apache aliases, Log analyser for apache aliases
yakesh
post Dec 10 2005, 12:41 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 10-December 05
Member No.: 5,843



Hi there,

My first post here, so a big hello to everyone.

I am facing problem with apache logs on my server. Well let me explain..

We have an e-commerce solution which is hosted under the same virtual host for every domain. There is a main virtual host, lets say abc.com and all the other websites are being set as server alias for this virtual host. Content is served depending upon which domain is requested by the user.

I hope that is all clear.

Now the problem is, as one virtual host is serving all these domains and there is one log file is being generated and that is for the main virtual host, we are not able to see access logs for the particular aliases.

Log files are generated per virtual host, and software like webalizer creates the report accordingly. However what i need to do is, generate log files per alias as well and get webalizer to create reports.

Any ideas / suggestions?
Go to the top of the page
 
+Quote Post
Jim
post Dec 10 2005, 03:08 PM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



I am a little confused as to what you're saying. I think you might be miss using the virtual host idea. So lets say you have two websites. shows.abc.com and news.abc.com. If both are hosted off that same instance of apache then you have virtual host records for each entry. That is what a virtual host is. So inside your virtual host entry, you can have it look like this.

CODE
<VirtualHost *>
       ServerAdmin webmaster@abc.com
       ServerName  shows.abc.com
       DocumentRoot /var/www/html/abc/

       CustomLog /var/log/httpd/abc/access_log common

</VirtualHost>


So thats the VirtualHost entry and it will generate a custom access log to its own place.

You can then set webalize to read in that log. What I found works best is to make special conf files for each virtual host. That way I can set the LogFile, the OutputDir and the HistoryName for each.

Now I think where you are running into trouble is you want a composite report for both shows.abc.com and news.acb.com. If you want to do that, what you do it set up a second program to merge all the log entries, then run webalize on that log file. Mergelog should work -->mergelog.sourceforge.net

or you can do it with bash if your're creative. That will give you seperate webalizer reports for each virtual host and for the total. You could also look into awstats which I am pretty sure can combine its own usage stats.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
yakesh
post Dec 11 2005, 01:45 PM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 10-December 05
Member No.: 5,843



Thanks for your reply.

I think you understood it a little wrong. By what i understood from your post, it seems your suggesting shows.abc.com and news.abc.com as the SUB DOMAINS for abc.com. Thats not the case with my setup.

Let me try again.

I have a domain, lets say www.abc.com which is running the entire online solution. Then there are other domains which are setup on this e-commerce solution using Server Alias in virtual host config. Below is from httpd conf file..
###############################
<VirtualHost 217.28.39.1(some ip address)>
ServerAlias www.abc.com abc.com
ServerAdmin webmaster@abc.com
DocumentRoot /home/abc/public_html
BytesLog domlogs/abc.com-bytes_log
ServerName www.abc.com
ServerAlias xyz.co.uk www.xyz.co.uk
ServerAlias def.co.uk www.def.co.uk
UseCanonicalName Off
CustomLog domlogs/abc.com combined
</virtualhost>
######################

If you carefully look at the config below, we have a main virtual host domain which is abc.om and then we have two server alias-xyz.co.uk and def.co.uk.

Now its important to note all these domains are served with same set of physical php files etc, but of course the content is different as index.php pulls up the content according to what domain has been requested.

I hope this is clear now.

Now the problem is, server is putting all the access logs in to "abc.com" instead of creating log files for each n every alias domain which is passed to webalizer to create one massive report for all the domains.

What i want is to compile different log files for each server alias and then create webalizer report for it.

Any suggestions?
Go to the top of the page
 
+Quote Post
Jim
post Dec 11 2005, 02:17 PM
Post #4


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



Alright, now I understand whats going on. But my solution is more or less the same. Instead of using aliases, use true virtual host. Like this.

CODE
<VirtualHost *>
      ServerAdmin webmaster@abc.com
      ServerName  shop.abc.com
      DocumentRoot /var/www/html/abc/

      CustomLog /var/log/httpd/abc/access_log common

</VirtualHost>

<VirtualHost *>
      ServerAdmin webmaster@abc.com
      ServerName  shop.abc.co.uk
      DocumentRoot /var/www/html/abc/

      CustomLog /var/log/httpd/abc/access_log_uk common

</VirtualHost>


What that does is set up two virtual hosts, one for .com and one for .co.uk, both are pointed to the same folder to server up, but generate different log files.

You can then run webalizer on each log file, and if you want, combine the logs into one giant log to get a "total" stats. There, I think we have solved the problem. I will also note that this shouldn't be any kind of performance hit. Apache will basically run the exact same. A packet request comes in, apache looks to see what to do with it, and servers it up. So, are we on the same page now?


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
yakesh
post Dec 11 2005, 03:00 PM
Post #5


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 10-December 05
Member No.: 5,843



yes thank you.

Thats what i thought too, but the server is using Cpanel and unless i edit the httpd conf manually, it will never use the same folder for two vritual host, if that make sense?

Now lets say, i edit the conf file for this virtual host, but sometime later if i add another website through cpanel, i guess it would remove these things. isnt it? Does that make sense?
Go to the top of the page
 
+Quote Post
yakesh
post Dec 11 2005, 03:25 PM
Post #6


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 10-December 05
Member No.: 5,843



i just tried what you advised.

It is creating a new log file just for that domain and i can see it in real time being updated. No problem on that front.

However, my clients access the webalizer reports through website cpanel. So, i just tried to log into cpanel for that website and then clicked on webalizer. Now, i expected it not to show any results as webalizer shouldnt have any reports for this domain, but instead it is showing me the log report for the main domain.

starting to get confusing now.. hehe..
Go to the top of the page
 
+Quote Post
Jim
post Dec 11 2005, 04:41 PM
Post #7


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



You're going to have to configure individual instantiations of webalizer for each website. The easiest way to do this is to make multiple config files for webalizer.

So your basic config file is /etc/webalizer.conf what I did was make copies of that and renaime it ike /etc/webalizer.blog.conf Then inside each config file there are at least three settings you need to change.

LogFile -- tells it the location of the specific log file to read
OutputDir- tells it where to store the reports
HistoryName- tells it where to store the historical information its usually in /var/lib/webalizer or something. Again, the main one will be webalizer.hist so you need to make a second one, for me its webalizer.blog.hist

Then you need to change the links on your websites to point to the different OutputDir that you specified.

Lastly, you need to change your cron job or what ever it is that runs webalizer to run with each specific config file. So mine looks like this

CODE
#! /bin/bash
# update access statistics for the web site

if [ -s /var/log/httpd/access_log ]; then
   /usr/bin/webalizer
   /usr/bin/webalizer -c /etc/webalizer.blog.conf
fi

exit 0


It runs ounce with the default conf file, then the second time it loads in the blog config file, thats what the -c is for. Starting to get a little less confused?


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st October 2017 - 01:54 AM