Newbie question about vhost log and webalizer

Newbie question about vhost log and webalizer

am 22.01.2010 10:29:24 von joydeep

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 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: Newbie question about vhost log and webalizer

am 22.01.2010 10:46:30 von Emmanuel Bailleul

PiAtLS0tLU1lc3NhZ2UgZCdvcmlnaW5lLS0tLS0NCj4gRGXCoDogSi4gQmFr c2hpIFttYWlsdG86
am95ZGVlcEBpbmZvc2VydmljZXMuaW5dDQo+IEVudm95w6nCoDogdmVuZHJl ZGkgMjIgamFudmll
ciAyMDEwIDEwOjI5DQo+IMOAwqA6IHVzZXJzQGh0dHBkLmFwYWNoZS5vcmcN Cj4gT2JqZXTCoDog
W3VzZXJzQGh0dHBkXSBOZXdiaWUgcXVlc3Rpb24gYWJvdXQgdmhvc3QgbG9n IGFuZCB3ZWJhbGl6
ZXINCj4gDQo+IERlYXIgYWxsLA0KPiANCj4gVHdvIG5ld2JpZSBxdWVzdGlv bnMNCj4gDQo+IFsx
XSAgSSBhbSBydW5uaW5nIGEgZGV2ZWxvcG1lbnQgc2VydmVyIHdpdGggbXVs dGlwbGUgdmhvc3Rz
LiBQcmVzZW50bHkNCj4gYWxsIGxvZ3MgY2FuIGJlIHNlZW4gYXQgIC9ldGMv YXBhY2hlMi9sb2cv
ZXJyb3IubG9nICBhbmQgYXQNCj4gL2V0Yy9hcGFjaGUyL2xvZy9hY2Nlc3Mu bG9nLiBIb3cgY2Fu
IEkgYnJlYWsgdGhlIGxvZ3MgZm9yIGV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WQgb24g
dGhpcyBmaWVsZC4NCg0KUmVnYXJkcy4NCg0KRW1tYW51ZWwNCg==

Re: Newbie question about vhost log and webalizer

am 22.01.2010 10:56:23 von joydeep

Emmanuel Bailleul wrote:
> Hi,
>
> I don't really know much about webalizer so I'll only try to help you with 1. :
> - each 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 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: Newbie question about vhost log and webalizer

am 22.01.2010 12:44:53 von linuxmasterjedi

On Fri, 22 Jan 2010 14:59:24 +0530, "J. Bakshi"
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

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/"
[...]


# cat /etc/apache2/sites-available/web2

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/"
[...]



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 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: Newbie question about vhost log and webalizer

am 22.01.2010 19:38:45 von Daniel Reinhardt

--------------------------------------------------
From: "J. Bakshi"
Sent: 22 January, 2010 9:29
To:
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 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 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: Newbie question about vhost log and webalizer

am 25.01.2010 11:15:37 von joydeep

L.M.J wrote:
> Here is my solution, I hope it could help you out :
>
>
>
> Apache side
> # cat /etc/apache2/sites-available/intranet
>
> 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/"
> [...]
>

>
>
>

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.
#

Options None
AllowOverride None
Order allow,deny
Allow from all


` ` `
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 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: Newbie question about vhost log and webalizer

am 25.01.2010 11:25:22 von joydeep

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 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: Newbie question about vhost log and webalizer

am 25.01.2010 12:04:39 von Mark Watts

--=-Pf4XTx50/pUzN+r5DQh4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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=
=20
> > graph but no icons.=20
> >
> > What am I missing here ? Any clue ?
> >
> > Thanks
> > =20
>=20
> Solved one :-)
>=20
> Now http://myvhost.com/awstats/ shows awstats . The correction I have
> done is=20
>=20
> incorrect
> -------------
> ScriptAlias /awstats/ =20
> "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" # ( note the / after
> /awstats )
>=20
> correct
> ----------
> ScriptAlias /awstats "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"
> =20
> But still no icons
>=20

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/"


Options None
AllowOverride None
Order allow,deny
Allow from All



I suspect you'd need the other Alias lines.

Mark.

--=20
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

--=-Pf4XTx50/pUzN+r5DQh4
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAktdesYACgkQBn4EFUVUIO0bxQCgjG74araRphD6F689pI9G m1m1
jqMAniwEo2vOGIfMgKGOAcLutt7U830h
=tNQK
-----END PGP SIGNATURE-----

--=-Pf4XTx50/pUzN+r5DQh4--

Re: Newbie question about vhost log and webalizer

am 25.01.2010 12:21:09 von joydeep

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/"
>
>
> Options None
> AllowOverride None
> Order allow,deny
> Allow from All
>

>
>
> 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.
#

Options None
AllowOverride None
Order allow,deny
Allow from all


` ` `

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 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: Newbie question about vhost log and webalizer

am 27.01.2010 17:22:35 von Matus UHLAR - fantomas

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 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: Newbie question about vhost log and webalizer

am 27.01.2010 17:46:49 von APA

Hello

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

> On 22.01.10 14:59, J. Bakshi wrote:
>> Two newbie questions
>>=20
>> [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 ?
>>=20
>> [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
--=20



------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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