0 byte logs

0 byte logs

am 28.09.2009 20:18:59 von Oliver Marshall

--_000_E67A4A6D94092C4180055CA36C65ABCA6E28A1B331WHITEg2supp or_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,



We've seen a problem for a while on our ubuntu web server whereby apache st=
arts generating 0 byte logs. This applies to the access logs for the indivi=
dual sites.



The only solution we have found is a quick 'apache2ctl graceful' and the lo=
gs start being generated normally again...for a few days until the whole th=
ing happens again.



Version info is;



Apache/2.2.8 (Ubuntu)

DAV/2

SVN/1.4.3

mod_python/3.3.1

Python/2.5.2

PHP/5.2.4-2ubuntu5.4 with Suhosin-Patch

mod_ssl/2.2.3

OpenSSL/0.9.8g



Any ideas why apache may be outputting blank logs ?



Olly




--_000_E67A4A6D94092C4180055CA36C65ABCA6E28A1B331WHITEg2supp or_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:p=3D"urn:schemas-m=
icrosoft-com:office:powerpoint" xmlns:a=3D"urn:schemas-microsoft-com:office=
:access" xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s=3D"=
uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs=3D"urn:schemas-microsof=
t-com:rowset" xmlns:z=3D"#RowsetSchema" xmlns:b=3D"urn:schemas-microsoft-co=
m:office:publisher" xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadshee=
t" xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" xmlns=
:odc=3D"urn:schemas-microsoft-com:office:odc" xmlns:oa=3D"urn:schemas-micro=
soft-com:office:activation" xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc=3D"http://m=
icrosoft.com/officenet/conferencing" xmlns:D=3D"DAV:" xmlns:Repl=3D"http://=
schemas.microsoft.com/repl/" xmlns:mt=3D"http://schemas.microsoft.com/share=
point/soap/meetings/" xmlns:x2=3D"http://schemas.microsoft.com/office/excel=
/2003/xml" xmlns:ppda=3D"http://www.passport.com/NameSpace.xsd" xmlns:ois=
=3D"http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir=3D"http://=
schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds=3D"http://www.w3=
..org/2000/09/xmldsig#" xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint=
/dsp" xmlns:udc=3D"http://schemas.microsoft.com/data/udc" xmlns:xsd=3D"http=
://www.w3.org/2001/XMLSchema" xmlns:sub=3D"http://schemas.microsoft.com/sha=
repoint/soap/2002/1/alerts/" xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#"=
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" xmlns:sps=3D"http://=
schemas.microsoft.com/sharepoint/soap/" xmlns:xsi=3D"http://www.w3.org/2001=
/XMLSchema-instance" xmlns:udcs=3D"http://schemas.microsoft.com/data/udc/so=
ap" xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " xmlns:udc=
p2p=3D"http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf=3D"http:/=
/schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss=3D"http://sche=
mas.microsoft.com/office/2006/digsig-setup" xmlns:dssi=3D"http://schemas.mi=
crosoft.com/office/2006/digsig" xmlns:mdssi=3D"http://schemas.openxmlformat=
s.org/package/2006/digital-signature" xmlns:mver=3D"http://schemas.openxmlf=
ormats.org/markup-compatibility/2006" xmlns:m=3D"http://schemas.microsoft.c=
om/office/2004/12/omml" xmlns:mrels=3D"http://schemas.openxmlformats.org/pa=
ckage/2006/relationships" xmlns:spwp=3D"http://microsoft.com/sharepoint/web=
partpages" xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/20=
06/types" xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/200=
6/messages" xmlns:pptsl=3D"http://schemas.microsoft.com/sharepoint/soap/ Sli=
deLibrary/" xmlns:spsl=3D"http://microsoft.com/webservices/SharePointPor tal=
Server/PublishedLinksService" xmlns:Z=3D"urn:schemas-microsoft-com:" xmlns:=
st=3D"" xmlns=3D"http://www.w3.org/TR/REC-html40">

>





Hi,


 


We've seen a problem for a while on our ubuntu web s=
erver whereby apache starts generating 0 byte logs. This applies to the acc=
ess logs for the individual sites. 


 


The only solution we have found is a quick 'apache2c=
tl graceful' and the logs start being generated normally again...for a few =
days until the whole thing happens again.


 


Version info is;


 


al","sans-serif";
color:black">Apache/2.2.8 (Ubuntu)


al","sans-serif";
color:black">DAV/2


al","sans-serif";
color:black">SVN/1.4.3


al","sans-serif";
color:black">mod_python/3.3.1


al","sans-serif";
color:black">Python/2.5.2


al","sans-serif";
color:black">PHP/5.2.4-2ubuntu5.4 with Suhosin-Patch


al","sans-serif";
color:black">mod_ssl/2.2.3


al","sans-serif";
color:black">OpenSSL/0.9.8g


 


Any ideas why apache may be outputting blank logs ?<=
o:p>


 


Olly


 






--_000_E67A4A6D94092C4180055CA36C65ABCA6E28A1B331WHITEg2supp or_--

RE: 0 byte logs

am 29.09.2009 10:05:11 von Mick Sheppard

Hi=20Olly,

>=20From:=20Oliver=20Marshall=20[mailto:Oliver.Marshall@g2su pport.com]=20
>=20Sent:=2028=20September=202009=2019:19
>=20To:=20users@httpd.apache.org
>=20Subject:=20[users@httpd]=200=20byte=20logs
>=20
>=20Hi,
>
>=20We've=20seen=20a=20problem=20for=20a=20while=20on=20our= 20ubuntu=20we=
b=20server=20whereby=20apache=20starts=20generating=200=20by te=20logs.
>=20This=20applies=20to=20the=20access=20logs=20for=20the=20 individual=20=
sites. 
>
>=20The=20only=20solution=20we=20have=20found=20is=20a=20qui ck=20'apache2=
ctl=20graceful'=20and=20the=20logs=20start=20being=20generat ed
>=20normally=20again...for=20a=20few=20days=20until=20the=20 whole=20thing=
=20happens=20again.=20
>

A=20couple=20of=20questions:

1)=20What=20are=20you=20using=20to=20rotate=20the=20apache=2 0log=20files?

2)=20When=20you=20rotate=20them=20does=20the=20first=20one=2 0rotated=20co=
ntinue=20to=20grow,=20or=20are=20you=20compressing=20it?

The=20reason=20for=20the=20questions=20is=20that=20it=20soun ds=20as=20if=
=20your=20rotation=20mechanism=20is=20moving=20the=20old=20l og=20files=20=
away=20and=20then=20creating=20a=20new,=20empty=20one.=20Unl ess=20you=20t=
ell=20it=20Apache=20will=20continue=20to=20write=20to=20the= 20old=20log=
=20file=20as=20it=20will=20have=20it=20open.=20When=20you=20 give=20the=20=
'graceful'=20command=20Apache=20restarts=20and=20re-opens=20 the=20log=20f=
ile=20thus=20writing=20to=20the=20new=20logs.

Regards,

Mick=20Sheppard

This=20is=20an=20email=20from=20the=20CPP=20Group=20Plc,=20H olgate=20Park=
,=20York,=20YO26=204GA;=20telephone=20+44=20(0)1904=20544500 .
This=20message=20may=20contain=20information=20that=20is=20c onfidential.=
=20If=20you=20are=20not=20the=20intended=20recipient,
you=20may=20not=20peruse,=20use,=20disseminate,=20distribute =20or=20copy=
=20this=20message.=20If=20you=20have=20received=20this
message=20in=20error,=20please=20notify=20the=20sender=20imm ediately=20by=
=20email,=20facsimile=20or=20telephone=20and=20either
return=20or=20destroy=20the=20original=20message.

The=20CPP=20Group=20Plc=20accepts=20no=20responsibility=20fo r=20any=20cha=
nges=20made=20to=20this=20message=20after=20it=20has=20been
sent=20by=20the=20original=20author. This=20email=20has =20been=20sca=
nned=20for=20all=20viruses=20by=20the=20MessageLabs=20
Email=20Security=20System.

------------------------------------------------------------ ---------
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: 0 byte logs

am 29.09.2009 16:09:05 von Oliver Marshall

Hi Mick,

We are using logrotate to rotate the logs using the following conf file;

*********************
/var/log/apache2/*.log {
weekly
missingok
rotate 12
compress
# delaycompress
notifempty
create 640 www-data www-data
sharedscripts
postrotate
if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-=
/var/run/apache2.pid}`" ]; then
/etc/init.d/apache2 reload > /dev/null
fi
endscript
}
**********************

The log that was just rolled doesn't continue to grow. It's gzip'd and then=
sits there. A new log is created but then doesnt grow. The listing shows t=
his;

-rw-r----- 1 www-data www-data 0 2009-09-27 06:38 access.log
-rw-r----- 1 www-data www-data 1119157 2009-09-27 00:19 access.log.1.gz
-rw-r----- 1 www-data www-data 167234 2009-09-22 05:25 access.log.2.gz

Any ideas ?

Olly


--
G2 Support
Network Support : Online Backups : Server Management

Web: www.g2support.com
Twitter: g2support
Newsletter: www.g2support.com/newsletter


-----Original Message-----
From: Mick Sheppard [mailto:Mick.Sheppard@cpp.co.uk]=20
Sent: 29 September 2009 09:05
To: users@httpd.apache.org
Subject: RE: [users@httpd] 0 byte logs

Hi Olly,

> From: Oliver Marshall [mailto:Oliver.Marshall@g2support.com]=20
> Sent: 28 September 2009 19:19
> To: users@httpd.apache.org
> Subject: [users@httpd] 0 byte logs
>=20
> Hi,
>
> We've seen a problem for a while on our ubuntu web server whereby apache =
starts generating 0 byte logs.
> This applies to the access logs for the individual sites. 
>
> The only solution we have found is a quick 'apache2ctl graceful' and the =
logs start being generated
> normally again...for a few days until the whole thing happens again.=20
>

A couple of questions:

1) What are you using to rotate the apache log files?

2) When you rotate them does the first one rotated continue to grow, or are=
you compressing it?

The reason for the questions is that it sounds as if your rotation mechanis=
m is moving the old log files away and then creating a new, empty one. Unle=
ss you tell it Apache will continue to write to the old log file as it will=
have it open. When you give the 'graceful' command Apache restarts and re-=
opens the log file thus writing to the new logs.

Regards,

Mick Sheppard

This is an email from the CPP Group Plc, Holgate Park, York, YO26 4GA; tele=
phone +44 (0)1904 544500.
This message may contain information that is confidential. If you are not t=
he intended recipient,
you may not peruse, use, disseminate, distribute or copy this message. If y=
ou have received this
message in error, please notify the sender immediately by email, facsimile =
or telephone and either
return or destroy the original message.

The CPP Group Plc accepts no responsibility for any changes made to this me=
ssage after it has been
sent by the original author. This email has been scanned for all viruses b=
y the MessageLabs=20
Email Security System.

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


------------------------------------------------------------ ---------
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: 0 byte logs

am 29.09.2009 16:36:45 von Mick Sheppard

>=20-----Original=20Message-----
>=20From:=20Oliver=20Marshall=20[mailto:Oliver.Marshall@g2su pport.com]
>=20Sent:=2029=20September=202009=2015:09
>=20To:=20users@httpd.apache.org
>=20Subject:=20RE:=20[users@httpd]=200=20byte=20logs
>=20
>=20Hi=20Mick,
>=20
>=20We=20are=20using=20logrotate=20to=20rotate=20the=20logs= 20using=20the=
=20following=20conf
file;
>=20
>=20*********************
>=20/var/log/apache2/*.log=20{
> =20weekly
> =20missingok
> =20rotate=2012
> =20compress
>=20# =20delaycompress
> =20notifempty
> =20create=20640=20www-data=20www-da ta
> =20sharedscripts
> =20postrotate
> =20if=20[=2 0-f=20"`.=20/=
etc/apache2/envvars=20;=20echo
>=20${APACHE_PID_FILE:-/var/run/apache2.pid}`"=20];=20then
> =20=2 0 =
=20/etc/init.d/apache2=20reload=20>=20/dev/null
> =20fi
> =20endscript
>=20}
>=20**********************
>=20
>=20The=20log=20that=20was=20just=20rolled=20doesn't=20conti nue=20to=20gr=
ow.=20It's=20gzip'd=20and
>=20then=20sits=20there.=20A=20new=20log=20is=20created=20bu t=20then=20do=
esnt=20grow.=20The
listing
>=20shows=20this;
>=20
>=20-rw-r-----=201=20www-data=20www-data =2 00=202009-09-=
27=2006:38=20access.log
>=20-rw-r-----=201=20www-data=20www-data=201119157=202009-09 -27=2000:19
access.log.1.gz
>=20-rw-r-----=201=20www-data=20www-data 167234=202009- 09-22=2005:25
access.log.2.gz
>=20
>=20Any=20ideas=20?

I'm=20not=20familiar=20with=20logrotate,=20except=20what=20I 've=20just=20=
googled=20so=20bare
that=20in=20mind.

It=20looks=20as=20though=20your=20postrotate=20script=20isn' t=20reloading=
=20Apache.=20This
is=20the=20cause=20of=20your=200=20byte=20logs.=20Apache=20i s=20still=20a=
ttempting=20to=20write=20to
the=20old=20log=20file,=20now=20compressed=20so=20non-existe nt=20in=20its=
=20original=20form.
It's=20only=20with=20the=20apachectl=20graceful=20you=20are= 20issuing=20t=
hat=20Apache=20knows
to=20use=20the=20new=20log=20file.

What=20does=20the=20test=20in=20the=20if=20statement=20retur n=20if=20you=
=20run=20it=20outside
logrotate?=20Its=20being=20used=20to=20determine=20whether=2 0there=20is=
=20a=20running=20Apache
server=20that=20needs=20to=20be=20reloaded.

Mick

This=20is=20an=20email=20from=20the=20CPP=20Group=20Plc,=20H olgate=20Park=
,=20York,=20YO26=204GA;=20telephone=20+44=20(0)1904=20544500 .
This=20message=20may=20contain=20information=20that=20is=20c onfidential.=
=20If=20you=20are=20not=20the=20intended=20recipient,
you=20may=20not=20peruse,=20use,=20disseminate,=20distribute =20or=20copy=
=20this=20message.=20If=20you=20have=20received=20this
message=20in=20error,=20please=20notify=20the=20sender=20imm ediately=20by=
=20email,=20facsimile=20or=20telephone=20and=20either
return=20or=20destroy=20the=20original=20message.

The=20CPP=20Group=20Plc=20accepts=20no=20responsibility=20fo r=20any=20cha=
nges=20made=20to=20this=20message=20after=20it=20has=20been
sent=20by=20the=20original=20author. This=20email=20has =20been=20sca=
nned=20for=20all=20viruses=20by=20the=20MessageLabs=20
Email=20Security=20System.

------------------------------------------------------------ ---------
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: 0 byte logs

am 29.09.2009 17:29:56 von Oliver Marshall

Thanks Mick.

That helped. The if line returned;

ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars

So I added the following to envvars;

APACHE_PID_FILE=3D/var/run/apache2.pid
export APACHE_PID_FILE

and checked that /var/run/apache2.pid had the pid of apache2 in it.=20


I've forced logrotate to roll the logs and so it appears to be working.

Thanks for the help.

--
G2 Support
Network Support : Online Backups : Server Management

Web: www.g2support.com
Twitter: g2support
Newsletter: www.g2support.com/newsletter


-----Original Message-----
From: Mick Sheppard [mailto:Mick.Sheppard@cpp.co.uk]=20
Sent: 29 September 2009 15:37
To: users@httpd.apache.org
Subject: RE: [users@httpd] 0 byte logs



> -----Original Message-----
> From: Oliver Marshall [mailto:Oliver.Marshall@g2support.com]
> Sent: 29 September 2009 15:09
> To: users@httpd.apache.org
> Subject: RE: [users@httpd] 0 byte logs
>=20
> Hi Mick,
>=20
> We are using logrotate to rotate the logs using the following conf
file;
>=20
> *********************
> /var/log/apache2/*.log {
> weekly
> missingok
> rotate 12
> compress
> # delaycompress
> notifempty
> create 640 www-data www-data
> sharedscripts
> postrotate
> if [ -f "`. /etc/apache2/envvars ; echo
> ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
> /etc/init.d/apache2 reload > /dev/null
> fi
> endscript
> }
> **********************
>=20
> The log that was just rolled doesn't continue to grow. It's gzip'd and
> then sits there. A new log is created but then doesnt grow. The
listing
> shows this;
>=20
> -rw-r----- 1 www-data www-data 0 2009-09-27 06:38 access.log
> -rw-r----- 1 www-data www-data 1119157 2009-09-27 00:19
access.log.1.gz
> -rw-r----- 1 www-data www-data 167234 2009-09-22 05:25
access.log.2.gz
>=20
> Any ideas ?

I'm not familiar with logrotate, except what I've just googled so bare
that in mind.

It looks as though your postrotate script isn't reloading Apache. This
is the cause of your 0 byte logs. Apache is still attempting to write to
the old log file, now compressed so non-existent in its original form.
It's only with the apachectl graceful you are issuing that Apache knows
to use the new log file.

What does the test in the if statement return if you run it outside
logrotate? Its being used to determine whether there is a running Apache
server that needs to be reloaded.

Mick

This is an email from the CPP Group Plc, Holgate Park, York, YO26 4GA; tele=
phone +44 (0)1904 544500.
This message may contain information that is confidential. If you are not t=
he intended recipient,
you may not peruse, use, disseminate, distribute or copy this message. If y=
ou have received this
message in error, please notify the sender immediately by email, facsimile =
or telephone and either
return or destroy the original message.

The CPP Group Plc accepts no responsibility for any changes made to this me=
ssage after it has been
sent by the original author. This email has been scanned for all viruses b=
y the MessageLabs=20
Email Security System.

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


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