You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "J. Bakshi" <jo...@infoservices.in> on 2010/01/22 10:29:24 UTC

[users@httpd] Newbie question about vhost log and webalizer

Dear all,

Two newbie questions

[1]  I am running a development server with multiple vhosts. Presently
all logs can be seen at  /etc/apache2/log/error.log  and at
/etc/apache2/log/access.log. How can I break the logs for each and every
vhosts ; so that the log only contains the specific vhost information ?

[2]  How can I set webalizer for each and every vhosts ?

Please suggest

Thanks

-- 
জয়দীপ বক্সী


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by "J. Bakshi" <jo...@infoservices.in>.
Emmanuel Bailleul wrote:
> Hi,
>
> I don't really know much about webalizer so I'll only try to help you with 1. :
> - each <VirtualHost *> section can contain its own '*Log' directives (i.e. "CustomLog logs/vh1_access.log common"). This way you will get one log file per vhost.
> - you could also keep all your logs in one file by just adding a reference to the host in your log lines, by modifying the log format you use : LogFormat "%h %l %u %t \"%r\" %>s %b %{Host}i" common. In this case you will have to configure your log tool to split information based on this field.
>
> Regards.
>
> Emmanuel
>   
Thanks for your reply, I have also found vlogger which can break the
common apache log per vhost based and it also minimizes the server load.
As I am not experienced with this vlogger, the experienced one can
provide some more insight  on it regarding it's performance etc...

-- 
জয়দীপ বক্সী


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Newbie question about vhost log and webalizer

Posted by Emmanuel Bailleul <Em...@telindus.fr>.
> -----Message d'origine-----
> De : J. Bakshi [mailto:joydeep@infoservices.in]
> Envoyé : vendredi 22 janvier 2010 10:29
> À : users@httpd.apache.org
> Objet : [users@httpd] Newbie question about vhost log and webalizer
> 
> Dear all,
> 
> Two newbie questions
> 
> [1]  I am running a development server with multiple vhosts. Presently
> all logs can be seen at  /etc/apache2/log/error.log  and at
> /etc/apache2/log/access.log. How can I break the logs for each and every
> vhosts ; so that the log only contains the specific vhost information ?
> 
> [2]  How can I set webalizer for each and every vhosts ?
> 
> Please suggest
> 
> Thanks
> 
> --
> জয়দীপ বক্সী
> 

Hi,

I don't really know much about webalizer so I'll only try to help you with 1. :
- each <VirtualHost *> section can contain its own '*Log' directives (i.e. "CustomLog logs/vh1_access.log common"). This way you will get one log file per vhost.
- you could also keep all your logs in one file by just adding a reference to the host in your log lines, by modifying the log format you use : LogFormat "%h %l %u %t \"%r\" %>s %b %{Host}i" common. In this case you will have to configure your log tool to split information based on this field.

Regards.

Emmanuel

Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by "J. Bakshi" <jo...@infoservices.in>.
Mark Watts wrote:
>
> The Fedora 12 AWStats rpm includes a config for the following, although
> I appreciate its for a different path (/usr/share vs. /usr/local)
>
>
> Alias		/awstatsclasses	"/usr/share/awstats/wwwroot/classes/"
> Alias		/awstatscss	"/usr/share/awstats/wwwroot/css/"
> Alias		/awstatsicons	"/usr/share/awstats/wwwroot/icon/"
> ScriptAlias	/awstats/	"/usr/share/awstats/wwwroot/cgi-bin/"
>
> <Directory "/usr/share/awstats/wwwroot">
>     Options None
>     AllowOverride None
>     Order allow,deny
>     Allow from All
> </Directory>
>
>
> I suspect you'd need the other Alias lines.
>
> Mark.
>
>   
Solved the second one too.  But in a different way.

 If you go to my earlier mails you can find I already have

` ` `
# READ  FROM  /usr/local/awstats/tools/httpd_conf

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats/wwwroot">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

` ` `

When I try to view an image I have found the the image path is /icon  so
I added one more line like

Alias /icon "/usr/local/awstats/wwwroot/icon/"

And now icons are also working.
But a warning, We need to add this line all the time in httpd.conf, it
would be better if awstas fix it or mention the above in its documentation.

With regards.


-- 
জয়দীপ বক্সী


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by Mark Watts <m....@eris.qinetiq.com>.
On Mon, 2010-01-25 at 15:55 +0530, J. Bakshi wrote:
> J. Bakshi wrote:
> > on the other hand http://myvhost.com/awstats/ awstat.pl   generates the 
> > graph but no icons. 
> >
> > What am I missing here ? Any clue ?
> >
> > Thanks
> >   
> 
> Solved one :-)
> 
> Now  http://myvhost.com/awstats/  shows awstats . The correction I have
> done is 
> 
> incorrect
> -------------
> ScriptAlias /awstats/     
> "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"    # ( note the / after
> /awstats )
> 
> correct
> ----------
> ScriptAlias /awstats    "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"
>  
> But still no icons
> 

The Fedora 12 AWStats rpm includes a config for the following, although
I appreciate its for a different path (/usr/share vs. /usr/local)


Alias		/awstatsclasses	"/usr/share/awstats/wwwroot/classes/"
Alias		/awstatscss	"/usr/share/awstats/wwwroot/css/"
Alias		/awstatsicons	"/usr/share/awstats/wwwroot/icon/"
ScriptAlias	/awstats/	"/usr/share/awstats/wwwroot/cgi-bin/"

<Directory "/usr/share/awstats/wwwroot">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from All
</Directory>


I suspect you'd need the other Alias lines.

Mark.

-- 
Mark Watts BSc RHCE MBCS
Senior Systems Engineer, Managed Services Manpower
www.QinetiQ.com
QinetiQ - Delivering customer-focused solutions
GPG Key: http://www.linux-corner.info/mwatts.gpg

Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by "J. Bakshi" <jo...@infoservices.in>.
J. Bakshi wrote:
> on the other hand http://myvhost.com/awstats/ awstat.pl   generates the 
> graph but no icons. 
>
> What am I missing here ? Any clue ?
>
> Thanks
>   

Solved one :-)

Now  http://myvhost.com/awstats/  shows awstats . The correction I have
done is 

incorrect
-------------
ScriptAlias /awstats/     
"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"    # ( note the / after
/awstats )

correct
----------
ScriptAlias /awstats    "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"
 
But still no icons

-- 
জয়দীপ বক্সী


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by "J. Bakshi" <jo...@infoservices.in>.
L.M.J wrote:
> Here is my solution, I hope it could help you out : 
>
>
>
> Apache side
>   # cat /etc/apache2/sites-available/intranet
>     <VirtualHost *>
>         ServerName intranet
>         [...]
>         ErrorLog /var/log/apache2/intranet_error.log
>         CustomLog /var/log/apache2/intranet_access.log "combined"
>         LogLevel error
>         ScriptAlias /awstats/ "/usr/lib/cgi-bin/"
>         [...]
>     </VirtualHost> 
>     
>   
>   

I am working in the direction you have provided in your short and nice 
email.  I have installed awstas in opensuse 11.1 server ( from .rpm
availavle at rpm search) and modified my httpd.conf with

` ` `
# READ  FROM  /usr/local/awstats/tools/httpd_conf

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats/wwwroot">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

` ` `
All the path are valid.

I have also created the required configuration with SiteDomain for a
vhost.  After restaring the apache If I visit my vhost like

http://myvhost.com/awstats/  it gives error "Access forbidden!"  and
apache error log reports

` ` `
attempt to invoke directory as script: /usr/local/awstats/wwwroot/cgi-bin/

` ` `

on the other hand http://myvhost.com/awstats/ awstat.pl   generates the 
graph but no icons. 

What am I missing here ? Any clue ?

Thanks

--

জয়দীপ বক্সী


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by "L.M.J" <li...@free.fr>.
On Fri, 22 Jan 2010 14:59:24 +0530, "J. Bakshi" <jo...@infoservices.in>
wrote:
> [1]  I am running a development server with multiple vhosts. Presently
> all logs can be seen at  /etc/apache2/log/error.log  and at
> /etc/apache2/log/access.log. How can I break the logs for each and every
> vhosts ; so that the log only contains the specific vhost information ?
> [2]  How can I set webalizer for each and every vhosts ?


Here is my solution, I hope it could help you out : 



Apache side
  # cat /etc/apache2/sites-available/intranet
    <VirtualHost *>
        ServerName intranet
        [...]
        ErrorLog /var/log/apache2/intranet_error.log
        CustomLog /var/log/apache2/intranet_access.log "combined"
        LogLevel error
        ScriptAlias /awstats/ "/usr/lib/cgi-bin/"
        [...]
    </VirtualHost> 
    
  # cat /etc/apache2/sites-available/web2
    <VirtualHost *>
          ServerName web2
          [...]
          ErrorLog /var/log/apache2/web2_error.log
          CustomLog /var/log/apache2/web2_access.log "combined"
          LogLevel error
          ScriptAlias /awstats/ "/usr/lib/cgi-bin/"
          [...]
    </VirtualHost>

    
Awstats side (similar to webstats)
  # cat /etc/awstats/awstats.intranet.conf
  [...]
  SiteDomain="intranet"
  [...]
  LogFile="/var/log/apache2/intranet_access.log"
  [...]

  # cat /etc/awstats/awstats.web2.conf
  [...]
  SiteDomain="web2"
  [...]
  LogFile="/var/log/apache2/web2_access.log"
  [...]
  
  
And then, I use logrotate to rotate apache logs : I use the prerotate
command to update awstats stats before truncate logs : 
  # cat /etc/logrotate.d/apache2
  /var/log/apache2/*.log {
          missingok
          rotate 31
          compress
          nodelaycompress
          notifempty
          create 644 root adm
          sharedscripts
          postrotate
          if [ -f /var/run/apache2.pid ]; then
          /etc/init.d/apache2 restart > /dev/null
          fi
          endscript
          prerotate
           /opt/My_ Admin_Scripts/pre-logrotate_apache.sh     # <--- this
line is important
          endscript
          daily
          mailfirst
  }

  cat /usr/latecoere/pre-logrotate_apache.sh
  #!/bin/bash
  /usr/lib/cgi-bin/awstats.pl -update -config=intranet
-configdir=/etc/awstats
  /usr/lib/cgi-bin/awstats.pl -update -config=web2 -configdir=/etc/awstats


  Results are available at
http://server.fqdn/awstats/awstats.pl?config=intranet or
http://web2/awstats/awstats.pl?config=web2, etc....
  

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by ap...@obstsorten.de.
Hello

am Mittwoch, 27. Januar 2010 um 17:22 schrieben Sie:

> On 22.01.10 14:59, J. Bakshi wrote:
>> Two newbie questions
>> 
>> [1]  I am running a development server with multiple vhosts. Presently
>> all logs can be seen at  /etc/apache2/log/error.log  and at
>> /etc/apache2/log/access.log. How can I break the logs for each and every
>> vhosts ; so that the log only contains the specific vhost information ?
>> 
>> [2]  How can I set webalizer for each and every vhosts ?

> I don't know about webalizer but I know that e.g. awstats can process logs
> even if one logfile contains logs for all virtual hosts.
> Check if webalizer can not do the same.

No, webalizer cannot split the logfile or make statistics for
different virtual hosts.

Use split-logfile
( http://httpd.apache.org/docs/2.0/programs/other.html )

to create one logfile for every virtual host, then run webalizer for
each virtual host.

Regards
Reinhold
-- 



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 22.01.10 14:59, J. Bakshi wrote:
> Two newbie questions
> 
> [1]  I am running a development server with multiple vhosts. Presently
> all logs can be seen at  /etc/apache2/log/error.log  and at
> /etc/apache2/log/access.log. How can I break the logs for each and every
> vhosts ; so that the log only contains the specific vhost information ?
> 
> [2]  How can I set webalizer for each and every vhosts ?

I don't know about webalizer but I know that e.g. awstats can process logs
even if one logfile contains logs for all virtual hosts.
Check if webalizer can not do the same.

I skipped using multiple log files because that caused much processing
overhead (rotating, reopening, maintaining).

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
"To Boot or not to Boot, that's the question." [WD1270 Caviar]

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Newbie question about vhost log and webalizer

Posted by Daniel Reinhardt <cr...@cryptodan.net>.
--------------------------------------------------
From: "J. Bakshi" <jo...@infoservices.in>
Sent: 22 January, 2010 9:29
To: <us...@httpd.apache.org>
Subject: [users@httpd] Newbie question about vhost log and webalizer

> Dear all,
>
> Two newbie questions
>
> [1]  I am running a development server with multiple vhosts. Presently
> all logs can be seen at  /etc/apache2/log/error.log  and at
> /etc/apache2/log/access.log. How can I break the logs for each and every
> vhosts ; so that the log only contains the specific vhost information ?
>
> [2]  How can I set webalizer for each and every vhosts ?
>
> Please suggest
>
> Thanks
>
> -- 
> জয়দীপ বক্সী
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

Here is my solution:

CustomLog /var/log/apache2/vhost.com/access.log

where vhost.com is the name of each vhost.  This is by far the easiest and 
requires less setup and use of other tools. 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org